[JSR308] Can we agree on our goals? (annotations on blocks)

Eugene Kuleshov eu at javatx.org
Thu Feb 1 15:40:55 EST 2007

Tom Ball wrote:
>>  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 
> annotations.
> 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 work.
  Tom, does block nodes have information about type of the parent, i.e. 
if/else/for/try/catch/etc ?


More information about the JSR308 mailing list