[JSR308] Can we agree on our goals?

Gary T. Leavens leavens at cs.iastate.edu
Thu Feb 1 15:48:59 EST 2007


Hi Tom,

On Thu, 1 Feb 2007, Tom Ball wrote:

> 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.

So this is just the abstract syntax trees in javac?

That's interesting, but doesn't seem fundamental.  For example, javac
could "desugar" statements with annotations into block statements with
annotations (in some early pass, e.g., parsing), so as to not cause
excess problems for the rest of this particular compiler.  And surely
other compilers have different abstract syntax trees.

> 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.

Yes, I think the structure of the bytecode in the JVM would be a more
relevant implementation detail.  I don't know anything about that, so
would be curious to know if there was a similar limitation on easily
attaching annotations at that level.

         Gary T. Leavens
         Department of Computer Science, Iowa State University
         229 Atanasoff Hall, Ames, Iowa 50011-1041 USA
         http://www.cs.iastate.edu/~leavens  phone: +1-515-294-1580




More information about the JSR308 mailing list