[Jsr308-statements] First draft of proposal

Trevor Harmon trevor at vocaro.com
Fri Mar 2 00:50:46 EST 2007


On Mar 1, 2007, at 4:51 PM, Eugene Kuleshov wrote:

>  The bytecode-level analyzer or transformer can still read  
> "invisible" annotations before classes are loaded. But then, once  
> classes are loaded, JVM doesn't really allow to do much about the  
> method code (except reload/redefine it, which effectively the same  
> thing as transforming things before loading).

At present, yes, it doesn't make sense. But I'm looking ahead to APIs  
and VMs that don't yet exist. Our low-level implementation of  
annotations shouldn't prevent future higher-level tools from doing  
things they might want to do.

> So, it seems like it would be a redundant thing, unless method  
> implementation details will be exposed trough reflection API. But  
> then it is probably unlikely that it would be a bytecode-level  
> exposure (i.e. it such reflection could return a Java AST  
> representation) and so, it may not need those bytecode attributes  
> anyway.

Yes, it might not need them. But then maybe it will. How can we say  
for sure? I think we should leave all the doors open.

Also, leaving out run-time visible statement annotations would  
actually make compiler implementation more complicated. For example,  
what should happen if a statement annotation is marked  
Retention.RUNTIME? Should the compiler silently change such  
annotations to Retention.CLASS? Or should it signal an error? The  
proper course of action is not clear.

I've tried to summarize this thread on the wiki; please edit as needed.

Trevor






More information about the Jsr308-statements mailing list