Andreas,
the Checker Framework automatically propagates certain declaration
annotations from a superclass to a subclass:
https://github.com/typetools/checker-framework/commit/51db893303c404badd234bc703b691a7a40eb20b
@SideEffectFree and @Pure being two of those annotations.
It looks like we didn't update the manual in enough places to explain
this fully.
Many methods in java.lang.Object are marked as @Pure or @SEF:
https://github.com/typetools/checker-framework/blob/master/checker/jdk/nullness/src/java/lang/Object.java
Therefore, any class that overrides these methods will implicitly also
mark these methods as @Pure and @SEF, explaining why these annotations
would appear in the bytecode.
Without inheriting these annotations, one would get invalid-override
warnings for all such methods, because it is not allowed to e.g.
override the @Pure java.lang.Object#equals method with a non-@Pure
version (which is the default for method declarations).
As the side-effect annotations are currently trusted and not checked,
adding these annotations doesn't cause additional warnings.
Also note that type qualifiers that have been defaulted will appear in
bytecode, even though the source code doesn't mention them explicitly.
For example with the Nullness Checker, by default types are @NonNull;
source code without any explicit annotations will result in bytecode
with @NonNull dependencies.
Is the Maven Dependency Analyzer not complaining about type annotations?
So in effect, bytecode that is generated by the Checker Framework can
automatically depend on checker-qual, even though the source code
didn't explicitly depend on any qualifiers.
Would it be easy to add checker-qual as a compile dependency for all
classes that get compiled by the Checker Framework?
Best,
cu, WMD.
P.S.: At the moment this annotation inheritance only happens for
declaration annotations. @InheritedAnnotation can be used to mark
additional declaration annotations to be inherited.
Type qualifiers are currently not inherited, but that might change:
https://github.com/typetools/checker-framework/issues/286
Also relevant:
https://github.com/typetools/checker-framework/issues/342
--
http://www.google.com/profiles/wdietl