[JSR308] Can we agree on our goals?

Tom Ball Tom.Ball at Sun.COM
Thu Feb 1 15:25:35 EST 2007

Eugene Kuleshov wrote:
> Gary T. Leavens wrote:
>> For my part, I would be very happy with adding the ability to have
>> annotations on types and statements (or even just loop statements).
>> I'm not personally trying to use any kind of strategy to lead us down
>> a slippery slope towards annotations on all possible syntactic
>> categories.  I think if Java programmers can annotate declarations,
>> types, and (loop) statements, that will be plenty.
>  Gary, why limit it on loops and not all { } blocks?

At the risk of polluting this discussion with implementation details, 
javac block nodes have an internal modifiers field, and modifiers hold 
annotations.  The Compiler API only allows access to the static flag in 
those modifiers (BlockTree.isStatic()), but that interface can be 
extended in a backwards-compatible way to provide access to the 

The advantage of allowing annotations on blocks rather than on 
statements is that developers can surround any statement with a block if 
they want to annotate it, without  having to make radical modifications 
to the compiler.  It should also make scoping issues simpler, too.  I 
haven't thought out what the impact of having block annotations will be 
on JVM classfiles, but suspect that the current proposed attribute will 


More information about the JSR308 mailing list