[JSR308] A simple proposal for recursive annotations

Lex Spoon lex at lexspoon.org
Sat Jun 6 13:51:49 EDT 2009


On Jun 6, 2009, at 12:08 PM, Jonathan Aldrich wrote:
> (because the annotations in the static checking system may be
> parameterized in different ways than Java type parameterization).


I admit this strikes me the same way as it struck an earlier poster.   
It looks like a bad trajectory for the annotation language to be  
significantly more sophisticated than the annotated language.

If the annotation language seems too constraining, I would propose  
what we did for Scala's annotations.  Specifically, Scala allows  
arbitrary expressions to be embedded within the annotations.  That  
approach keeps the annotations group from becoming a general-purpose  
language design group, it allows a very general language of  
annotations, and it provides synergy with the underlying language.  As  
one example of this synergy, someone designing an a set of annotations  
can arrange that evaluating the embedded expression would give a run- 
time representation of an equivalent type.

If Java expressions seem verbose, I will be the first to agree, but  
that seems better taken up in the core language.

All this said, it first seems important to accomplish 308's main task  
of allowing annotations on types at all.  Extending the set of  
annotations is a further step beyond the main scope, isn't it?

Lex Spoon




More information about the JSR308 mailing list