maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tibordig...@apache.org
Subject maven-surefire git commit: added unit test and jsr305 @Nonnull/@Nullable for SUREFIRE-1262
Date Thu, 23 Nov 2017 02:02:50 GMT
Repository: maven-surefire
Updated Branches:
  refs/heads/master 7b9815c8b -> c594ac4c4


added unit test and jsr305 @Nonnull/@Nullable for SUREFIRE-1262


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/c594ac4c
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/c594ac4c
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/c594ac4c

Branch: refs/heads/master
Commit: c594ac4c4278e109e2937d2581efc363d7002f75
Parents: 7b9815c
Author: Tibor17 <tibordigana@apache.org>
Authored: Thu Nov 23 03:02:15 2017 +0100
Committer: Tibor17 <tibordigana@apache.org>
Committed: Thu Nov 23 03:02:15 2017 +0100

----------------------------------------------------------------------
 .../plugin/surefire/AbstractSurefireMojo.java   |  52 ++++----
 .../maven/plugin/surefire/ProviderInfo.java     |   1 +
 .../surefire/SurefireDependencyResolver.java    |   3 +-
 .../ClasspathForkConfiguration.java             |  17 ++-
 .../booterclient/DefaultForkConfiguration.java  |  10 +-
 .../booterclient/ForkConfiguration.java         |   2 +-
 .../surefire/booterclient/ForkStarter.java      |   3 +-
 .../JarManifestForkConfiguration.java           |  16 ++-
 .../ModularClasspathForkConfiguration.java      |  26 ++--
 .../DefaultForkConfigurationTest.java           |  41 +++---
 .../ModularClasspathForkConfigurationTest.java  | 126 +++++++++++++++++++
 .../apache/maven/surefire/JUnit4SuiteTest.java  |   4 +-
 pom.xml                                         |   5 +-
 surefire-booter/pom.xml                         |   5 +
 .../booter/AbstractPathConfiguration.java       |   6 +-
 .../apache/maven/surefire/booter/Classpath.java |  24 ++--
 .../surefire/booter/ClasspathConfiguration.java |   9 +-
 .../maven/surefire/booter/ModularClasspath.java |  10 +-
 .../booter/ModularClasspathConfiguration.java   |   8 +-
 .../surefire/booter/StartupConfiguration.java   |   7 +-
 20 files changed, 280 insertions(+), 95 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index 16b59ca..7beea89 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -854,6 +854,7 @@ public abstract class AbstractSurefireMojo
         }
     }
 
+    @Nonnull
     protected final PluginConsoleLogger getConsoleLogger()
     {
         if ( consoleLogger == null )
@@ -876,6 +877,7 @@ public abstract class AbstractSurefireMojo
         toolchain = getToolchain();
     }
 
+    @Nonnull
     private DefaultScanResult scanForTestClasses()
         throws MojoFailureException
     {
@@ -960,7 +962,7 @@ public abstract class AbstractSurefireMojo
         return true;
     }
 
-    private void executeAfterPreconditionsChecked( DefaultScanResult scanResult )
+    private void executeAfterPreconditionsChecked( @Nonnull DefaultScanResult scanResult )
         throws MojoExecutionException, MojoFailureException
     {
         List<ProviderInfo> providers = createProviders();
@@ -1076,7 +1078,7 @@ public abstract class AbstractSurefireMojo
         }
         if ( getConsoleLogger().isDebugEnabled() )
         {
-            showToLog( result, getConsoleLogger(), "system property" );
+            showToLog( result, getConsoleLogger() );
         }
         return result;
     }
@@ -1100,16 +1102,17 @@ public abstract class AbstractSurefireMojo
         return intersection;
     }
 
-    private void showToLog( SurefireProperties props, ConsoleLogger log, String setting )
+    private void showToLog( SurefireProperties props, ConsoleLogger log )
     {
         for ( Object key : props.getStringKeySet() )
         {
             String value = props.getProperty( (String) key );
-            log.debug( "Setting " + setting + " [" + key + "]=[" + value + "]" );
+            log.debug( "Setting system property [" + key + "]=[" + value + "]" );
         }
     }
 
-    private RunResult executeProvider( ProviderInfo provider, DefaultScanResult scanResult )
+    @Nonnull
+    private RunResult executeProvider( @Nonnull ProviderInfo provider, @Nonnull DefaultScanResult scanResult )
         throws MojoExecutionException, MojoFailureException, SurefireExecutionException, SurefireBooterForkException,
         TestSetFailedException
     {
@@ -1676,9 +1679,9 @@ public abstract class AbstractSurefireMojo
         return new File( getBasedir(), ".surefire-" + configurationHash );
     }
 
-    private StartupConfiguration createStartupConfiguration( ProviderInfo provider, boolean isInprocess,
-                                                             ClassLoaderConfiguration classLoaderConfiguration,
-                                                             DefaultScanResult scanResult )
+    private StartupConfiguration createStartupConfiguration( @Nonnull ProviderInfo provider, boolean isInprocess,
+                                                             @Nonnull ClassLoaderConfiguration classLoaderConfiguration,
+                                                             @Nonnull DefaultScanResult scanResult )
         throws MojoExecutionException, MojoFailureException
     {
         try
@@ -1725,8 +1728,8 @@ public abstract class AbstractSurefireMojo
     }
 
     private StartupConfiguration newStartupConfigForNonModularClasspath(
-            ClassLoaderConfiguration classLoaderConfiguration, Classpath providerClasspath, Classpath inprocClasspath,
-            String providerName )
+            @Nonnull ClassLoaderConfiguration classLoaderConfiguration, @Nonnull Classpath providerClasspath,
+            @Nonnull Classpath inprocClasspath, @Nonnull String providerName )
             throws MojoExecutionException, MojoFailureException, InvalidVersionSpecificationException,
             AbstractArtifactResolutionException
     {
@@ -1744,9 +1747,9 @@ public abstract class AbstractSurefireMojo
                 false );
     }
 
-    private StartupConfiguration newStartupConfigForModularClasspath( ClassLoaderConfiguration classLoaderConfiguration,
-                                                              Classpath providerClasspath, String providerName,
-                                                              File moduleDescriptor, DefaultScanResult scanResult )
+    private StartupConfiguration newStartupConfigForModularClasspath(
+            @Nonnull ClassLoaderConfiguration classLoaderConfiguration, @Nonnull Classpath providerClasspath,
+            @Nonnull String providerName, @Nonnull File moduleDescriptor, @Nonnull DefaultScanResult scanResult )
             throws MojoExecutionException, MojoFailureException, InvalidVersionSpecificationException,
             AbstractArtifactResolutionException, IOException
     {
@@ -2024,10 +2027,10 @@ public abstract class AbstractSurefireMojo
         return getProjectArtifactMap().get( "junit:junit-dep" );
     }
 
-    private ForkStarter createForkStarter( ProviderInfo provider, ForkConfiguration forkConfiguration,
-                                           ClassLoaderConfiguration classLoaderConfiguration,
-                                           RunOrderParameters runOrderParameters, ConsoleLogger log,
-                                           DefaultScanResult scanResult )
+    private ForkStarter createForkStarter( @Nonnull ProviderInfo provider, @Nonnull ForkConfiguration forkConfiguration,
+                                           @Nonnull ClassLoaderConfiguration classLoaderConfiguration,
+                                           @Nonnull RunOrderParameters runOrderParameters, @Nonnull ConsoleLogger log,
+                                           @Nonnull DefaultScanResult scanResult )
         throws MojoExecutionException, MojoFailureException
     {
         StartupConfiguration startupConfiguration =
@@ -2039,10 +2042,10 @@ public abstract class AbstractSurefireMojo
                                 getForkedProcessTimeoutInSeconds(), startupReportConfiguration, log );
     }
 
-    private InPluginVMSurefireStarter createInprocessStarter( ProviderInfo provider,
-                                                              ClassLoaderConfiguration classLoaderConfiguration,
-                                                              RunOrderParameters runOrderParameters,
-                                                              DefaultScanResult scanResult )
+    private InPluginVMSurefireStarter createInprocessStarter( @Nonnull ProviderInfo provider,
+                                                             @Nonnull ClassLoaderConfiguration classLoaderConfiguration,
+                                                              @Nonnull RunOrderParameters runOrderParameters,
+                                                              @Nonnull DefaultScanResult scanResult )
         throws MojoExecutionException, MojoFailureException
     {
         StartupConfiguration startupConfiguration =
@@ -2054,6 +2057,7 @@ public abstract class AbstractSurefireMojo
                                               getConsoleLogger() );
     }
 
+    @Nonnull
     private ForkConfiguration getForkConfiguration() throws MojoFailureException
     {
         File tmpDir = getSurefireTempDir();
@@ -2359,6 +2363,7 @@ public abstract class AbstractSurefireMojo
         return false;
     }
 
+    @Nonnull
     protected ClassLoaderConfiguration getClassLoaderConfiguration()
     {
         return isForking()
@@ -2776,6 +2781,7 @@ public abstract class AbstractSurefireMojo
         }
 
         @Override
+        @Nonnull
         public Classpath getProviderClasspath()
             throws ArtifactResolutionException, ArtifactNotFoundException
         {
@@ -2806,6 +2812,7 @@ public abstract class AbstractSurefireMojo
         }
 
         @Override
+        @Nonnull
         public Classpath getProviderClasspath()
             throws ArtifactResolutionException, ArtifactNotFoundException
         {
@@ -2848,6 +2855,7 @@ public abstract class AbstractSurefireMojo
         }
 
         @Override
+        @Nonnull
         public Classpath getProviderClasspath()
             throws ArtifactResolutionException, ArtifactNotFoundException
         {
@@ -2897,6 +2905,7 @@ public abstract class AbstractSurefireMojo
         }
 
         @Override
+        @Nonnull
         public Classpath getProviderClasspath()
             throws ArtifactResolutionException, ArtifactNotFoundException
         {
@@ -2946,6 +2955,7 @@ public abstract class AbstractSurefireMojo
         }
 
         @Override
+        @Nonnull
         public Classpath getProviderClasspath()
             throws ArtifactResolutionException, ArtifactNotFoundException
         {

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.java
index 50de7ea..a3fb88e 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.java
@@ -36,6 +36,7 @@ public interface ProviderInfo
 
     boolean isApplicable();
 
+    @Nonnull
     Classpath getProviderClasspath()
         throws ArtifactResolutionException, ArtifactNotFoundException;
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java
index 12a1239..a43c4de 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireDependencyResolver.java
@@ -111,7 +111,7 @@ public class SurefireDependencyResolver
     }
 
 
-    public ArtifactResolutionResult resolveArtifact( @Nullable Artifact filteredArtifact, Artifact providerArtifact )
+    private ArtifactResolutionResult resolveArtifact( Artifact filteredArtifact, Artifact providerArtifact )
         throws ArtifactResolutionException, ArtifactNotFoundException
     {
         ArtifactFilter filter = null;
@@ -128,6 +128,7 @@ public class SurefireDependencyResolver
                                                      filter );
     }
 
+    @Nonnull
     public Classpath getProviderClasspath( String provider, String version, Artifact filteredArtifact )
         throws ArtifactNotFoundException, ArtifactResolutionException
     {

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ClasspathForkConfiguration.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ClasspathForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ClasspathForkConfiguration.java
index 28b966e..f87b473 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ClasspathForkConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ClasspathForkConfiguration.java
@@ -25,6 +25,8 @@ import org.apache.maven.surefire.booter.Classpath;
 import org.apache.maven.surefire.booter.StartupConfiguration;
 import org.apache.maven.surefire.booter.SurefireBooterForkException;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 import java.io.File;
 import java.util.Map;
 import java.util.Properties;
@@ -39,18 +41,21 @@ public final class ClasspathForkConfiguration
         extends AbstractClasspathForkConfiguration
 {
     @SuppressWarnings( "checkstyle:parameternumber" )
-    public ClasspathForkConfiguration( Classpath bootClasspath, File tempDirectory, String debugLine,
-                                       File workingDirectory, Properties modelProperties, String argLine,
-                                       Map<String, String> environmentVariables, boolean debug, int forkCount,
-                                       boolean reuseForks, Platform pluginPlatform, ConsoleLogger log )
+    public ClasspathForkConfiguration( @Nonnull Classpath bootClasspath, @Nonnull File tempDirectory,
+                                       @Nullable String debugLine, @Nonnull File workingDirectory,
+                                       @Nonnull Properties modelProperties, @Nullable String argLine,
+                                       @Nonnull Map<String, String> environmentVariables, boolean debug, int forkCount,
+                                       boolean reuseForks, @Nonnull Platform pluginPlatform,
+                                       @Nonnull ConsoleLogger log )
     {
         super( bootClasspath, tempDirectory, debugLine, workingDirectory, modelProperties, argLine,
                 environmentVariables, debug, forkCount, reuseForks, pluginPlatform, log );
     }
 
     @Override
-    protected void resolveClasspath( OutputStreamFlushableCommandline cli, String booterThatHasMainMethod,
-                                     StartupConfiguration config )
+    protected void resolveClasspath( @Nonnull OutputStreamFlushableCommandline cli,
+                                     @Nonnull String booterThatHasMainMethod,
+                                     @Nonnull StartupConfiguration config )
             throws SurefireBooterForkException
     {
         cli.addEnvironment( "CLASSPATH", join( toCompleteClasspath( config ).iterator(), File.pathSeparator ) );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfiguration.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfiguration.java
index 8c3a9e6..c35d01c 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfiguration.java
@@ -93,8 +93,9 @@ public abstract class DefaultForkConfiguration
         this.log = log;
     }
 
-    protected abstract void resolveClasspath( OutputStreamFlushableCommandline cli, String booterThatHasMainMethod,
-                                              StartupConfiguration config )
+    protected abstract void resolveClasspath( @Nonnull OutputStreamFlushableCommandline cli,
+                                              @Nonnull String booterThatHasMainMethod,
+                                              @Nonnull StartupConfiguration config )
             throws SurefireBooterForkException;
 
     @Nonnull
@@ -144,6 +145,7 @@ public abstract class DefaultForkConfiguration
         return cli;
     }
 
+    @Nonnull
     protected List<String> toCompleteClasspath( StartupConfiguration conf ) throws SurefireBooterForkException
     {
         AbstractPathConfiguration pathConfig = conf.getClasspathConfiguration();
@@ -152,11 +154,9 @@ public abstract class DefaultForkConfiguration
             throw new SurefireBooterForkException( "Could not find class-path config nor modular class-path either." );
         }
 
-        //todo this could probably be simplified further
-        Classpath bootClasspath = conf.isProviderMainClass() ? pathConfig.getProviderClasspath() : getBooterClasspath();
+        Classpath bootClasspath = getBooterClasspath();
         Classpath testClasspath = pathConfig.getTestClasspath();
         Classpath providerClasspath = pathConfig.getProviderClasspath();
-
         Classpath completeClasspath = join( join( bootClasspath, testClasspath ), providerClasspath );
 
         log.debug( completeClasspath.getLogMessage( "boot classpath:" ) );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
index 1ec0fc3..af23f61 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
@@ -37,7 +37,7 @@ import java.util.Properties;
  */
 public abstract class ForkConfiguration
 {
-    public static final String DEFAULT_PROVIDER_CLASS = ForkedBooter.class.getName();
+    static final String DEFAULT_PROVIDER_CLASS = ForkedBooter.class.getName();
 
     @Nonnull public abstract File getTempDirectory();
     @Nullable protected abstract String getDebugLine();

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
index a7c0311..2f48def 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
@@ -50,6 +50,7 @@ import org.apache.maven.surefire.suite.RunResult;
 import org.apache.maven.surefire.testset.TestRequest;
 import org.apache.maven.surefire.util.DefaultScanResult;
 
+import javax.annotation.Nonnull;
 import java.io.Closeable;
 import java.io.File;
 import java.io.IOException;
@@ -232,7 +233,7 @@ public class ForkStarter
         triggerTimeoutCheck();
     }
 
-    public RunResult run( SurefireProperties effectiveSystemProperties, DefaultScanResult scanResult )
+    public RunResult run( @Nonnull SurefireProperties effectiveSystemProperties, @Nonnull DefaultScanResult scanResult )
         throws SurefireBooterForkException, SurefireExecutionException
     {
         try

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java
index 0c19cdf..3bcf7a3 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java
@@ -26,6 +26,7 @@ import org.apache.maven.surefire.booter.StartupConfiguration;
 import org.apache.maven.surefire.booter.SurefireBooterForkException;
 
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -47,18 +48,21 @@ public final class JarManifestForkConfiguration
     extends AbstractClasspathForkConfiguration
 {
     @SuppressWarnings( "checkstyle:parameternumber" )
-    public JarManifestForkConfiguration( Classpath bootClasspath, File tempDirectory, String debugLine,
-                                         File workingDirectory, Properties modelProperties, String argLine,
-                                         Map<String, String> environmentVariables, boolean debug, int forkCount,
-                                         boolean reuseForks, Platform pluginPlatform, ConsoleLogger log )
+    public JarManifestForkConfiguration( @Nonnull Classpath bootClasspath, @Nonnull File tempDirectory,
+                                         @Nullable String debugLine, @Nonnull File workingDirectory,
+                                         @Nonnull Properties modelProperties, @Nullable String argLine,
+                                         @Nonnull Map<String, String> environmentVariables, boolean debug,
+                                         int forkCount, boolean reuseForks, @Nonnull Platform pluginPlatform,
+                                         @Nonnull ConsoleLogger log )
     {
         super( bootClasspath, tempDirectory, debugLine, workingDirectory, modelProperties, argLine,
                 environmentVariables, debug, forkCount, reuseForks, pluginPlatform, log );
     }
 
     @Override
-    protected void resolveClasspath( OutputStreamFlushableCommandline cli, String booterThatHasMainMethod,
-                                     StartupConfiguration config )
+    protected void resolveClasspath( @Nonnull OutputStreamFlushableCommandline cli,
+                                     @Nonnull String booterThatHasMainMethod,
+                                     @Nonnull StartupConfiguration config )
             throws SurefireBooterForkException
     {
         try

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java
index 2b47c03..b6130c5 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java
@@ -31,6 +31,7 @@ import org.objectweb.asm.ClassReader;
 import org.objectweb.asm.ClassVisitor;
 import org.objectweb.asm.ModuleVisitor;
 
+import javax.annotation.Nonnegative;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import java.io.BufferedWriter;
@@ -65,7 +66,7 @@ public class ModularClasspathForkConfiguration
                                               @Nullable String argLine,
                                               @Nonnull Map<String, String> environmentVariables,
                                               boolean debug,
-                                              int forkCount,
+                                              @Nonnegative int forkCount,
                                               boolean reuseForks,
                                               @Nonnull Platform pluginPlatform,
                                               @Nonnull ConsoleLogger log )
@@ -75,8 +76,8 @@ public class ModularClasspathForkConfiguration
     }
 
     @Override
-    protected void resolveClasspath( OutputStreamFlushableCommandline cli, String startClass,
-                                     StartupConfiguration config )
+    protected void resolveClasspath( @Nonnull OutputStreamFlushableCommandline cli, @Nonnull String startClass,
+                                     @Nonnull StartupConfiguration config )
             throws SurefireBooterForkException
     {
         try
@@ -96,7 +97,6 @@ public class ModularClasspathForkConfiguration
 
             File argsFile = createArgsFile( descriptor, modulePath, classpath, packages, patchFile, startClass );
 
-            //todo what if path have spaces
             cli.createArg().setValue( "@" + escapeToPlatformPath( argsFile.getAbsolutePath() ) );
         }
         catch ( IOException e )
@@ -105,8 +105,10 @@ public class ModularClasspathForkConfiguration
         }
     }
 
-    File createArgsFile( File moduleDescriptor, List<String> modulePath, List<String> classPath,
-                         Collection<String> packages, File patchFile, String startClassName )
+    @Nonnull
+    File createArgsFile( @Nonnull File moduleDescriptor, @Nonnull List<String> modulePath,
+                         @Nonnull List<String> classPath, @Nonnull Collection<String> packages,
+                         @Nonnull File patchFile, @Nonnull String startClassName )
             throws IOException
     {
         File surefireArgs = createTempFile( "surefireargs", "", getTempDirectory() );
@@ -120,7 +122,7 @@ public class ModularClasspathForkConfiguration
         {
             writer = new BufferedWriter( new FileWriter( surefireArgs ) );
 
-            if ( modulePath != null && !modulePath.isEmpty() )
+            if ( !modulePath.isEmpty() )
             {
                 writer.write( "--module-path" );
                 writer.newLine();
@@ -137,7 +139,7 @@ public class ModularClasspathForkConfiguration
                 writer.newLine();
             }
 
-            if ( classPath != null && !classPath.isEmpty() )
+            if ( !classPath.isEmpty() )
             {
                 writer.write( "--class-path" );
                 writer.newLine();
@@ -153,7 +155,6 @@ public class ModularClasspathForkConfiguration
                 writer.newLine();
             }
 
-            //todo may return null
             final String moduleName = toModuleName( moduleDescriptor );
 
             writer.write( "--patch-module" );
@@ -206,11 +207,12 @@ public class ModularClasspathForkConfiguration
         return surefireArgs;
     }
 
-    private static String toModuleName( File moduleDescriptor ) throws IOException
+    @Nonnull
+    String toModuleName( @Nonnull File moduleDescriptor ) throws IOException
     {
-        if ( moduleDescriptor == null || !moduleDescriptor.isFile() )
+        if ( !moduleDescriptor.isFile() )
         {
-            return null;
+            throw new IOException( "No such Jigsaw module-descriptor exists " + moduleDescriptor.getAbsolutePath() );
         }
 
         final StringBuilder sb = new StringBuilder();

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfigurationTest.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfigurationTest.java
index 092c655..338a46c 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfigurationTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/DefaultForkConfigurationTest.java
@@ -32,6 +32,7 @@ import org.junit.runner.RunWith;
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 
+import javax.annotation.Nonnull;
 import java.io.File;
 import java.util.HashMap;
 import java.util.Map;
@@ -96,8 +97,9 @@ public class DefaultForkConfigurationTest
         {
 
             @Override
-            protected void resolveClasspath( OutputStreamFlushableCommandline cli, String booterThatHasMainMethod,
-                                             StartupConfiguration config ) throws SurefireBooterForkException
+            protected void resolveClasspath( @Nonnull OutputStreamFlushableCommandline cli,
+                                             @Nonnull String booterThatHasMainMethod,
+                                             @Nonnull StartupConfiguration config ) throws SurefireBooterForkException
             {
 
             }
@@ -120,8 +122,9 @@ public class DefaultForkConfigurationTest
         {
 
             @Override
-            protected void resolveClasspath( OutputStreamFlushableCommandline cli, String booterThatHasMainMethod,
-                                             StartupConfiguration config ) throws SurefireBooterForkException
+            protected void resolveClasspath( @Nonnull OutputStreamFlushableCommandline cli,
+                                             @Nonnull String booterThatHasMainMethod,
+                                             @Nonnull StartupConfiguration config ) throws SurefireBooterForkException
             {
 
             }
@@ -144,8 +147,9 @@ public class DefaultForkConfigurationTest
         {
 
             @Override
-            protected void resolveClasspath( OutputStreamFlushableCommandline cli, String booterThatHasMainMethod,
-                                             StartupConfiguration config ) throws SurefireBooterForkException
+            protected void resolveClasspath( @Nonnull OutputStreamFlushableCommandline cli,
+                                             @Nonnull String booterThatHasMainMethod,
+                                             @Nonnull StartupConfiguration config ) throws SurefireBooterForkException
             {
 
             }
@@ -168,8 +172,9 @@ public class DefaultForkConfigurationTest
         {
 
             @Override
-            protected void resolveClasspath( OutputStreamFlushableCommandline cli, String booterThatHasMainMethod,
-                                             StartupConfiguration config ) throws SurefireBooterForkException
+            protected void resolveClasspath( @Nonnull OutputStreamFlushableCommandline cli,
+                                             @Nonnull String booterThatHasMainMethod,
+                                             @Nonnull StartupConfiguration config ) throws SurefireBooterForkException
             {
 
             }
@@ -193,8 +198,9 @@ public class DefaultForkConfigurationTest
         {
 
             @Override
-            protected void resolveClasspath( OutputStreamFlushableCommandline cli, String booterThatHasMainMethod,
-                                             StartupConfiguration config ) throws SurefireBooterForkException
+            protected void resolveClasspath( @Nonnull OutputStreamFlushableCommandline cli,
+                                             @Nonnull String booterThatHasMainMethod,
+                                             @Nonnull StartupConfiguration config ) throws SurefireBooterForkException
             {
 
             }
@@ -217,8 +223,9 @@ public class DefaultForkConfigurationTest
         {
 
             @Override
-            protected void resolveClasspath( OutputStreamFlushableCommandline cli, String booterThatHasMainMethod,
-                                             StartupConfiguration config ) throws SurefireBooterForkException
+            protected void resolveClasspath( @Nonnull OutputStreamFlushableCommandline cli,
+                                             @Nonnull String booterThatHasMainMethod,
+                                             @Nonnull StartupConfiguration config ) throws SurefireBooterForkException
             {
 
             }
@@ -241,8 +248,9 @@ public class DefaultForkConfigurationTest
         {
 
             @Override
-            protected void resolveClasspath( OutputStreamFlushableCommandline cli, String booterThatHasMainMethod,
-                                             StartupConfiguration config ) throws SurefireBooterForkException
+            protected void resolveClasspath( @Nonnull OutputStreamFlushableCommandline cli,
+                                             @Nonnull String booterThatHasMainMethod,
+                                             @Nonnull StartupConfiguration config ) throws SurefireBooterForkException
             {
 
             }
@@ -265,8 +273,9 @@ public class DefaultForkConfigurationTest
         {
 
             @Override
-            protected void resolveClasspath( OutputStreamFlushableCommandline cli, String booterThatHasMainMethod,
-                                             StartupConfiguration config ) throws SurefireBooterForkException
+            protected void resolveClasspath( @Nonnull OutputStreamFlushableCommandline cli,
+                                             @Nonnull String booterThatHasMainMethod,
+                                             @Nonnull StartupConfiguration config ) throws SurefireBooterForkException
             {
 
             }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java
new file mode 100644
index 0000000..cb999d3
--- /dev/null
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfigurationTest.java
@@ -0,0 +1,126 @@
+package org.apache.maven.plugin.surefire.booterclient;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.plugin.surefire.booterclient.lazytestprovider.OutputStreamFlushableCommandline;
+import org.apache.maven.plugin.surefire.log.api.NullConsoleLogger;
+import org.apache.maven.surefire.booter.Classpath;
+import org.apache.maven.surefire.booter.ForkedBooter;
+import org.apache.maven.surefire.booter.ModularClasspath;
+import org.apache.maven.surefire.booter.ModularClasspathConfiguration;
+import org.apache.maven.surefire.booter.StartupConfiguration;
+import org.junit.Test;
+
+import javax.annotation.Nonnull;
+import java.io.File;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Properties;
+
+import static java.io.File.separator;
+import static java.io.File.pathSeparator;
+import static java.nio.file.Files.readAllLines;
+import static java.util.Arrays.asList;
+import static java.util.Collections.singleton;
+import static org.fest.assertions.Assertions.assertThat;
+
+/**
+ * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
+ * @since 2.21.0.Jigsaw
+ */
+public class ModularClasspathForkConfigurationTest
+{
+    @Test
+    public void shouldCreateModularArgsFile() throws Exception
+    {
+        Classpath booter = new Classpath( asList( "booter.jar", "non-modular.jar" ) );
+        File target = new File( "target" ).getCanonicalFile();
+        File tmp = new File( target, "surefire" );
+        tmp.mkdirs();
+        File pwd = new File( "." ).getCanonicalFile();
+
+        ModularClasspathForkConfiguration config = new ModularClasspathForkConfiguration( booter, tmp, "", pwd,
+                new Properties(), "", new HashMap<String, String>(), true, 1, true, new Platform(),
+                new NullConsoleLogger() )
+        {
+            @Nonnull
+            @Override
+            String toModuleName( @Nonnull File moduleDescriptor ) throws IOException
+            {
+                return "abc";
+            }
+        };
+
+        File patchFile = new File( "target" + separator + "test-classes" );
+        File descriptor = new File( tmp, "module-info.class" );
+        descriptor.createNewFile();
+        List<String> modulePath = asList( "modular.jar", "target/classes" );
+        List<String> classPath = asList( "booter.jar", "non-modular.jar", patchFile.getPath() );
+        Collection<String> packages = singleton( "org.apache.abc" );
+        String startClassName = ForkedBooter.class.getName();
+
+        File jigsawArgsFile =
+                config.createArgsFile( descriptor, modulePath, classPath, packages, patchFile, startClassName );
+
+        assertThat( jigsawArgsFile ).isNotNull();
+        List<String> argsFileLines = readAllLines( jigsawArgsFile.toPath() );
+        assertThat( argsFileLines ).hasSize( 13 );
+        assertThat( argsFileLines.get( 0 ) ).isEqualTo( "--module-path" );
+        assertThat( argsFileLines.get( 1 ) ).isEqualTo( "modular.jar" + pathSeparator + "target/classes" );
+        assertThat( argsFileLines.get( 2 ) ).isEqualTo( "--class-path" );
+        assertThat( argsFileLines.get( 3 ) )
+                .isEqualTo( "booter.jar" + pathSeparator + "non-modular.jar" + pathSeparator + patchFile.getPath() );
+        assertThat( argsFileLines.get( 4 ) ).isEqualTo( "--patch-module" );
+        assertThat( argsFileLines.get( 5 ) ).isEqualTo( "abc=" + patchFile.getPath() );
+        assertThat( argsFileLines.get( 6 ) ).isEqualTo( "--add-exports" );
+        assertThat( argsFileLines.get( 7 ) ).isEqualTo( "abc/org.apache.abc=ALL-UNNAMED" );
+        assertThat( argsFileLines.get( 8 ) ).isEqualTo( "--add-modules" );
+        assertThat( argsFileLines.get( 9 ) ).isEqualTo( "abc" );
+        assertThat( argsFileLines.get( 10 ) ).isEqualTo( "--add-reads" );
+        assertThat( argsFileLines.get( 11 ) ).isEqualTo( "abc=ALL-UNNAMED" );
+        assertThat( argsFileLines.get( 12 ) ).isEqualTo( ForkedBooter.class.getName() );
+
+        ModularClasspath modularClasspath = new ModularClasspath( descriptor, modulePath, packages, patchFile );
+        Classpath testClasspathUrls = new Classpath( singleton( "target" + separator + "test-classes" ) );
+        Classpath surefireClasspathUrls = Classpath.emptyClasspath();
+        ModularClasspathConfiguration modularClasspathConfiguration =
+                new ModularClasspathConfiguration( modularClasspath, testClasspathUrls, surefireClasspathUrls,
+                        true, true );
+        StartupConfiguration startupConfiguration =
+                new StartupConfiguration( "JUnitCoreProvider", modularClasspathConfiguration, null, true, true );
+        OutputStreamFlushableCommandline cli = new OutputStreamFlushableCommandline();
+        config.resolveClasspath( cli, ForkedBooter.class.getName(), startupConfiguration );
+
+        assertThat( cli.getArguments() ).isNotNull();
+        assertThat( cli.getArguments() ).hasSize( 1 );
+        assertThat( cli.getArguments()[0] ).startsWith( "@" );
+        File argFile = new File( cli.getArguments()[0].substring( 1 ) );
+        assertThat( argFile ).isFile();
+        List<String> argsFileLines2 = readAllLines( argFile.toPath() );
+        assertThat( argsFileLines2 ).hasSize( 13 );
+        for ( int i = 0; i < argsFileLines2.size(); i++ )
+        {
+            String line = argsFileLines2.get( i );
+            assertThat( line ).isEqualTo( argsFileLines.get( i ) );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/maven-surefire-common/src/test/java/org/apache/maven/surefire/JUnit4SuiteTest.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/surefire/JUnit4SuiteTest.java b/maven-surefire-common/src/test/java/org/apache/maven/surefire/JUnit4SuiteTest.java
index 53d2f87..5a5dae2 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/surefire/JUnit4SuiteTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/surefire/JUnit4SuiteTest.java
@@ -30,6 +30,7 @@ import org.apache.maven.plugin.surefire.booterclient.BooterDeserializerStartupCo
 import org.apache.maven.plugin.surefire.booterclient.DefaultForkConfigurationTest;
 import org.apache.maven.plugin.surefire.booterclient.ForkConfigurationTest;
 import org.apache.maven.plugin.surefire.booterclient.ForkingRunListenerTest;
+import org.apache.maven.plugin.surefire.booterclient.ModularClasspathForkConfigurationTest;
 import org.apache.maven.plugin.surefire.booterclient.lazytestprovider.TestLessInputStreamBuilderTest;
 import org.apache.maven.plugin.surefire.booterclient.lazytestprovider.TestProvidingInputStreamTest;
 import org.apache.maven.plugin.surefire.report.DefaultReporterFactoryTest;
@@ -76,7 +77,8 @@ import org.junit.runners.Suite;
     SurefireReflectorTest.class,
     SurefireHelperTest.class,
     AbstractSurefireMojoTest.class,
-    DefaultForkConfigurationTest.class
+    DefaultForkConfigurationTest.class,
+    ModularClasspathForkConfigurationTest.class
 } )
 @RunWith( Suite.class )
 public class JUnit4SuiteTest

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 34a0b9c..d6b74bb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -97,6 +97,8 @@
     <maven.site.path>surefire-archives/surefire-LATEST</maven.site.path>
     <!-- Override with Jigsaw JRE 9 -->
     <jdk.home>${java.home}/..</jdk.home>
+    <maven.compiler.testSource>1.8</maven.compiler.testSource>
+    <maven.compiler.testTarget>1.8</maven.compiler.testTarget>
   </properties>
 
   <dependencyManagement>
@@ -310,8 +312,7 @@
       <dependency>
         <groupId>com.google.code.findbugs</groupId>
         <artifactId>jsr305</artifactId>
-        <version>2.0.1</version>
-        <scope>provided</scope>
+        <version>2.0.3</version>
       </dependency>
     </dependencies>
   </dependencyManagement>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/surefire-booter/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-booter/pom.xml b/surefire-booter/pom.xml
index 75eb8e7..0d7f431 100644
--- a/surefire-booter/pom.xml
+++ b/surefire-booter/pom.xml
@@ -56,6 +56,11 @@
       <artifactId>commons-io</artifactId>
     </dependency>
     <dependency>
+      <groupId>com.google.code.findbugs</groupId>
+      <artifactId>jsr305</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
       <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/surefire-booter/src/main/java/org/apache/maven/surefire/booter/AbstractPathConfiguration.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/AbstractPathConfiguration.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/AbstractPathConfiguration.java
index 5f0b67e..c9651ab 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/AbstractPathConfiguration.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/AbstractPathConfiguration.java
@@ -19,6 +19,8 @@ package org.apache.maven.surefire.booter;
  * under the License.
  */
 
+import javax.annotation.Nonnull;
+
 import static org.apache.maven.surefire.booter.Classpath.emptyClasspath;
 import static org.apache.maven.surefire.booter.Classpath.join;
 
@@ -47,10 +49,10 @@ public abstract class AbstractPathConfiguration
     // todo: @deprecated because the IsolatedClassLoader is really isolated - no parent.
     private final boolean childDelegation;
 
-    protected AbstractPathConfiguration( Classpath surefireClasspathUrls,
+    protected AbstractPathConfiguration( @Nonnull Classpath surefireClasspathUrls,
                                          boolean enableAssertions, boolean childDelegation )
     {
-        if ( !( isClassPathConfig() ^ isModularPathConfig() ) )
+        if ( isClassPathConfig() == isModularPathConfig() )
         {
             throw new IllegalStateException( "modular path and class path should be exclusive" );
         }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
index bcbed4f..42218ee 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
@@ -19,6 +19,7 @@ package org.apache.maven.surefire.booter;
  * under the License.
  */
 
+import javax.annotation.Nonnull;
 import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -41,13 +42,13 @@ import static org.apache.maven.surefire.util.internal.UrlUtils.toURL;
  *
  * @author Kristian Rosenvold
  */
-public class Classpath implements Iterable<String>
+public final class Classpath implements Iterable<String>
 {
     private final List<String> unmodifiableElements;
 
     public static Classpath join( Classpath firstClasspath, Classpath secondClasspath )
     {
-        LinkedHashSet<String> accumulated =  new LinkedHashSet<String>(  );
+        LinkedHashSet<String> accumulated =  new LinkedHashSet<String>();
         if ( firstClasspath != null )
         {
             firstClasspath.addTo( accumulated );
@@ -59,26 +60,24 @@ public class Classpath implements Iterable<String>
         return new Classpath( accumulated );
     }
 
-
-    private void addTo( Collection<String> c )
+    private void addTo( @Nonnull Collection<String> c )
     {
         c.addAll( unmodifiableElements );
     }
 
     private Classpath()
     {
-        this.unmodifiableElements = Collections.emptyList();
+        unmodifiableElements = Collections.emptyList();
     }
 
-
-    public Classpath( Classpath other, String additionalElement )
+    public Classpath( @Nonnull Classpath other, @Nonnull String additionalElement )
     {
         ArrayList<String> elems = new ArrayList<String>( other.unmodifiableElements );
         elems.add( additionalElement );
         unmodifiableElements = Collections.unmodifiableList( elems );
     }
 
-    public Classpath( Collection<String> elements )
+    public Classpath( @Nonnull Collection<String> elements )
     {
         List<String> newCp = new ArrayList<String>( elements.size() );
         for ( String element : elements )
@@ -106,6 +105,7 @@ public class Classpath implements Iterable<String>
         return !unmodifiableElements.contains( path ) ? new Classpath( this, path ) : this;
     }
 
+    @Nonnull
     public List<String> getClassPath()
     {
         return unmodifiableElements;
@@ -131,7 +131,7 @@ public class Classpath implements Iterable<String>
         return urls;
     }
 
-    public void writeToSystemProperty( String propertyName )
+    public void writeToSystemProperty( @Nonnull String propertyName )
     {
         StringBuilder sb = new StringBuilder();
         for ( String element : unmodifiableElements )
@@ -159,7 +159,7 @@ public class Classpath implements Iterable<String>
         return unmodifiableElements.equals( classpath.unmodifiableElements );
     }
 
-    public ClassLoader createClassLoader( boolean childDelegation, boolean enableAssertions, String roleName )
+    public ClassLoader createClassLoader( boolean childDelegation, boolean enableAssertions, @Nonnull String roleName )
         throws SurefireExecutionException
     {
         try
@@ -189,7 +189,7 @@ public class Classpath implements Iterable<String>
         return unmodifiableElements.hashCode();
     }
 
-    public String getLogMessage( String descriptor )
+    public String getLogMessage( @Nonnull String descriptor )
     {
         StringBuilder result = new StringBuilder( descriptor );
         for ( String element : unmodifiableElements )
@@ -200,7 +200,7 @@ public class Classpath implements Iterable<String>
         return result.toString();
     }
 
-    public String getCompactLogMessage( String descriptor )
+    public String getCompactLogMessage( @Nonnull String descriptor )
     {
         StringBuilder result = new StringBuilder( descriptor );
         for ( String element : unmodifiableElements )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ClasspathConfiguration.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ClasspathConfiguration.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ClasspathConfiguration.java
index a288f2a..e6ebece 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ClasspathConfiguration.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ClasspathConfiguration.java
@@ -19,6 +19,8 @@ package org.apache.maven.surefire.booter;
  * under the License.
  */
 
+import javax.annotation.Nonnull;
+
 import static org.apache.maven.surefire.booter.Classpath.emptyClasspath;
 
 /**
@@ -43,14 +45,15 @@ public class ClasspathConfiguration extends AbstractPathConfiguration
         this( emptyClasspath(), emptyClasspath(), emptyClasspath(), enableAssertions, childDelegation );
     }
 
-    ClasspathConfiguration( PropertiesWrapper properties )
+    ClasspathConfiguration( @Nonnull PropertiesWrapper properties )
     {
         this( properties.getClasspath( CLASSPATH ), properties.getClasspath( SUREFIRE_CLASSPATH ), emptyClasspath(),
               properties.getBooleanProperty( ENABLE_ASSERTIONS ), properties.getBooleanProperty( CHILD_DELEGATION ) );
     }
 
-    public ClasspathConfiguration( Classpath testClasspathUrls, Classpath surefireClassPathUrls,
-                                   Classpath inprocClasspath, boolean enableAssertions, boolean childDelegation )
+    public ClasspathConfiguration( @Nonnull Classpath testClasspathUrls, @Nonnull Classpath surefireClassPathUrls,
+                                   @Nonnull Classpath inprocClasspath, boolean enableAssertions,
+                                   boolean childDelegation )
     {
         super( surefireClassPathUrls, enableAssertions, childDelegation );
         this.testClasspathUrls = testClasspathUrls;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ModularClasspath.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ModularClasspath.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ModularClasspath.java
index 0d7b8eb..9607b27 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ModularClasspath.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ModularClasspath.java
@@ -19,6 +19,7 @@ package org.apache.maven.surefire.booter;
  * under the License.
  */
 
+import javax.annotation.Nonnull;
 import java.io.File;
 import java.util.Collection;
 import java.util.List;
@@ -39,8 +40,9 @@ public final class ModularClasspath
     private final Collection<String> packages;
     private final File patchFile;
 
-    public ModularClasspath( File moduleDescriptor, List<String> modulePath, Collection<String> packages,
-                             File patchFile )
+    public ModularClasspath( @Nonnull File moduleDescriptor, @Nonnull List<String> modulePath,
+                             @Nonnull Collection<String> packages,
+                             @Nonnull File patchFile )
     {
         this.moduleDescriptor = moduleDescriptor;
         this.modulePath = modulePath;
@@ -48,21 +50,25 @@ public final class ModularClasspath
         this.patchFile = patchFile;
     }
 
+    @Nonnull
     public File getModuleDescriptor()
     {
         return moduleDescriptor;
     }
 
+    @Nonnull
     public List<String> getModulePath()
     {
         return unmodifiableList( modulePath );
     }
 
+    @Nonnull
     public Collection<String> getPackages()
     {
         return unmodifiableCollection( packages );
     }
 
+    @Nonnull
     public File getPatchFile()
     {
         return patchFile;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ModularClasspathConfiguration.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ModularClasspathConfiguration.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ModularClasspathConfiguration.java
index 655b864..823b445 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ModularClasspathConfiguration.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ModularClasspathConfiguration.java
@@ -19,6 +19,8 @@ package org.apache.maven.surefire.booter;
  * under the License.
  */
 
+import javax.annotation.Nonnull;
+
 /**
  * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
  * @since 2.21.0.Jigsaw
@@ -28,8 +30,10 @@ public class ModularClasspathConfiguration extends AbstractPathConfiguration
     private final ModularClasspath modularClasspath;
     private final Classpath testClasspathUrls;
 
-    public ModularClasspathConfiguration( ModularClasspath modularClasspath, Classpath testClasspathUrls,
-                                          Classpath surefireClasspathUrls, boolean enableAssertions,
+    public ModularClasspathConfiguration( @Nonnull ModularClasspath modularClasspath,
+                                          @Nonnull Classpath testClasspathUrls,
+                                          @Nonnull Classpath surefireClasspathUrls,
+                                          boolean enableAssertions,
                                           boolean childDelegation )
     {
         super( surefireClasspathUrls, enableAssertions, childDelegation );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c594ac4c/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java
index 7dd30ff..8003ce5 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java
@@ -19,6 +19,8 @@ package org.apache.maven.surefire.booter;
  * under the License.
  */
 
+import javax.annotation.Nonnull;
+
 /**
  * Configuration that is used by the SurefireStarter but does not make it into the provider itself.
  *
@@ -34,8 +36,9 @@ public class StartupConfiguration
     private final boolean isForkRequested;
     private final boolean isInForkedVm;
 
-    public StartupConfiguration( String providerClassName, AbstractPathConfiguration classpathConfiguration,
-                                 ClassLoaderConfiguration classLoaderConfiguration, boolean isForkRequested,
+    public StartupConfiguration( @Nonnull String providerClassName,
+                                 @Nonnull AbstractPathConfiguration classpathConfiguration,
+                                 @Nonnull ClassLoaderConfiguration classLoaderConfiguration, boolean isForkRequested,
                                  boolean inForkedVm )
     {
         this.classpathConfiguration = classpathConfiguration;


Mime
View raw message