[JSR308] Expression annotations

Michael Ernst mernst at csail.mit.edu
Mon Jun 4 21:58:55 EDT 2007


>   The only argument I have for supporting expression annotations is to 
> provide some information about expression boundaries in the bytecode. 
> So, the major difference between expression annotation and cast is that 
> cast annotation associated with a value, and expression annotation 
> should be associated with several code ranges.
>   Unless of course cast annotation would have code ranges association in 
> the bytecode.

Your description of the difference is correct.  Cast annotations do not have
code ranges:  the cast annotation refers to the type of the value computed
by the expression, not to the expression itself.

Statement annotations must have code ranges, just as expression annotations
would.  Thus, statement annotations could serve as a surrogate for
expression annotations (with the minor inconvenience that a programmer must
factor out the given expression into a separate statement).  Since I
believe that there are more good use cases for statement annotations than
for expression annotations, and since many of the implementation issues are
the same, I think we should focus first on statement annotations.  If
statement annotations work out well, then we can decide whether we also
want expression annotations.


More information about the JSR308 mailing list