maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject git commit: More jsr305
Date Wed, 08 May 2013 06:21:16 GMT
Updated Branches:
  refs/heads/master b9f3c3905 -> b2d4b5c36


More jsr305


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

Branch: refs/heads/master
Commit: b2d4b5c3687c14be7843dc4b882e9a8e2f8860c4
Parents: b9f3c39
Author: Kristian Rosenvold <krosenvold@apache.org>
Authored: Wed May 8 08:17:58 2013 +0200
Committer: Kristian Rosenvold <krosenvold@apache.org>
Committed: Wed May 8 08:20:49 2013 +0200

----------------------------------------------------------------------
 .../plugin/surefire/AbstractSurefireMojo.java      |   11 ++---------
 .../plugin/surefire/InPluginVMSurefireStarter.java |   10 ++++++----
 .../apache/maven/plugin/surefire/ProviderList.java |    6 ++++--
 .../surefire/StartupReportConfiguration.java       |    5 ++++-
 .../surefire/SurefireDependencyResolver.java       |    7 +++++--
 .../surefire/booterclient/ProviderDetector.java    |    7 ++++---
 .../plugin/surefire/util/DependencyScanner.java    |    9 +++++----
 .../plugin/surefire/util/SpecificFileFilter.java   |    6 ++++--
 .../maven/surefire/util/DefaultScanResult.java     |   10 ++++++++--
 9 files changed, 42 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b2d4b5c3/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 c77ef41..b521300 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
@@ -656,14 +656,7 @@ public abstract class AbstractSurefireMojo
     {
         DefaultScanResult scan = scanDirectories();
         DefaultScanResult scanDeps = scanDependencies();
-        if(!scanDeps.isEmpty())
-        {
-            List combined = new ArrayList();
-            combined.addAll(scan.getFiles());
-            combined.addAll(scanDeps.getFiles());
-            scan = new DefaultScanResult(combined);
-        }
-        return scan;
+        return scan.append( scanDeps );
     }
 
     private DefaultScanResult scanDirectories()
@@ -1983,7 +1976,7 @@ public abstract class AbstractSurefireMojo
             this.testNgArtifact = testNgArtifact;
         }
 
-        public String getProviderName()
+        public @Nonnull String getProviderName()
         {
             return "org.apache.maven.surefire.testng.TestNGProvider";
         }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b2d4b5c3/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/InPluginVMSurefireStarter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/InPluginVMSurefireStarter.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/InPluginVMSurefireStarter.java
index 718181c..ec864c3 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/InPluginVMSurefireStarter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/InPluginVMSurefireStarter.java
@@ -29,6 +29,8 @@ import org.apache.maven.surefire.suite.RunResult;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 import org.apache.maven.surefire.util.DefaultScanResult;
 
+import javax.annotation.Nonnull;
+
 /**
  * Starts the provider in the same VM as the surefire plugin.
  * <p/>
@@ -50,16 +52,16 @@ public class InPluginVMSurefireStarter
 
     private final ProviderConfiguration providerConfiguration;
 
-    public InPluginVMSurefireStarter( StartupConfiguration startupConfiguration,
-                                      ProviderConfiguration providerConfiguration,
-                                      StartupReportConfiguration startupReportConfiguration
)
+    public InPluginVMSurefireStarter( @Nonnull StartupConfiguration startupConfiguration,
+                                      @Nonnull ProviderConfiguration providerConfiguration,
+                                      @Nonnull StartupReportConfiguration startupReportConfiguration
)
     {
         this.startupConfiguration = startupConfiguration;
         this.startupReportConfiguration = startupReportConfiguration;
         this.providerConfiguration = providerConfiguration;
     }
 
-    public RunResult runSuitesInProcess( DefaultScanResult scanResult )
+    public RunResult runSuitesInProcess( @Nonnull DefaultScanResult scanResult )
         throws SurefireExecutionException, TestSetFailedException
     {
         // The test classloader must be constructed first to avoid issues with commons-logging
until we properly

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b2d4b5c3/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderList.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderList.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderList.java
index 5465ba4..d7424af 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderList.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderList.java
@@ -28,6 +28,8 @@ import org.apache.maven.plugin.surefire.booterclient.ProviderDetector;
 import org.apache.maven.surefire.providerapi.SurefireProvider;
 import org.apache.maven.surefire.util.NestedRuntimeException;
 
+import javax.annotation.Nonnull;
+
 /**
  * @author Kristian Rosenvold
  */
@@ -44,7 +46,7 @@ public class ProviderList
     }
 
 
-    public List<ProviderInfo> resolve( Log log )
+    public @Nonnull List<ProviderInfo> resolve( @Nonnull Log log )
     {
         List<ProviderInfo> providersToRun = new ArrayList<ProviderInfo>();
 
@@ -64,7 +66,7 @@ public class ProviderList
         return autoDetectOneProvider();
     }
 
-    private List<ProviderInfo> autoDetectOneProvider()
+    private @Nonnull List<ProviderInfo> autoDetectOneProvider()
     {
         List<ProviderInfo> providersToRun = new ArrayList<ProviderInfo>();
         for ( ProviderInfo wellKnownProvider : wellKnownProviders )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b2d4b5c3/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
index a9f1245..f974ace 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
@@ -30,6 +30,8 @@ import org.apache.maven.plugin.surefire.report.StatelessXmlReporter;
 import org.apache.maven.plugin.surefire.report.TestcycleConsoleOutputReceiver;
 import org.apache.maven.plugin.surefire.runorder.StatisticsReporter;
 
+import javax.annotation.Nonnull;
+
 /**
  * All the parameters used to construct reporters
  * <p/>
@@ -70,7 +72,8 @@ public class StartupReportConfiguration
 
     public StartupReportConfiguration( boolean useFile, boolean printSummary, String reportFormat,
                                        boolean redirectTestOutputToFile, boolean disableXmlReport,
-                                       File reportsDirectory, boolean trimStackTrace, String
reportNameSuffix,
+                                       @Nonnull File reportsDirectory,
+                                       boolean trimStackTrace, String reportNameSuffix,
                                        String configurationHash, boolean requiresRunHistory
)
     {
         this.useFile = useFile;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b2d4b5c3/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 2ec5e00..41b6171 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
@@ -40,6 +40,9 @@ import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.surefire.booter.Classpath;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 /**
  * Does dependency resolution and artifact handling for the surefire plugin.
  *
@@ -78,7 +81,7 @@ public class SurefireDependencyResolver
     }
 
 
-    public boolean isWithinVersionSpec( Artifact artifact, String versionSpec )
+    public boolean isWithinVersionSpec( @Nullable Artifact artifact, @Nonnull String versionSpec
)
     {
         if ( artifact == null )
         {
@@ -107,7 +110,7 @@ public class SurefireDependencyResolver
     }
 
 
-    public ArtifactResolutionResult resolveArtifact( Artifact filteredArtifact, Artifact
providerArtifact )
+    public ArtifactResolutionResult resolveArtifact( @Nullable Artifact filteredArtifact,
Artifact providerArtifact )
         throws ArtifactResolutionException, ArtifactNotFoundException
     {
         ArtifactFilter filter = null;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b2d4b5c3/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ProviderDetector.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ProviderDetector.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ProviderDetector.java
index 57ee367..cc71fe9 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ProviderDetector.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ProviderDetector.java
@@ -19,6 +19,7 @@ package org.apache.maven.plugin.surefire.booterclient;
  * under the License.
  */
 
+import javax.annotation.Nonnull;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
@@ -37,7 +38,7 @@ import java.util.Set;
 public class ProviderDetector
 {
 
-    public static Set<String> getServiceNames( Class<?> clazz, ClassLoader classLoader
)
+    @Nonnull public static Set<String> getServiceNames( Class<?> clazz, ClassLoader
classLoader )
         throws IOException
     {
         final String resourceName = "META-INF/services/" + clazz.getName();
@@ -59,7 +60,7 @@ public class ProviderDetector
      * @return The set of service provider names
      * @throws IOException When reading the streams fails
      */
-    private static Set<String> getNames( final Enumeration<URL> urlEnumeration
)
+    @Nonnull private static Set<String> getNames( final Enumeration<URL> urlEnumeration
)
         throws IOException
     {
         final Set<String> names = new HashSet<String>();
@@ -117,7 +118,7 @@ public class ProviderDetector
         return names;
     }
 
-    private static BufferedReader getReader( URL url )
+    @Nonnull private static BufferedReader getReader( @Nonnull URL url )
         throws IOException
     {
         final InputStream inputStream = url.openStream();

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b2d4b5c3/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DependencyScanner.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DependencyScanner.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DependencyScanner.java
index b2e8ab8..189ea80 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DependencyScanner.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DependencyScanner.java
@@ -34,6 +34,7 @@ import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.shared.utils.io.MatchPatterns;
 import org.apache.maven.surefire.util.DefaultScanResult;
 
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 /**
@@ -47,11 +48,11 @@ public class DependencyScanner {
 
 	protected final List<String> includes;
 
-	protected final List<String> excludes;
+	protected final @Nonnull List<String> excludes;
 
 	protected final List<String> specificTests;
 
-	public DependencyScanner(List<File> dependenciesToScan, List<String> includes,
List<String> excludes, List<String> specificTests)
+	public DependencyScanner(List<File> dependenciesToScan, List<String> includes,
@Nonnull List<String> excludes, List<String> specificTests)
 	{
 		this.dependenciesToScan = dependenciesToScan;
         this.includes = includes;
@@ -123,7 +124,7 @@ public class DependencyScanner {
 				if(groupArtifact.length != 2)
 				{
 					throw new IllegalArgumentException(
-							"dependencyToScan argument should be in format 'groupid:artifactid': " + groupArtifact);
+							"dependencyToScan argument should be in format 'groupid:artifactid': " + groups);
 				}
 				if(
 						artifact.getGroupId().matches(groupArtifact[0]) &&
@@ -143,7 +144,7 @@ public class DependencyScanner {
 
 		private SpecificFileFilter specificTestFilter;
 
-		public Matcher(@Nullable List<String> includes, @Nullable List<String> excludes,
@Nullable List<String> specificTests)
+		public Matcher(@Nullable List<String> includes, @Nonnull List<String> excludes,
@Nullable List<String> specificTests)
 		{
 			String[] specific = specificTests == null ? new String[0] : processIncludesExcludes( specificTests
);
 			specificTestFilter = new SpecificFileFilter( specific );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b2d4b5c3/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/SpecificFileFilter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/SpecificFileFilter.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/SpecificFileFilter.java
index 7fe38ec..73d52e5 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/SpecificFileFilter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/SpecificFileFilter.java
@@ -24,6 +24,8 @@ import java.util.HashSet;
 import java.util.Set;
 import org.apache.maven.shared.utils.io.SelectorUtils;
 
+import javax.annotation.Nullable;
+
 public class SpecificFileFilter
 {
 
@@ -31,7 +33,7 @@ public class SpecificFileFilter
 
     private Set<String> names;
 
-    public SpecificFileFilter( String[] classNames )
+    public SpecificFileFilter( @Nullable String[] classNames )
     {
         if ( classNames != null && classNames.length > 0 )
         {
@@ -45,7 +47,7 @@ public class SpecificFileFilter
         }
     }
 
-    public boolean accept( String className )
+    public boolean accept( @Nullable String className )
     {
         // If the tests enumeration is empty, allow anything.
         if ( names != null && !names.isEmpty() )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b2d4b5c3/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultScanResult.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultScanResult.java
b/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultScanResult.java
index 67fc0e6..f2376ae 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultScanResult.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultScanResult.java
@@ -36,7 +36,7 @@ public class DefaultScanResult
 
     public DefaultScanResult( List<String> files )
     {
-        this.files = files;
+        this.files = Collections.unmodifiableList( files );
     }
 
     public int size()
@@ -80,7 +80,7 @@ public class DefaultScanResult
 
     public List getFiles()
     {
-        return Collections.unmodifiableList( files );
+        return files;
     }
 
     public TestsToRun applyFilter( ScannerFilter scannerFilter, ClassLoader testClassLoader
)
@@ -137,5 +137,11 @@ public class DefaultScanResult
         return testClass;
     }
 
+    public DefaultScanResult append(DefaultScanResult other){
+        List<String> src = new ArrayList<String>( files );
+        src.addAll( other.files );
+        return new DefaultScanResult( src );
+    }
+
 
 }


Mime
View raw message