[JSR308] Checkers - a useability problem, suggestion and idea
adam at warski.org
Thu Oct 23 04:16:56 EDT 2008
> There is, however, a problem. While it is OK that my program will have
> a static-analysis-time dependency on Sun's tree API (or even compile-
> time dependency), it can't have a run-time dependency.
> But it will: if I use, for example, the @NonNull annotation anywhere
> in my program (not in a comment - let's say on a method parameter),
> then when my annotated class will be loaded, the classloader will have
> to load the NonNull annotation, and then the value of the ImplicitFor
> meta-annotation, which contains a reference to Tree.Kind in Sun's tree
> API. In a non-Sun JDK this may fail.
it turns out that my understanding of how annotations are read was
wrong; sorry for creating unneccessary confusion. Anyway, while
loading a class, its annotations are not read. This only happens once
you request them using reflection. So having a dependency on Sun's
tree API in an annotation won't cause any class not found exceptions
on a non-sun jvm. However, I still think that the public API of the
checkers framework shouldn't depend on a specific JVM implementation.
More information about the JSR308