type paths for some annotated array references

Werner Dietl wdietl at gmail.com
Wed Apr 17 16:10:50 PDT 2013


Hi Andy,

> I had another quick question, I'm trying to determine whether I need a type
> path in a certain situation.
>
> I compile two statements:
>
> Object o = new @A String[1];
> Object o = new String @A[1];
>
> with javac build 81 (or seemingly with the latest jsr308 lang tools, if I'm
> using them correctly), I get the same output attribute:
>
> 0: #15(): NEW, offset=8
>
> I think I expected the first one to have a type path:
>
> 0: #15(): NEW, offset=8, location=[ARRAY]

Thanks for noticing this mismatch!
I've fixed it:

http://hg.openjdk.java.net/type-annotations/type-annotations/langtools/rev/fa40c85d24b2

If you're interested in the JSR 308 reference implementation, the
right mailing list is:

http://mail.openjdk.java.net/pipermail/type-annotations-dev/

Comments about the spec should go to:

http://mail.openjdk.java.net/pipermail/type-annotations-spec-comments/

jsr308-discuss is for jsr308-langtools, which is an extension of the
official JSR 308 RI.


> ps. maybe the second byte of the type path entry for 'deeper in array' could
> indicate how much deeper into the array (similarly for deeper in nested
> type). Use two of them if going deeper than 255 levels in the array but if
> you have arrays that deep you probably have other problems :)  Not sure how
> much you care about saving a few bytes here and there...

This was discussed and rejected by the EG (unfortunately, as I also
proposed this):

http://mail.openjdk.java.net/pipermail/type-annotations-spec-experts/2012-November/000027.html

Please do let us know if you come across anything else!

Cheers,
cu, WMD.

--
http://www.google.com/profiles/wdietl


More information about the type-annotations-dev mailing list