[Checkers] Compiler annotations output

Mahmood Ali mahmood at MIT.EDU
Wed Jul 2 09:08:34 EDT 2008

Hi Mike,

>> writing @A at [CLASS_EXTENDS @-1 offset -1]
>> writing @B at [CLASS_EXTENDS @-1 offset -1]
>> I cannot see how to differentiate between them.
> See section 4.1 at
> http://groups.csail.mit.edu/pag/jsr308/specification/java-annotation-design.html#htoc8
For some reason, now section 4.1 makes a bit of sense for me and I  
have better understanding on what the ClassWriter is doing.  I was  
freaked by it writing out some of the Position fields and not others.

My problem is that I was trying to understand the specification  
through what the compiler is doing.  Now, I can clearly see (unless I  
am horribly mistaken) that the compiler is buggy in enriching Position  
fields.  Position does not actually have type_index field.

Similarly for method parameters, consider the declaration:
     public void test(List<@A Date> a1, List<@B Date> a2) { }

In the ClassWriter phase, the Position.parameter field for both  
annotations is -1 when it supposed to 0 for @A, 1 for @B.

I will try to fix this.

>> Processing annotations is (more used to before my change) divided  
>> between the following:
> Wow.  Could you document this?
Yes.  I will make a better write-up and add it to the repository

>> The problem was that in the desugering stage, the compiler rewrites
>> tree and trim some parts of it, namely:
>> - annotations on the extends and implements clauses
>> - all type arguments for parameterized types
> Why does it do that?
I don't know.  I think removing annotations on extends and implements  
clauses are accidental, but I don't know about all the parameterized  


More information about the checkers mailing list