[JSR308] array-valued annotations
eu at javatx.org
Sun Jan 28 20:45:16 EST 2007
Ted Neward wrote:
>> Unfortunately not all annotations are presented in the bytecode (i.e.
>> annotations on local variable types are not). Hopefully JSR 308 will
>> address that limitation.
> We didn't support capturing annotations in anything but source scope because
> there is simply no place to put them. Believe me, we debated long and hard
> about this. I even suggested that debug information (where local variable
> names are stored, and thus a perfectly valid place to store local variable
> annotation data) could be made omnipresent, and was promptly shot down by
> every single member of the EG. Unless this JSR has the ability to mandate a
> new JVM-level attribute that the JVM implementers will recognize and offer
> up via a Reflective API that doesn't yet exist, I think you're going to have
> to punt on this one.
If I am not mistaken, JSR 308 does define new attributes and it makes
perfect sense to store this information up there, even if that
information won't be accessible trough reflection API (which currently
completely ignores the presence of the method code).
Extensibility of the JVM bytecode allows to introduce pretty much any
new attributes and it is just matter of standardization and support in
the compiler. Then code analyzers and annotations processors could use
this information for their own needs.
More information about the JSR308