Just to be totally clear on this (and still using a tiny spoon); the real issue here is really if we want to add the annotations to core itself. It would appear to me that all other use is basically fine with provided-scope.
And if we decided to stick with javax.annotation.Nonnull and javax.annotation.Nullable, we might run into some kind of trouble if, at a later stage an "official" jdk comes bundled with a slightly /different/ javax.annotation.Nullable ? And at that point, we would be thoroughly in trouble, right ? Kristian 2013/5/8 Stephen Connolly <[email protected]> > Hmmm though using the when parameter may be an issue: e.g. > @Nonnull(when=MAYBE) > > > On 8 May 2013 11:23, Stephen Connolly <[email protected] > >wrote: > > > Hmmm I may have lost the plot somewhat, as the findbugs annotations are > > @TypeQualifierNickname's for @Nonnull anyway... > > > > I guess my point is that we need to decide *and document* exactly which > > annotations are we using. My view is the Nonnull and Nullable are good... > > ones with parameters are less good. > > > > > > On 8 May 2013 11:16, Stephen Connolly <[email protected] > >wrote: > > > >> If you do > >> > >> <dependency> > >> <groupId>com.google.code.findbugs</groupId> > >> <artifactId>jsr305</artifactId> > >> <version>2.0.1</version> > >> <scope>provided</scope> > >> </dependency> > >> > >> In one of Maven's APIs thinking that RetentionPolicy.RUNTIME or > >> RetentionPolicy.COMPILE will save you as the JVM spec says missing > >> annotations are to be ignored... you will be burned when compiling > >> implementations of the API unless you add the dependency to *your* > >> implementation. > >> > >> At least some versions (I suspect all but have not confirmed) of JavaC > >> needs all the annotations with COMPILE or higher retention available so > >> that, at the very least, it knows whether to retain the annotation or > >> not... as it may affect the method signature for @Override annotated > >> methods or something like that... never really be happy about the issue. > >> > >> This has bit me when I have an API with @Nonnull annotations and then > try > >> to implement the API class. > >> > >> So in such cases using the javax.annotations carries a risk as once/if > >> JSR-305 gets accepted, the accepted version of the annotations will be > part > >> of the core classloader and the dependency provided version will loose > >> out... > >> > >> Not likely a big risk for @Nonnull or @Nullable... but e.g > >> @MatchesPattern(value="^\d\d\d-\d\d$",flags=0) might cause issues if in > the > >> reboot the "flags" parameter gets refactored to regexFlags. It is > unclear > >> to me what the JVM spec says in the case where the annotation class is > >> present but has had a signature change from what was used when the > >> annotated source was compiled. > >> > >> With annotations that are not in the "special" package namespaces we can > >> at least put our dependency first... but maybe I am just overly paranoid > >> > >> > >> On 8 May 2013 11:01, Kristian Rosenvold <[email protected] > >wrote: > >> > >>> Linking to one of your private git repos made this only marginally > >>> clearer; > >>> I see the edu.umd in there though ! > >>> > >>> > >>> > >>> > So setting the dependency as "provided" is all well and good until > you > >>> need > >>> > to implement an interface with the annotation applied... at which > >>> point you > >>> > need to add back in the "provided" dependency... > >>> > > >>> > But it's still only compile-time, right ? Why would that be a > problem ? > >>> > >>> > >>> Having the annotation available at RUNTIME does allow for additional > >>> > validations, so that would favour JSR-305, but given that you need > the > >>> > dependency transitive for compilation there is scope for issues if > >>> JSR-305 > >>> > ever gets rebooted. > >>> > > >>> > >>> Give me this with a tiny spoon please; when would this be a problem ? > >>> > >>> > >>> > >>> > >>> > >>> > On 8 May 2013 09:53, Kristian Rosenvold < > [email protected] > >>> > >wrote: > >>> > > >>> > > You mean there's an older set of findbugs annoations ? > >>> > > > >>> > > Kristian > >>> > > > >>> > > > >>> > > 2013/5/8 Stephen Connolly <[email protected]> > >>> > > > >>> > > > IntelliJ also supports the findbugs and jcip annotations too... > >>> but in > >>> > > any > >>> > > > case I will hold my piece... given that these annotations do not > >>> have > >>> > > > parameters the risk is almost non-existant for *these* but I do > >>> think > >>> > it > >>> > > is > >>> > > > a more general risk > >>> > > > > >>> > > > > >>> > > > On 8 May 2013 09:06, Kristian Rosenvold < > >>> [email protected] > >>> > > > >wrote: > >>> > > > > >>> > > > > I suspect like a lot of the rest of the community, they simply > >>> gave > >>> > up > >>> > > on > >>> > > > > the jcp. > >>> > > > > > >>> > > > > I am no insider on the project but > >>> com.google.code.findbugs/jsr-305 > >>> > was > >>> > > > > last published in a 2.0.1 version in july 2012, and > >>> > > > > seems to be alive and kicking. IntelliJ also supports the > >>> annotations > >>> > > > which > >>> > > > > means we finally have /one/ set of annotations > >>> > > > > that everybody understands. > >>> > > > > > >>> > > > > The value of both Nullable and Nonnull is just amazing once you > >>> get > >>> > it > >>> > > > all > >>> > > > > in place. > >>> > > > > > >>> > > > > As for potential classloading issues, I'm sure /someone/ here > >>> would > >>> > > know > >>> > > > :) > >>> > > > > > >>> > > > > Kristian > >>> > > > > > >>> > > > > > >>> > > > > > >>> > > > > > >>> > > > > 2013/5/8 Stephen Connolly <[email protected]> > >>> > > > > > >>> > > > > > On 8 May 2013 08:34, Hervé BOUTEMY <[email protected]> > >>> wrote: > >>> > > > > > > >>> > > > > > > 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 > >>> > > > > > > > >>> > > > > > > >>> > > > > > Well as of 1.3.8 it's ASL whereas previous ones were LGPL. > >>> > > > > > > >>> > > > > > In general I like those annotations, though I tend to favour > >>> the > >>> > > > findbugs > >>> > > > > > annotations and jcip annotations in code I write while > awaiting > >>> > > jsr305 > >>> > > > to > >>> > > > > > finalize (given that the spec is dormant, feared dead: > >>> > > > > > http://jcp.org/en/jsr/detail?id=305) and I suspect a reboot > >>> of the > >>> > > > spec > >>> > > > > > may > >>> > > > > > result in signature changes and as such, given that the > >>> annotations > >>> > > are > >>> > > > > > runtime retention, when annotations finally land in the JVM > >>> there > >>> > may > >>> > > > be > >>> > > > > a > >>> > > > > > risk from signature change... > >>> > > > > > > >>> > > > > > But that could be an irrational fear on my behalf... > >>> > > > > > > >>> > > > > > In any case I have clean room ASLv2 licensed versions of the > >>> > findbugs > >>> > > > and > >>> > > > > > jcip annotations in my GitHub repo and published to central. > >>> > > > > > > >>> > > > > > > >>> > > > > > > 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 [email protected] 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/7b330f58Tree > >>> : > >>> > > > > > > > > >>> > > > > > > >>> > > > > >>> > > >>> > http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/7b330f58Diff: > >>> > > > > > > > > >>> > > > > >>> http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/7b330f58 > >>> > > > > > > > > >>> > > > > > > > Branch: refs/heads/master > >>> > > > > > > > Commit: 7b330f5845d9952a75ff5949d5f46fa913254308 > >>> > > > > > > > Parents: 2317733 > >>> > > > > > > > Author: Kristian Rosenvold <[email protected]> > >>> > > > > > > > Authored: Tue May 7 18:49:15 2013 +0200 > >>> > > > > > > > Committer: Kristian Rosenvold <[email protected]> > >>> > > > > > > > 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: [email protected] > >>> > > > > > > For additional commands, e-mail: [email protected] > >>> > > > > > > > >>> > > > > > > > >>> > > > > > > >>> > > > > > >>> > > > > >>> > > > >>> > > >>> > >> > >> > > >
