[type-annos-observers] some errors in the specification (january 30 version)

Werner Dietl wdietl at gmail.com
Sun Feb 24 18:17:13 PST 2013


Hi Eric,

thanks for noticing that the RI stores the
RuntimeVisibleTypeAnnotations in the Method instead of a Code
attribute.
I will discuss how to verify and fix this on the type-annotations-dev
mailing list.

Also, instead of using the Checker Framework, it might be easier to
use langtools from:

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

This is where I push fixes first and only propagate to
jsr308-langtools/checker-framework when all tests work and there was
significant change.

Thanks and please keep your comments coming!
cu, WMD.


On Sun, Feb 24, 2013 at 8:18 AM, Eric Bruneton <ebruneton at free.fr> wrote:
> 18/02/2013 05:56, Werner Dietl wrote:
>>
>> Hi Eric,
>>
>> thanks for the update!
>>
>> On Sun, Feb 17, 2013 at 2:22 AM, Eric Bruneton <ebruneton at free.fr> wrote:
>>>
>>> FYI, I updated the type annotation implementation in the ASM branch
>>> ASM_5_FUTURE, to match the latest version of the JSR. I hope it is
>>> correct,
>>> but I have no reference implementation against which to test it (is there
>>> one)?
>>
>>
>> The reference implementation for JSR 308 is available here:
>>
>> http://openjdk.java.net/projects/type-annotations/
>>
>> It has also been recently integrated into the main TL branch and
>> should be included in JDK 8 binary builds.
>>
>> You could compile a source program with this javac and then see
>> whether ASM presents the results correctly.
>> You could insert type annotations using ASM and then see whether this
>> javap presents the results correctly.
>>
>> Please do let me know if you see any problem with the reference
>> implementation.
>> cu, WMD.
>
>
> Thanks for the instructions. I downloaded the checkers framework v1.6.0,
> compiled the InterningExample.java example, and tried to read the resulting
> .class (attached) with ASM. I got an error and it seems this is because the
> annotations on the local variables are stored in a
> RuntimeVisibleTypeAnnotations attribute of the method, instead of being
> stored in a RuntimeVisibleTypeAnnotations attribute of the method's Code
> attribute (cf "Changes in JSR 308" in
> http://types.cs.washington.edu/jsr308/specification/java-annotation-design.html#class-file:
> "A type annotation is stored in a Runtime[In]visibleTypeAnnotations
> attribute on the smallest enclosing class, field, method, or Code
> structure."). Maybe I'm not using the correct version of the reference
> implementation?
>
> Otherwise, if I remove these code annotations, and just use annotations on
> classes and methods, like
>
> public class InterningExample<@Interned T extends ArrayList<@Interned ?>>
> extends @Interned ArrayList implements @Interned Cloneable {
>   public void example(@Interned String @Interned [] @Interned [] f) {
>     String foo = "foo";
>     String bar = "bar";
>     if (foo == bar)
>         System.out.println("foo == bar");
>
>   }
>   public @Interned int m(@Interned T e) {
>           return 0;
>   }
> }
>
> Then I am able to read the corresponding class file with ASM (but I haven't
> tried to do read/write round trip test yet).
>
> Eric
>



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


More information about the type-annotations-spec-comments mailing list