From c81e8866c67f02a245abc25ecdb8f6f482c1bd30 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 5 Dec 2011 17:40:22 +0100 Subject: [PATCH] SONAR-3055 API: remove the attribute "classes" of the annotations @DependsUpon and @DependedUpon --- .../org/sonar/plugins/squid/SquidSensor.java | 10 +++---- .../sonar/api/batch/GeneratesViolations.java | 30 ------------------- .../api/batch/BatchExtensionDictionnary.java | 3 +- .../org/sonar/api/batch/DependedUpon.java | 5 ---- .../java/org/sonar/api/batch/DependsUpon.java | 6 ---- .../org/sonar/api/checks/NoSonarFilter.java | 4 +-- .../dag/CyclicDependenciesException.java | 11 ------- 7 files changed, 8 insertions(+), 61 deletions(-) delete mode 100644 sonar-deprecated/src/main/java/org/sonar/api/batch/GeneratesViolations.java diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidSensor.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidSensor.java index fc91ce2b39a..f41ceb5f24c 100644 --- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidSensor.java +++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidSensor.java @@ -38,7 +38,7 @@ import java.util.List; @Phase(name = Phase.Name.PRE) @DependsUpon(JavaUtils.BARRIER_BEFORE_SQUID) -@DependedUpon(value = JavaUtils.BARRIER_AFTER_SQUID, classes = NoSonarFilter.class) +@DependedUpon(value = JavaUtils.BARRIER_AFTER_SQUID) public class SquidSensor implements Sensor { private NoSonarFilter noSonarFilter; @@ -65,10 +65,10 @@ public class SquidSensor implements Sensor { private void analyzeMainSources(Project project, SensorContext context) { boolean analyzePropertyAccessors = project.getConfiguration().getBoolean(SquidPluginProperties.SQUID_ANALYSE_ACCESSORS_PROPERTY, - SquidPluginProperties.SQUID_ANALYSE_ACCESSORS_DEFAULT_VALUE); + SquidPluginProperties.SQUID_ANALYSE_ACCESSORS_DEFAULT_VALUE); String fieldNamesToExcludeFromLcom4Computation = project.getConfiguration().getString( - SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION, - SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION_DEFAULT_VALUE); + SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION, + SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION_DEFAULT_VALUE); Charset charset = project.getFileSystem().getSourceCharset(); AnnotationCheckFactory factory = AnnotationCheckFactory.create(profile, SquidConstants.REPOSITORY_KEY, SquidRuleRepository.getCheckClasses()); @@ -91,7 +91,7 @@ public class SquidSensor implements Sensor { /** * Visibility has been relaxed to make the code testable. - * + * * @return collection of jar-files and directories with classes for analysis */ protected Collection getBytecodeFiles(Project project) { diff --git a/sonar-deprecated/src/main/java/org/sonar/api/batch/GeneratesViolations.java b/sonar-deprecated/src/main/java/org/sonar/api/batch/GeneratesViolations.java deleted file mode 100644 index cd20e179946..00000000000 --- a/sonar-deprecated/src/main/java/org/sonar/api/batch/GeneratesViolations.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2011 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar 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. - * - * Sonar 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 Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.api.batch; - -import org.sonar.api.rules.ViolationFilter; - -/** - * @deprecated since 2.3. Use @DependsUpon(DecoratorBarriers.START_VIOLATIONS_GENERATION) and @DependedUpon(DecoratorBarriers.END_OF_VIOLATIONS_GENERATION) - */ -@Deprecated -@DependsUpon(classes = ViolationFilter.class) -public interface GeneratesViolations { -} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/BatchExtensionDictionnary.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/BatchExtensionDictionnary.java index e7b62cf8dde..fb37437ff93 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/BatchExtensionDictionnary.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/BatchExtensionDictionnary.java @@ -179,10 +179,9 @@ public class BatchExtensionDictionnary { if (annotation != null) { if (annotation.annotationType().isAssignableFrom(DependsUpon.class)) { results.addAll(Arrays.asList(((DependsUpon) annotation).value())); - results.addAll(Arrays.asList(((DependsUpon) annotation).classes())); + } else if (annotation.annotationType().isAssignableFrom(DependedUpon.class)) { results.addAll(Arrays.asList(((DependedUpon) annotation).value())); - results.addAll(Arrays.asList(((DependedUpon) annotation).classes())); } } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/DependedUpon.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/DependedUpon.java index f02d8e213ce..2de2e692f0e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/DependedUpon.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/DependedUpon.java @@ -37,9 +37,4 @@ public @interface DependedUpon { */ String[] value() default {}; - /** - * Used only on classes. Must be keep empty on methods. - */ - Class[] classes() default {}; - } \ No newline at end of file diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/DependsUpon.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/DependsUpon.java index f6e4a3c00e0..0a277a4464a 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/DependsUpon.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/DependsUpon.java @@ -35,10 +35,4 @@ public @interface DependsUpon { * Used only on classes. Must be keep empty on methods. */ String[] value() default {}; - - /** - * Used only on classes. Must be keep empty on methods. - */ - Class[] classes() default {}; - } \ No newline at end of file diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/checks/NoSonarFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/checks/NoSonarFilter.java index df4f8f0840c..02287e7b3a3 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/checks/NoSonarFilter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/checks/NoSonarFilter.java @@ -19,11 +19,11 @@ */ package org.sonar.api.checks; +import com.google.common.collect.Maps; import org.sonar.api.resources.Resource; import org.sonar.api.rules.Violation; import org.sonar.api.rules.ViolationFilter; -import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -32,7 +32,7 @@ import java.util.Set; */ public class NoSonarFilter implements ViolationFilter { - private final Map> noSonarLinesByResource = new HashMap>(); + private final Map> noSonarLinesByResource = Maps.newHashMap(); public void addResource(Resource resource, Set noSonarLines) { if (resource != null && noSonarLines != null) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/CyclicDependenciesException.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/CyclicDependenciesException.java index c8967512a1c..5370f05773c 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/CyclicDependenciesException.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/CyclicDependenciesException.java @@ -25,19 +25,8 @@ import org.sonar.api.utils.SonarException; * @since 1.10 */ public class CyclicDependenciesException extends SonarException { - public CyclicDependenciesException() { - } - public CyclicDependenciesException(String s) { super(s); } - - public CyclicDependenciesException(String s, Throwable throwable) { - super(s, throwable); - } - - public CyclicDependenciesException(Throwable throwable) { - super(throwable); - } } -- 2.39.5