I like this: could we define it as the standard way to add such annotations in whole Maven components? Any problem if we do it in Maven core itself?
I'm not a JSR-305 expert, any basic explanation on the com.google.code.findbugs:jsr305 choice is good to know then we could add it to maven parent pom dependencyManagement section, and write something into "Maven Developer Centre" Regards, Hervé Le mardi 7 mai 2013 16:49:25 krosenv...@apache.org a écrit : > Updated Branches: > refs/heads/master 231773324 -> 7b330f584 > > > Added jsr305 annotations > > > Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo > Commit: > http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/7b330f58 Tree: > http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/7b330f58 Diff: > http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/7b330f58 > > Branch: refs/heads/master > Commit: 7b330f5845d9952a75ff5949d5f46fa913254308 > Parents: 2317733 > Author: Kristian Rosenvold <krosenv...@apache.org> > Authored: Tue May 7 18:49:15 2013 +0200 > Committer: Kristian Rosenvold <krosenv...@apache.org> > Committed: Tue May 7 18:49:15 2013 +0200 > > ---------------------------------------------------------------------- > maven-surefire-common/pom.xml | 4 ++++ > .../plugin/surefire/AbstractSurefireMojo.java | 7 +++++-- > .../maven/plugin/surefire/ClasspathCache.java | 6 ++++-- > .../maven/plugin/surefire/CommonReflector.java | 8 +++++--- > .../apache/maven/plugin/surefire/ProviderInfo.java | 3 +++ > .../surefire/booterclient/ForkConfiguration.java | 4 ++-- > .../plugin/surefire/util/DependencyScanner.java | 4 +++- > .../maven/plugin/surefire/util/Relocator.java | 12 ++++++++---- > .../maven/plugin/surefire/util/ScannerUtil.java | 10 ++++++---- > pom.xml | 6 ++++++ > 10 files changed, 46 insertions(+), 18 deletions(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7b330f58/maven-su > refire-common/pom.xml > ---------------------------------------------------------------------- diff > --git a/maven-surefire-common/pom.xml b/maven-surefire-common/pom.xml index > 1330eec..bed467b 100644 > --- a/maven-surefire-common/pom.xml > +++ b/maven-surefire-common/pom.xml > @@ -91,6 +91,10 @@ > <artifactId>commons-lang3</artifactId> > </dependency> > <dependency> > + <groupId>com.google.code.findbugs</groupId> > + <artifactId>jsr305</artifactId> > + </dependency> > + <dependency> > <groupId>org.apache.maven.shared</groupId> > <artifactId>maven-common-artifact-filters</artifactId> > <version>1.3</version> > > http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7b330f58/maven-su > refire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefir > eMojo.java > ---------------------------------------------------------------------- diff > --git > a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/Abst > ractSurefireMojo.java > b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/Abst > ractSurefireMojo.java index bcd5737..bb1f6ff 100644 > --- > a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/Abst > ractSurefireMojo.java +++ > b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/Abst > ractSurefireMojo.java @@ -88,6 +88,8 @@ import > org.apache.maven.surefire.util.RunOrder; > import org.apache.maven.toolchain.Toolchain; > import org.apache.maven.toolchain.ToolchainManager; > > +import javax.annotation.Nonnull; > + > /** > * Abstract base class for running tests using Surefire. > * > @@ -1266,7 +1268,7 @@ public abstract class AbstractSurefireMojo > } > } > > - private List<String> getExcludeList() > + private @Nonnull List<String> getExcludeList() > { > List<String> excludes = null; > if ( isSpecificTestSpecified() ) > @@ -1339,7 +1341,7 @@ public abstract class AbstractSurefireMojo > return filterNulls( includes ); > } > > - private List<String> filterNulls( List<String> toFilter ) > + private @Nonnull List<String> filterNulls( @Nonnull List<String> > toFilter ) { > List<String> result = new ArrayList<String>( toFilter.size() ); > for ( String item : toFilter ) > @@ -2130,6 +2132,7 @@ public abstract class AbstractSurefireMojo > return new DynamicProviderInfo( providerName ); > } > > + @Nonnull > public String getProviderName() > { > return providerName; > > http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7b330f58/maven-su > refire-common/src/main/java/org/apache/maven/plugin/surefire/ClasspathCache. > java ---------------------------------------------------------------------- > diff --git > a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/Clas > spathCache.java > b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/Clas > spathCache.java index 1bcb065..ea250c2 100644 > --- > a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/Clas > spathCache.java +++ > b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/Clas > spathCache.java @@ -21,6 +21,8 @@ package org.apache.maven.plugin.surefire; > import java.util.concurrent.ConcurrentHashMap; > import org.apache.maven.surefire.booter.Classpath; > > +import javax.annotation.Nonnull; > + > /** > * @author Kristian Rosenvold > */ > @@ -29,12 +31,12 @@ public class ClasspathCache > private static final ConcurrentHashMap<String, Classpath> classpaths = > new ConcurrentHashMap<String, Classpath>( 4 ); > > - public static Classpath getCachedClassPath( String artifactId ) > + public static Classpath getCachedClassPath( @Nonnull String artifactId > ) { > return classpaths.get( artifactId ); > } > > - public static void setCachedClasspath( String key, Classpath classpath > ) + public static void setCachedClasspath( @Nonnull String key, @Nonnull > Classpath classpath ) { > classpaths.put( key, classpath ); > } > > http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7b330f58/maven-su > refire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector > .java ---------------------------------------------------------------------- > diff --git > a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/Comm > onReflector.java > b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/Comm > onReflector.java index 538b7e0..6851539 100644 > --- > a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/Comm > onReflector.java +++ > b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/Comm > onReflector.java @@ -25,6 +25,8 @@ import > org.apache.maven.plugin.surefire.report.DefaultReporterFactory; import > org.apache.maven.surefire.util.ReflectionUtils; > import org.apache.maven.surefire.util.SurefireReflectionException; > > +import javax.annotation.Nonnull; > + > /** > * @author Kristian Rosenvold > */ > @@ -34,7 +36,7 @@ public class CommonReflector > > private final ClassLoader surefireClassLoader; > > - public CommonReflector( ClassLoader surefireClassLoader ) > + public CommonReflector( @Nonnull ClassLoader surefireClassLoader ) > { > this.surefireClassLoader = surefireClassLoader; > > @@ -48,7 +50,7 @@ public class CommonReflector > } > } > > - public Object createReportingReporterFactory( > StartupReportConfiguration startupReportConfiguration ) + public Object > createReportingReporterFactory( @Nonnull StartupReportConfiguration > startupReportConfiguration ) { > Class<?>[] args = new Class[]{ this.startupReportConfiguration }; > Object src = createStartupReportConfiguration( > startupReportConfiguration ); @@ -58,7 +60,7 @@ public class > CommonReflector > } > > > - Object createStartupReportConfiguration( StartupReportConfiguration > reporterConfiguration ) + Object createStartupReportConfiguration( > @Nonnull StartupReportConfiguration reporterConfiguration ) { > Constructor<?> constructor = ReflectionUtils.getConstructor( > this.startupReportConfiguration, new Class[]{ boolean.class, boolean.class, > > http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7b330f58/maven-su > refire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderInfo.ja > va ---------------------------------------------------------------------- > diff --git > a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/Prov > iderInfo.java > b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/Prov > iderInfo.java index 57069d8..50de7ea 100644 > --- > a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/Prov > iderInfo.java +++ > b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/Prov > iderInfo.java @@ -24,11 +24,14 @@ import > org.apache.maven.artifact.resolver.ArtifactResolutionException; import > org.apache.maven.plugin.MojoExecutionException; > import org.apache.maven.surefire.booter.Classpath; > > +import javax.annotation.Nonnull; > + > /** > * @author Kristian Rosenvold > */ > public interface ProviderInfo > { > + @Nonnull > String getProviderName(); > > boolean isApplicable(); > > http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7b330f58/maven-su > refire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/Fo > rkConfiguration.java > ---------------------------------------------------------------------- diff > --git > a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/boot > erclient/ForkConfiguration.java > b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/boot > erclient/ForkConfiguration.java index 8f6f3c9..ba1aa27 100644 > --- > a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/boot > erclient/ForkConfiguration.java +++ > b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/boot > erclient/ForkConfiguration.java @@ -119,7 +119,7 @@ public class > ForkConfiguration > > /** > * @param classPath cla the classpath arguments > - * @param startupConfiguration > + * @param startupConfiguration The startup configuration > * @param threadNumber the thread number, to be the replacement > in the argLine @return A commandline * @throws > org.apache.maven.surefire.booter.SurefireBooterForkException * > when unable to perform the fork > @@ -208,7 +208,7 @@ public class ForkConfiguration > * for all classpath elements. > * > * @param classPath List<String> of all classpath elements. > - * @param startClassName > + * @param startClassName The classname to start (main-class) > * @return The file pointint to the jar > * @throws java.io.IOException When a file operation fails. > */ > > http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7b330f58/maven-su > refire-common/src/main/java/org/apache/maven/plugin/surefire/util/Dependency > Scanner.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 b50f295..b2e8ab8 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,8 @@ import > org.apache.maven.plugin.MojoExecutionException; import > org.apache.maven.shared.utils.io.MatchPatterns; > import org.apache.maven.surefire.util.DefaultScanResult; > > +import javax.annotation.Nullable; > + > /** > * Scans dependencies looking for tests. > * > @@ -141,7 +143,7 @@ public class DependencyScanner { > > private SpecificFileFilter specificTestFilter; > > - public Matcher(List<String> includes, List<String> excludes, List<String> > specificTests) + public Matcher(@Nullable List<String> includes, @Nullable > 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/7b330f58/maven-su > refire-common/src/main/java/org/apache/maven/plugin/surefire/util/Relocator. > java ---------------------------------------------------------------------- > diff --git > a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util > /Relocator.java > b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util > /Relocator.java index 31dde5d..76da9de 100644 > --- > a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util > /Relocator.java +++ > b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util > /Relocator.java @@ -19,6 +19,10 @@ package > org.apache.maven.plugin.surefire.util; > * under the License. > */ > > +import com.sun.istack.internal.NotNull; > + > +import javax.annotation.Nullable; > + > /** > * Relocates class names when running with relocated provider > * > @@ -26,12 +30,12 @@ package org.apache.maven.plugin.surefire.util; > */ > public class Relocator > { > - private final String relocation; > + private final @Nullable String relocation; > > private static final String relocationBase = > "org.apache.maven.surefire."; > > > - public Relocator( String relocation ) > + public Relocator( @Nullable String relocation ) > { > this.relocation = relocation; > } > @@ -41,12 +45,12 @@ public class Relocator > relocation = "shadefire"; > } > > - private String getRelocation() > + private @Nullable String getRelocation() > { > return relocation; > } > > - public String relocate( String className ) > + public @NotNull String relocate( @NotNull String className ) > { > if ( relocation == null ) > { > > http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7b330f58/maven-su > refire-common/src/main/java/org/apache/maven/plugin/surefire/util/ScannerUti > l.java > ---------------------------------------------------------------------- diff > --git > a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util > /ScannerUtil.java > b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util > /ScannerUtil.java index 3498e63..8b80301 100644 > --- > a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util > /ScannerUtil.java +++ > b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util > /ScannerUtil.java @@ -25,6 +25,8 @@ import java.util.List; > > import org.apache.commons.lang3.StringUtils; > > +import javax.annotation.Nonnull; > + > final class ScannerUtil { > > private ScannerUtil() {} > @@ -35,22 +37,22 @@ final class ScannerUtil { > > private static final String JAVA_CLASS_FILE_EXTENSION = ".class"; > > - public static String convertToJavaClassName( String test ) > + public static @Nonnull String convertToJavaClassName( @Nonnull String > test ) { > return StringUtils.removeEnd( test, ".class" ).replace( FS, "." ); > } > > - public static String convertJarFileResourceToJavaClassName( String test > ) + public static @Nonnull String convertJarFileResourceToJavaClassName( > @Nonnull String test ) { > return StringUtils.removeEnd( test, ".class" ).replace( "/", "." ); > } > > - public static String stripBaseDir( String basedir, String test ) > + public static @Nonnull String stripBaseDir( String basedir, String test > ) { > return StringUtils.removeStart( test, basedir ); > } > > - public static String[] processIncludesExcludes( List<String> list ) > + public static @Nonnull String[] processIncludesExcludes( @Nonnull > List<String> list ) { > List<String> newList = new ArrayList<String>(); > for ( Object aList : list ) > > http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7b330f58/pom.xml > ---------------------------------------------------------------------- > diff --git a/pom.xml b/pom.xml > index 677b367..c60f378 100644 > --- a/pom.xml > +++ b/pom.xml > @@ -265,6 +265,12 @@ > <version>3.8.1</version> > <scope>test</scope> > </dependency> > + <dependency> > + <groupId>com.google.code.findbugs</groupId> > + <artifactId>jsr305</artifactId> > + <version>2.0.1</version> > + <scope>provided</scope> > + </dependency> > </dependencies> > </dependencyManagement> > <dependencies> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org For additional commands, e-mail: dev-h...@maven.apache.org