[JSR308] Annotations on statements and regularity

Doug Lea dl at cs.oswego.edu
Thu Feb 1 13:37:45 EST 2007


Gary T. Leavens wrote:
> Hi all,
> 
> Here's another thought about why allowing annotations on statements may be
> both good and somewhat tricky gramatically.
> 

Thanks for the nice example that illustrates what I was going to
write as a meta-comment:

JSR175, that originally defined annotations, stopped short of allowing
them in various cases (a few of them over my strong objection and
subsequent cave-in), due primarily to not knowing how to pull it off.
For the most well-known example of this, without some change in either
compilers or class file formats, specs for annotations on local
variables were stuck being at best limited.
But, in part because JSR269 established a framework that can
cope with more cases, these now seem less like major hurdles.
And as time goes on, it is increasingly obvious that specs
will eventually have to allow annotations on just about every semantically
meaningful syntactic element in Java that we can figure out how to
support. (As in my last mail, some constructions surrounding arrays
might be among the few for which there are unsurmountable limitations.)
Stopping short of this in JSR308 will surely lead to JSR441 being
proposed in a few years to do one more step of cleanup. As a general
principle, the second JSR about anything in Java should have as
among its primary goals to postpone as long as possible the need for
a third.

That said, there *are* some tricky issues in figuring out unambiguous
annotation syntax in a number of cases, as in Gary's examples.
I'm happy to see people trying their best to find solutions.

-Doug



More information about the JSR308 mailing list