]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2469 fix typo in name of InstantiationStrategy class
authorsimonbrandhof <simon.brandhof@gmail.com>
Thu, 26 May 2011 06:33:18 +0000 (08:33 +0200)
committersimonbrandhof <simon.brandhof@gmail.com>
Thu, 26 May 2011 06:33:18 +0000 (08:33 +0200)
plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/UnusedPrivateMethodCheck.java
sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchExtensionInstaller.java
sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java
sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectExtensionInstaller.java
sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchExtensionInstallerTest.java
sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionUtilsTest.java
sonar-core/src/main/java/org/sonar/jpa/dialect/DialectRepository.java
sonar-plugin-api/src/main/java/org/sonar/api/batch/InstanciationStrategy.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/InstantiationStrategy.java [new file with mode: 0644]

index f91fb6da9d7561ac6158c2873149950a6cd5f31d..6f4216d8b4d972d1e083c99c4c2fff11dcb04874 100644 (file)
@@ -33,7 +33,7 @@ import org.sonar.squid.api.SourceMethod;
         "This helps in maintenance by decreasing the maintained code size, " +
         "making it easier to understand the program and preventing bugs from being introduced.</p>" +
         "<p>In the following two cases, private methods are not considered as dead code by Sonar :</p>" +
-        "<ul><li>Private empty constructors that are intentionally used to prevent any direct instanciation of a class.</li>" +
+        "<ul><li>Private empty constructors that are intentionally used to prevent any direct instantiation of a class.</li>" +
         "<li>Private methods : readObject(...), writeObject(...), writeReplace(...), readResolve(...) " +
         "which can contractually be used when implementing the Serializable interface.</li></ul>")
 public class UnusedPrivateMethodCheck extends BytecodeCheck {
index d111f444ec4104b50ff5790d1ead0dae8671cf4e..f176e1a81fc5ab8acf2dd6987d1f8bc86d5718f7 100644 (file)
@@ -23,7 +23,7 @@ import org.sonar.api.BatchComponent;
 import org.sonar.api.ExtensionProvider;
 import org.sonar.api.Plugin;
 import org.sonar.api.batch.CoverageExtension;
-import org.sonar.api.batch.InstanciationStrategy;
+import org.sonar.api.batch.InstantiationStrategy;
 import org.sonar.batch.bootstrapper.EnvironmentInformation;
 
 import java.util.List;
@@ -64,9 +64,9 @@ public final class BatchExtensionInstaller implements BatchComponent {
   void installExtension(Module module, Object extension) {
     if (ExtensionUtils.isBatchExtension(extension) &&
         ExtensionUtils.isSupportedEnvironment(extension, environment) &&
-        ExtensionUtils.isInstantiationStrategy(extension, InstanciationStrategy.PER_BATCH)) {
+        ExtensionUtils.isInstantiationStrategy(extension, InstantiationStrategy.PER_BATCH)) {
       if (ExtensionUtils.isType(extension, CoverageExtension.class)) {
-        throw new IllegalArgumentException("Instantiation strategy " + InstanciationStrategy.PER_BATCH + " is not supported on CoverageExtension components: " + extension);
+        throw new IllegalArgumentException("Instantiation strategy " + InstantiationStrategy.PER_BATCH + " is not supported on CoverageExtension components: " + extension);
       }
       module.addComponent(extension);
     }
index 01a7c809eca9d7636f9462a64dceebc4b36ebb1c..a7907b6b08efb5bb69b643a05729d36681a8fe3f 100644 (file)
@@ -22,7 +22,7 @@ package org.sonar.batch.bootstrap;
 import org.apache.commons.lang.StringUtils;
 import org.sonar.api.BatchExtension;
 import org.sonar.api.Extension;
-import org.sonar.api.batch.InstanciationStrategy;
+import org.sonar.api.batch.InstantiationStrategy;
 import org.sonar.api.batch.SupportedEnvironment;
 import org.sonar.api.utils.AnnotationUtils;
 import org.sonar.batch.bootstrapper.EnvironmentInformation;
@@ -35,11 +35,11 @@ public final class ExtensionUtils {
 
   static boolean isInstantiationStrategy(Object extension, String strategy) {
     Class clazz = (extension instanceof Class ? (Class) extension : extension.getClass());
-    InstanciationStrategy extStrategy = AnnotationUtils.getClassAnnotation(clazz, InstanciationStrategy.class);
+    InstantiationStrategy extStrategy = AnnotationUtils.getClassAnnotation(clazz, InstantiationStrategy.class);
     if (extStrategy != null) {
       return strategy.equals(extStrategy.value());
     }
-    return InstanciationStrategy.PER_PROJECT.equals(strategy);
+    return InstantiationStrategy.PER_PROJECT.equals(strategy);
   }
 
   static boolean isBatchExtension(Object extension) {
index 4d3faea35c06d5664c3eeb2a5c7ef4421d29fac6..bfb924cf7b46f6327fb7654020c0d3a779bf17c9 100644 (file)
@@ -26,7 +26,7 @@ import org.sonar.api.ExtensionProvider;
 import org.sonar.api.Plugin;
 import org.sonar.api.batch.AbstractCoverageExtension;
 import org.sonar.api.batch.CoverageExtension;
-import org.sonar.api.batch.InstanciationStrategy;
+import org.sonar.api.batch.InstantiationStrategy;
 import org.sonar.api.resources.Java;
 import org.sonar.api.resources.Project;
 import org.sonar.batch.bootstrapper.EnvironmentInformation;
@@ -71,7 +71,7 @@ public final class ProjectExtensionInstaller implements BatchComponent {
   private Object installExtension(Module module, Object extension, Project project, String pluginKey) {
     if (ExtensionUtils.isBatchExtension(extension) &&
         ExtensionUtils.isSupportedEnvironment(extension, environment) &&
-        ExtensionUtils.isInstantiationStrategy(extension, InstanciationStrategy.PER_PROJECT) &&
+        ExtensionUtils.isInstantiationStrategy(extension, InstantiationStrategy.PER_PROJECT) &&
         !isDeactivatedCoverageExtension(extension, project, pluginKey)) {
 
       module.addComponent(extension);
index fbd29a905453b76281d173dde4427f251a26ad06..4f81bd34294c7bb33cf4ef6924e4f0cc13500832 100644 (file)
@@ -22,7 +22,7 @@ package org.sonar.batch.bootstrap;
 import org.junit.Test;
 import org.sonar.api.*;
 import org.sonar.api.batch.CoverageExtension;
-import org.sonar.api.batch.InstanciationStrategy;
+import org.sonar.api.batch.InstantiationStrategy;
 import org.sonar.batch.bootstrapper.EnvironmentInformation;
 
 import java.util.Arrays;
@@ -93,7 +93,7 @@ public class BatchExtensionInstallerTest {
     }
   }
 
-  @InstanciationStrategy(InstanciationStrategy.PER_BATCH)
+  @InstantiationStrategy(InstantiationStrategy.PER_BATCH)
   public static class BatchService implements BatchExtension {
 
   }
@@ -106,7 +106,7 @@ public class BatchExtensionInstallerTest {
 
   }
 
-  @InstanciationStrategy(InstanciationStrategy.PER_BATCH)
+  @InstantiationStrategy(InstantiationStrategy.PER_BATCH)
   public static class BatchServiceProvider extends ExtensionProvider implements BatchExtension {
 
     @Override
@@ -122,7 +122,7 @@ public class BatchExtensionInstallerTest {
     }
   }
 
-  @InstanciationStrategy(InstanciationStrategy.PER_BATCH)
+  @InstantiationStrategy(InstantiationStrategy.PER_BATCH)
   public static class InvalidCoverageExtension implements CoverageExtension {
     // strategy PER_BATCH is not allowed
   }
index b29fd6831f31a1b9e5e859b0b123ef7ad56765c7..40d3e8c922549d82911b73544b332fdd4a8a0516 100644 (file)
@@ -22,7 +22,7 @@ package org.sonar.batch.bootstrap;
 import org.junit.Test;
 import org.sonar.api.BatchExtension;
 import org.sonar.api.ServerExtension;
-import org.sonar.api.batch.InstanciationStrategy;
+import org.sonar.api.batch.InstantiationStrategy;
 import org.sonar.api.batch.SupportedEnvironment;
 import org.sonar.batch.bootstrapper.EnvironmentInformation;
 
@@ -33,22 +33,22 @@ public class ExtensionUtilsTest {
 
   @Test
   public void shouldBeBatchInstantiationStrategy() {
-    assertThat(ExtensionUtils.isInstantiationStrategy(BatchService.class, InstanciationStrategy.PER_BATCH), is(true));
-    assertThat(ExtensionUtils.isInstantiationStrategy(new BatchService(), InstanciationStrategy.PER_BATCH), is(true));
-    assertThat(ExtensionUtils.isInstantiationStrategy(ProjectService.class, InstanciationStrategy.PER_BATCH), is(false));
-    assertThat(ExtensionUtils.isInstantiationStrategy(new ProjectService(), InstanciationStrategy.PER_BATCH), is(false));
-    assertThat(ExtensionUtils.isInstantiationStrategy(DefaultService.class, InstanciationStrategy.PER_BATCH), is(false));
-    assertThat(ExtensionUtils.isInstantiationStrategy(new DefaultService(), InstanciationStrategy.PER_BATCH), is(false));
+    assertThat(ExtensionUtils.isInstantiationStrategy(BatchService.class, InstantiationStrategy.PER_BATCH), is(true));
+    assertThat(ExtensionUtils.isInstantiationStrategy(new BatchService(), InstantiationStrategy.PER_BATCH), is(true));
+    assertThat(ExtensionUtils.isInstantiationStrategy(ProjectService.class, InstantiationStrategy.PER_BATCH), is(false));
+    assertThat(ExtensionUtils.isInstantiationStrategy(new ProjectService(), InstantiationStrategy.PER_BATCH), is(false));
+    assertThat(ExtensionUtils.isInstantiationStrategy(DefaultService.class, InstantiationStrategy.PER_BATCH), is(false));
+    assertThat(ExtensionUtils.isInstantiationStrategy(new DefaultService(), InstantiationStrategy.PER_BATCH), is(false));
   }
 
   @Test
   public void shouldBeProjectInstantiationStrategy() {
-    assertThat(ExtensionUtils.isInstantiationStrategy(BatchService.class, InstanciationStrategy.PER_PROJECT), is(false));
-    assertThat(ExtensionUtils.isInstantiationStrategy(new BatchService(), InstanciationStrategy.PER_PROJECT), is(false));
-    assertThat(ExtensionUtils.isInstantiationStrategy(ProjectService.class, InstanciationStrategy.PER_PROJECT), is(true));
-    assertThat(ExtensionUtils.isInstantiationStrategy(new ProjectService(), InstanciationStrategy.PER_PROJECT), is(true));
-    assertThat(ExtensionUtils.isInstantiationStrategy(DefaultService.class, InstanciationStrategy.PER_PROJECT), is(true));
-    assertThat(ExtensionUtils.isInstantiationStrategy(new DefaultService(), InstanciationStrategy.PER_PROJECT), is(true));
+    assertThat(ExtensionUtils.isInstantiationStrategy(BatchService.class, InstantiationStrategy.PER_PROJECT), is(false));
+    assertThat(ExtensionUtils.isInstantiationStrategy(new BatchService(), InstantiationStrategy.PER_PROJECT), is(false));
+    assertThat(ExtensionUtils.isInstantiationStrategy(ProjectService.class, InstantiationStrategy.PER_PROJECT), is(true));
+    assertThat(ExtensionUtils.isInstantiationStrategy(new ProjectService(), InstantiationStrategy.PER_PROJECT), is(true));
+    assertThat(ExtensionUtils.isInstantiationStrategy(DefaultService.class, InstantiationStrategy.PER_PROJECT), is(true));
+    assertThat(ExtensionUtils.isInstantiationStrategy(new DefaultService(), InstantiationStrategy.PER_PROJECT), is(true));
   }
 
   @Test
@@ -69,12 +69,12 @@ public class ExtensionUtilsTest {
     assertThat(ExtensionUtils.isSupportedEnvironment(new BuildToolService(), new EnvironmentInformation("eclipse", "0.1")), is(false));
   }
 
-  @InstanciationStrategy(InstanciationStrategy.PER_BATCH)
+  @InstantiationStrategy(InstantiationStrategy.PER_BATCH)
   public static class BatchService implements BatchExtension {
 
   }
 
-  @InstanciationStrategy(InstanciationStrategy.PER_PROJECT)
+  @InstantiationStrategy(InstantiationStrategy.PER_PROJECT)
   public static class ProjectService implements BatchExtension {
 
   }
index 48d0633108446101cf44adb375c37e2ab31e59d0..aa025b056e416d669c38898167de14bcbf559497 100644 (file)
@@ -82,7 +82,7 @@ public final class DialectRepository {
     } catch (ClassNotFoundException e) {
       // dialectId was not a class name :)
     } catch (Exception e) {
-      throw new SonarException("Unable to instanciate dialect class", e);
+      throw new SonarException("Unable to instantiate dialect class", e);
     }
     return null;
   }
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/InstanciationStrategy.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/InstanciationStrategy.java
deleted file mode 100644 (file)
index 1701bc8..0000000
+++ /dev/null
@@ -1,46 +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 java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Define instanciation strategy of batch extensions. If an extension is not annotated, then default value
- * is {@link org.sonar.api.batch.InstanciationStrategy#PER_PROJECT}.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface InstanciationStrategy {
-
-  /**
-   * Shared extension. Lifecycle is the full analysis.
-   */
-  public static final String PER_BATCH = "PER_BATCH";
-
-  /**
-   * Created and initialized for each project and sub-project (a project is a module in Maven terminology).
-   */
-  public static final String PER_PROJECT = "PER_PROJECT";
-
-  String value();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/InstantiationStrategy.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/InstantiationStrategy.java
new file mode 100644 (file)
index 0000000..b270d9c
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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 java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Define instantiation strategy of batch extensions. If an extension is not annotated, then default value
+ * is {@link org.sonar.api.batch.InstantiationStrategy#PER_PROJECT}.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface InstantiationStrategy {
+
+  /**
+   * Shared extension. Lifecycle is the full analysis.
+   */
+  public static final String PER_BATCH = "PER_BATCH";
+
+  /**
+   * Created and initialized for each project and sub-project (a project is a module in Maven terminology).
+   */
+  public static final String PER_PROJECT = "PER_PROJECT";
+
+  String value();
+}