[JSR308] Use of @Target meta-annotation

Michael Ernst mernst at csail.mit.edu
Sat May 19 09:41:02 EDT 2007


> I think we'll have to agree to disagree about the importance of this.

OK.  I understand your points, which are valid and well-stated.  I agree
that we shouldn't hobble future programmers, but we also shouldn't choose a
syntax that is less convenient based on speculation.  So we need to weigh
these options.  Experience with prototype implementations may aid us in
resolving these issues one way or the other, and I am open to both.

> Your proposal to make the meaning of an annotation change based on
> its meta-annotation violates the principle that an annotation should not
> affect the meaning of the program elements.

Let me correct two misinterpretations in this statement of the
disadvantages of the approach that uses @Target meta-annotations.
(I don't argue it has no disadvantages, just that these are overstated.)

First, the proposal does not change the meaning of the annotation.  It only
determines the target, based on the @Target meta-annotation.

Second, annotations never affect the meaning of program elements, so the
principle is not violated.  The only thing that can possibly be affected by
@Target meta-annotations is an annotation processor, and it's fine for
(meta-)annotations to affect an annotation processor.


More information about the JSR308 mailing list