From 6a03df65cc0c91a26150ea172a2c480e07326ea1 Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Wed, 1 Mar 2017 15:17:30 +0100 Subject: SONAR-7860 Remove CodeColorizerFormat API --- sonar-plugin-api/pom.xml | 11 --- .../org/sonar/api/web/CodeColorizerFormat.java | 82 ---------------------- .../org/sonar/api/web/CodeColorizerFormatTest.java | 55 --------------- 3 files changed, 148 deletions(-) delete mode 100644 sonar-plugin-api/src/main/java/org/sonar/api/web/CodeColorizerFormat.java delete mode 100644 sonar-plugin-api/src/test/java/org/sonar/api/web/CodeColorizerFormatTest.java (limited to 'sonar-plugin-api') diff --git a/sonar-plugin-api/pom.xml b/sonar-plugin-api/pom.xml index a982696bda0..6ce34e9f521 100644 --- a/sonar-plugin-api/pom.xml +++ b/sonar-plugin-api/pom.xml @@ -67,17 +67,6 @@ sonar-check-api ${project.version} - - ${project.groupId} - sonar-colorizer - ${project.version} - - - org.slf4j - slf4j-api - - - ${project.groupId} sonar-duplications diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/CodeColorizerFormat.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/CodeColorizerFormat.java deleted file mode 100644 index 30a8cca29fd..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/CodeColorizerFormat.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.api.web; - -import com.google.common.base.MoreObjects; -import java.util.List; -import org.sonar.api.batch.sensor.SensorContext; -import org.sonar.api.task.TaskExtension; -import org.sonar.colorizer.Tokenizer; - -/** - * Extend the library sonar-colorizer to support new languages. - * - * @since 1.12 - * @deprecated since 4.5.2 use {@link SensorContext#newHighlighting()} - */ -@Deprecated -public abstract class CodeColorizerFormat implements TaskExtension { - - private String languageKey; - - /** - * @param languageKey the unique sonar key. Not null. - */ - protected CodeColorizerFormat(String languageKey) { - this.languageKey = languageKey; - } - - public final String getLanguageKey() { - return languageKey; - } - - /** - * sonar-colorizer tokenizers for HTML output. - * - * @return a not null list (empty if no tokenizers) - */ - public abstract List getTokenizers(); - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof CodeColorizerFormat)) { - return false; - } - - CodeColorizerFormat format = (CodeColorizerFormat) o; - return languageKey.equals(format.languageKey); - - } - - @Override - public int hashCode() { - return languageKey.hashCode(); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("lang", languageKey) - .toString(); - } -} diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/web/CodeColorizerFormatTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/web/CodeColorizerFormatTest.java deleted file mode 100644 index 1bb318a0e73..00000000000 --- a/sonar-plugin-api/src/test/java/org/sonar/api/web/CodeColorizerFormatTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.api.web; - -import java.util.Collections; -import java.util.List; - -import org.junit.Test; -import org.sonar.colorizer.Tokenizer; - -import static org.assertj.core.api.Assertions.assertThat; - -public class CodeColorizerFormatTest { - - @Test - public void keyIsLanguage() { - CodeColorizerFormat format = new FakeFormat("foo"); - assertThat(format.getLanguageKey()).isEqualTo("foo"); - - assertThat(format.equals(new FakeFormat("foo"))).isTrue(); - assertThat(format.equals(new FakeFormat("bar"))).isFalse(); - assertThat(format.hashCode()).isEqualTo(format.hashCode()); - assertThat(format.hashCode()).isEqualTo(new FakeFormat("foo").hashCode()); - assertThat(format.toString()).isEqualTo("FakeFormat{lang=foo}"); - } - - private static class FakeFormat extends CodeColorizerFormat { - - public FakeFormat(String languageKey) { - super(languageKey); - } - - @Override - public List getTokenizers() { - return Collections.emptyList(); - } - } -} -- cgit v1.2.3