Rethinking TypeAnnotation vs Annotation

Eric McCorkle eric.mccorkle at oracle.com
Thu Feb 6 11:59:43 PST 2014


In the process of working on the next roadmap step for type annotations,
I've realized something.

The current implementation, and I think most of everyone's thinking on
annotations treats type annotations as a special case of regular
annotations.  Indeed, this is sort of the intuitive first thought.

But looking at the actual implementation details, I think the reverse is
actually true.  Any given annotation is potentially a type annotation,
especially earlier in the javac pipeline (where I'm presently generating
TypeAnnotationPositions in my new patch).  So, on the implementation
front, it makes perfect sense to do things like store
TypeAnnotationPositions in Attribute.Compound, as opposed to
Attribute.TypeCompound.

I think this would also go a long way towards creating the single
codepath for attaching annotations that I want to create.

Comments?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eric_mccorkle.vcf
Type: text/x-vcard
Size: 303 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20140206/0a1f2c73/eric_mccorkle.vcf 


More information about the compiler-dev mailing list