]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
Cleanup warnings
authorGabor Liptak <gliptak@gmail.com>
Tue, 9 Jun 2015 11:36:36 +0000 (07:36 -0400)
committerGabor Liptak <gliptak@gmail.com>
Tue, 9 Jun 2015 11:36:36 +0000 (07:36 -0400)
sonar-runner-api/src/main/java/org/sonar/runner/api/Dirs.java
sonar-runner-api/src/main/java/org/sonar/runner/api/SourceEncoding.java
sonar-runner-api/src/test/java/org/sonar/runner/api/DirsTest.java
sonar-runner-api/src/test/java/org/sonar/runner/api/SimpleRunner.java
sonar-runner-api/src/test/java/org/sonar/runner/api/SourceEncodingTest.java
sonar-runner-dist/src/main/java/org/sonar/runner/RunnerFactory.java
sonar-runner-dist/src/test/java/org/sonar/runner/RunnerFactoryTest.java
sonar-runner-impl/src/test/java/org/sonar/runner/impl/BatchLauncherMainTest.java
sonar-runner-impl/src/test/java/org/sonar/runner/impl/IsolatedClassloaderTest.java
sonar-runner-impl/src/test/java/org/sonar/runner/impl/ServerConnectionTest.java

index 369a745ad45a64d1652d020074b5bd72f3d122a9..1ed4a041df57336718da24789b5746816fd5ceec 100644 (file)
@@ -25,7 +25,7 @@ import java.io.File;
 
 class Dirs {
 
-  void init(Runner runner) {
+  void init(Runner<?> runner) {
     boolean onProject = Utils.taskRequiresProject(runner.properties());
     if (onProject) {
       initProjectDirs(runner);
@@ -34,7 +34,7 @@ class Dirs {
     }
   }
 
-  private void initProjectDirs(Runner runner) {
+  private void initProjectDirs(Runner<?> runner) {
     String path = runner.property(ScanProperties.PROJECT_BASEDIR, ".");
     File projectDir = new File(path);
     if (!projectDir.isDirectory()) {
@@ -61,7 +61,7 @@ class Dirs {
   /**
    * Non-scan task
    */
-  private void initTaskDirs(Runner runner) {
+  private void initTaskDirs(Runner<?> runner) {
     String path = runner.property(RunnerProperties.WORK_DIR, ".");
     File workDir = new File(path);
     runner.setProperty(RunnerProperties.WORK_DIR, workDir.getAbsolutePath());
index 1f3915e9bdc7035fa6a58e15df01b5d986977214..44d243bde4267f89e8afcece90fbce8ff0925a60 100644 (file)
@@ -26,7 +26,7 @@ import java.util.Locale;
 
 class SourceEncoding {
 
-  void init(Runner runner) {
+  void init(Runner<?> runner) {
     boolean onProject = Utils.taskRequiresProject(runner.properties());
     if (onProject) {
       String sourceEncoding = runner.property(ScanProperties.PROJECT_SOURCE_ENCODING, "");
index 831376033e5af48ada29c85b60331c24fd57c5a8..b66d07593f62ee6b2f1666caf3078e287b7cea47 100644 (file)
@@ -29,7 +29,7 @@ import static org.fest.assertions.Assertions.assertThat;
 
 public class DirsTest {
 
-  Runner runner = new SimpleRunner();
+  Runner<?> runner = new SimpleRunner();
   Dirs dirs = new Dirs();
 
   @Rule
index fd443d1739887776c4bb9d0084dd996fa74d4a06..25b8c6bdb3de6578b6d958162c5b721911bca958 100644 (file)
@@ -19,7 +19,7 @@
  */
 package org.sonar.runner.api;
 
-class SimpleRunner extends Runner {
+class SimpleRunner extends Runner<SimpleRunner> {
   @Override
   protected void doExecute() {
   }
index 6fc994eb8d55465d174b238fee90c09a90010317..78b0ec45c7c4f7fa6f12966db20d07f53527a06a 100644 (file)
@@ -28,7 +28,7 @@ import static org.fest.assertions.Assertions.assertThat;
 public class SourceEncodingTest {
 
   SourceEncoding encoding = new SourceEncoding();
-  Runner runner = new SimpleRunner();
+  Runner<?> runner = new SimpleRunner();
 
   @Test
   public void should_set_default_platform_encoding() throws Exception {
index 7f1dddf174c87ec33d9129117efdff303a915162..03964280f0e74acea57018c420c8de873b6512ba 100644 (file)
@@ -27,8 +27,8 @@ import java.util.Properties;
 
 class RunnerFactory {
 
-  Runner create(Properties props) {
-    Runner runner;
+  Runner<?> create(Properties props) {
+    Runner<?> runner;
     if ("fork".equals(props.getProperty("sonarRunner.mode"))) {
       runner = ForkedRunner.create();
       String jvmArgs = props.getProperty("sonarRunner.fork.jvmArgs", "");
index 6c003c812dde75224c0e8e4265b32b291533248c..56124d8d3ff4f5b97b18d67e9a7fd28ad6f96186 100644 (file)
@@ -35,7 +35,7 @@ public class RunnerFactoryTest {
   @Test
   public void should_create_embedded_runner_by_default() {
     props.setProperty("foo", "bar");
-    Runner runner = new RunnerFactory().create(props);
+    Runner<?> runner = new RunnerFactory().create(props);
 
     assertThat(runner).isInstanceOf(EmbeddedRunner.class);
     assertThat(runner.properties().get("foo")).isEqualTo("bar");
@@ -46,7 +46,7 @@ public class RunnerFactoryTest {
     props.setProperty("foo", "bar");
     props.setProperty("sonarRunner.mode", "fork");
     props.setProperty("sonarRunner.fork.jvmArgs", "-Xms128m -Xmx512m");
-    Runner runner = new RunnerFactory().create(props);
+    Runner<?> runner = new RunnerFactory().create(props);
 
     assertThat(runner).isInstanceOf(ForkedRunner.class);
     assertThat(runner.properties().get("foo")).isEqualTo("bar");
@@ -57,7 +57,7 @@ public class RunnerFactoryTest {
     public void should_create_forked_runner_with_jvm_arguments() {
       props.setProperty("foo", "bar");
       props.setProperty("sonarRunner.mode", "fork");
-      Runner runner = new RunnerFactory().create(props);
+      Runner<?> runner = new RunnerFactory().create(props);
 
       assertThat(runner).isInstanceOf(ForkedRunner.class);
       assertThat(runner.properties().get("foo")).isEqualTo("bar");
index e959409ff493d35672add54f1f65def7aa7b370d..996fc42ad441d9abce0df66f4b83d374197da691 100644 (file)
@@ -50,7 +50,7 @@ public class BatchLauncherMainTest {
     }), argThat(new ArgumentMatcher<List<Object>>() {
       @Override
       public boolean matches(Object o) {
-        return ((List) o).isEmpty();
+        return ((List<?>) o).isEmpty();
       }
     }));
   }
index 1adaa0df191b5c998713c9526292318b4cf5e5d7..222a2f52cd5254ea6a4b52f933cb2e4aee312c01 100644 (file)
@@ -19,6 +19,8 @@
  */
 package org.sonar.runner.impl;
 
+import java.io.IOException;
+
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
@@ -30,7 +32,7 @@ public class IsolatedClassloaderTest {
   public ExpectedException thrown = ExpectedException.none();
 
   @Test
-  public void should_restrict_loading_from_parent() throws Exception {
+  public void should_restrict_loading_from_parent() throws IOException {
     ClassLoader parentClassloader = getClass().getClassLoader();
     IsolatedClassloader classLoader = new IsolatedClassloader(parentClassloader, new String[][] {new String[] {"UNMASK", "org.apache.ant."}});
 
@@ -39,10 +41,11 @@ public class IsolatedClassloaderTest {
 
     assertThat(classLoader.canLoadFromParent("org.apache.ant.Foo")).isTrue();
     assertThat(classLoader.canLoadFromParent("org.apache.ant.project.Project")).isTrue();
+    classLoader.close();
   }
 
   @Test
-  public void should_use_isolated_system_classloader_when_parent_is_excluded() throws ClassNotFoundException {
+  public void should_use_isolated_system_classloader_when_parent_is_excluded() throws ClassNotFoundException, IOException {
     thrown.expect(ClassNotFoundException.class);
     thrown.expectMessage("org.junit.Test");
     ClassLoader parent = getClass().getClassLoader();
@@ -51,14 +54,16 @@ public class IsolatedClassloaderTest {
     // JUnit is available in the parent classloader (classpath used to execute this test) but not in the core JVM
     assertThat(classLoader.loadClass("java.lang.String", false)).isNotNull();
     classLoader.loadClass("org.junit.Test", false);
+    classLoader.close();
   }
 
   @Test
-  public void should_find_in_parent_when_matches_unmasked_packages() throws ClassNotFoundException {
+  public void should_find_in_parent_when_matches_unmasked_packages() throws ClassNotFoundException, IOException {
     ClassLoader parent = getClass().getClassLoader();
     IsolatedClassloader classLoader = new IsolatedClassloader(parent, new String[][] {new String[] {"UNMASK", "org.junit."}});
 
     // JUnit is available in the parent classloader (classpath used to execute this test) but not in the core JVM
     assertThat(classLoader.loadClass("org.junit.Test", false)).isNotNull();
+    classLoader.close();
   }
 }
index c8bf52561eb48db650e1e522218b4ac1fe5b79d2..b1a94c7aad3358945591dad3c735c4ad242cfb13 100644 (file)
@@ -28,8 +28,6 @@ import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
 import java.io.File;
-import java.io.IOException;
-import java.nio.file.Paths;
 import java.util.Properties;
 
 import static org.fest.assertions.Assertions.assertThat;