In the FindBugs distribution, annotations.jar
is not a subset of jsr305.jar
. However, several annotations seem to be duplicated (either exactly, or very closely). Should I prefer an annotation in jsr305.jar
if I have a choice?
Note that I'm not just interested in knowing that it would be "better" to use annotations from jsr305.jar
simply because they represent a standard. Rather, I want to know whether the FindBugs tool will perform the same (or better) analysis if I prefer the jsr305.jar
version of a particular annotation. It could be the case that some jsr305.jar
annotations should be preferred, but others should not.
I'm using FindBugs 1.3.9 which is the most recent version as of this writing. With this version, I see the following choices (please update this table if there are others):
edu.umd.cs.findbugs.annotations.CheckForNull → javax.annotation.CheckForNull
edu.umd.cs.findbugs.annotations.CheckReturnValue → javax.annotation.CheckReturnValue
edu.umd.cs.findbugs.annotations.NonNull → javax.annotation.Nonnull (NB capitalization)
edu.umd.cs.findbugs.annotations.Nullable → javax.annotation.Nullable
edu.umd.cs.findbugs.annotations.When → javax.annotation.meta.When
Also, all of the JCIP annotations are duplicated:
net.jcip.annotations.GuardedBy → javax.annotation.concurrent.GuardedBy
net.jcip.annotations.Immutable → javax.annotation.concurrent.Immutable
net.jcip.annotations.NotThreadSafe → javax.annotation.concurrent.NotThreadSafe
net.jcip.annotations.ThreadSafe → javax.annotation.concurrent.ThreadSafe