From 872b3923f80d9a2bcc13713f41cf801f2a7024eb Mon Sep 17 00:00:00 2001 From: David Gageot Date: Tue, 24 Apr 2012 10:12:28 +0200 Subject: Remove warnings --- .../main/java/org/sonar/plugins/cpd/CpdPlugin.java | 23 ++++++++++++++-------- .../java/org/sonar/plugins/cpd/PmdEngineTest.java | 11 ++++------- 2 files changed, 19 insertions(+), 15 deletions(-) (limited to 'plugins/sonar-cpd-plugin') diff --git a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java index 2708f843d17..9b734290990 100644 --- a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java +++ b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java @@ -19,13 +19,17 @@ */ package org.sonar.plugins.cpd; -import org.sonar.api.*; +import com.google.common.collect.ImmutableList; +import org.sonar.api.BatchExtension; +import org.sonar.api.CoreProperties; +import org.sonar.api.Properties; +import org.sonar.api.Property; import org.sonar.api.PropertyType; +import org.sonar.api.SonarPlugin; import org.sonar.plugins.cpd.decorators.DuplicationDensityDecorator; import org.sonar.plugins.cpd.decorators.SumDuplicationsDecorator; import org.sonar.plugins.cpd.index.IndexFactory; -import java.util.Arrays; import java.util.List; @Properties({ @@ -92,12 +96,15 @@ import java.util.List; }) public final class CpdPlugin extends SonarPlugin { - public List getExtensions() { - return Arrays.asList(CpdSensor.class, SumDuplicationsDecorator.class, DuplicationDensityDecorator.class, - IndexFactory.class, - SonarEngine.class, - PmdEngine.class, - SonarBridgeEngine.class); + public List> getExtensions() { + return ImmutableList.of( + CpdSensor.class, + SumDuplicationsDecorator.class, + DuplicationDensityDecorator.class, + IndexFactory.class, + SonarEngine.class, + PmdEngine.class, + SonarBridgeEngine.class); } } diff --git a/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/PmdEngineTest.java b/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/PmdEngineTest.java index 54a86f56063..3bbedf7f787 100644 --- a/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/PmdEngineTest.java +++ b/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/PmdEngineTest.java @@ -56,8 +56,7 @@ public class PmdEngineTest { public void defaultMinimumTokens() { Project project = createJavaProject().setConfiguration(new PropertiesConfiguration()); - PmdEngine engine = new PmdEngine(); - assertEquals(CoreProperties.CPD_MINIMUM_TOKENS_DEFAULT_VALUE, engine.getMinimumTokens(project)); + assertEquals(CoreProperties.CPD_MINIMUM_TOKENS_DEFAULT_VALUE, PmdEngine.getMinimumTokens(project)); } @Test @@ -66,8 +65,7 @@ public class PmdEngineTest { conf.setProperty("sonar.cpd.minimumTokens", "33"); Project project = createJavaProject().setConfiguration(conf); - PmdEngine engine = new PmdEngine(); - assertEquals(33, engine.getMinimumTokens(project)); + assertEquals(33, PmdEngine.getMinimumTokens(project)); } @Test @@ -79,9 +77,8 @@ public class PmdEngineTest { Project phpProject = createPhpProject().setConfiguration(conf); Project javaProject = createJavaProject().setConfiguration(conf); - PmdEngine engine = new PmdEngine(); - assertEquals(100, engine.getMinimumTokens(javaProject)); - assertEquals(33, engine.getMinimumTokens(phpProject)); + assertEquals(100, PmdEngine.getMinimumTokens(javaProject)); + assertEquals(33, PmdEngine.getMinimumTokens(phpProject)); } private Project createJavaProject() { -- cgit v1.2.3