[Checkers] AnnotatedTypeMirror type parameter cache

Artemus Harper subanark at gmail.com
Sun Sep 7 01:16:03 EDT 2008


I think the type parameter cache in the AnnotatedTypeMirror is causing some
sharing of type parameters where it shouldn't.
As far as I can tell in one of my cases having:

public void add(@Unique("T") T item) { ... }

ended up being interpreted as:
public void add(@Unique("T") T item) <@Unique("T")> { ... }

It also causes a problem when run with the IGJ checker:
import checkers.igj.quals.*;

public class Generics<T extends Generics.TestClass>
{
    public void test(@Mutable T test, @Immutable T test2)
    {
        test.value = 1;
        test2.m();
    }

    public static class TestClass
    {
        public int value;
        public void m() @Immutable
        {

        }
    }
}

to fail with:
tests/igj/Generics.java:7: Cannot (re-)assign value through the reference:
@Immutable T extends @ReadOnly TestClass
        test.value = 1;
            ^
1 error

or

tests/igj/Generics.java:8: call to m() not allowed on the given receiver.
found   : @Mutable TestClass
required: @Immutable TestClass
        test2.m();
               ^
1 error

randomly (depending on the order that annotations are processed in).
-- 
Artemus Harper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.csail.mit.edu/mailman/private/checkers/attachments/20080906/4299059c/attachment.htm 


More information about the checkers mailing list