I had a little chat with the guys at the findbugs mailing list which has
made this all a lot easier, even to thickheads like me:

It turns out we do not have to "subscribe" to anything like JSR-305 at all.
I probably watched the movie "Highlander" too much in my teens, which had
me searching too much for the "there can be only one" kind of solution.

Since I love source code, I'll just point you all at the findbugs source I
was given:

http://code.google.com/p/findbugs/source/browse/trunk/findbugs/src/java/edu/umd/cs/findbugs/ba/NullnessAnnotation.java#55

This shows the part where findbugs searches for /any/ kind of @Nonnull
annotation and also @Nullable. The guys at findbugs realized that there
does not have to be only one. And it turns out the IntelliJ guys also
understood this, so we can add any arbitrary annotation to the
"nullability" section of the idea code-style file. (As for eclipse, well -
ahem - I'm sure the eclipse users out there will solve this. It' s OSS  :)

So the proposal is really simple:

We make "maven-annotations" under maven-shared. RC for this can be found at
https://github.com/krosenvold/maven-annotations.git

this implementation does /not/ depend on any specific "jsr" or any other
dependency, so we can freely leak this from maven core into plugins.

 We specifically leak

org.apache.maven.shared.annotations.Nonnull
org.apache.maven.shared.annotations.Nullable

from maven core into plugins. From the moment we publish these, they cannot
ever change.

If core exposes version "1.0" of "maven-annotations" and a plugin includes
version "1.1" of maven-annotations, the *additional* definitions in 1.1
will be loaded from the 1.1 jar, while Nonnull and Nullable will leak in
their 1.0 versions from core.

Kristian

Reply via email to