[JSR308] Backward compatibility for ElementType meta-annotations

Michael Ernst mernst at csail.mit.edu
Mon Jul 16 21:40:04 EDT 2007


Bill-

> The document suggests (Section 3.3) that we can use ElementType  
> declarations to disambiguate whether an annotation applies to a  
> method or a return value.
> 
> However, this is not compatible with pre-JSR308 usage, and won't be  
> compatible with JSR305.

JSR 308 could include new versions of the JSR 305 annotations; the new
versions would have JSR-308-compatible meta-annotations.  (For example, the
new version of NonNull would have an ElementType.TYPE meta-annotation.)
Users of a JSR 308 compiler will have the new version first on their
classpath, and users of a non-JSR-308-aware tool will use the old version
of NonNull (meta-annotated with ElementType.METHOD).

I think this permits re-use of the same syntax without rewriting source
code in order to upgrade to JSR 308 or Java 7, but let me know if I am
missing something.  (I have some other ideas if this doesn't work.)

                    -Mike

PS: Sorry for the delay in answering these emails; I've been traveling and
have fallen behind on email.



More information about the JSR308 mailing list