[Checkers] AnnotatedTypeMirror is not sufficiently unique

Mahmood Ali mahmood at MIT.EDU
Fri Oct 3 00:59:21 EDT 2008


Hi Artemus,

The Checker framework treats AnnotatedTypeMirror identity basically  
like Types.isSameType(), where its identity is the abstract type it  
represents rather than where it is coming from.  The Checker Framework  
uses this convention heavily, especially in generic method resolution.

> I assume that it is intended that the AnnotatedTypeMirror act like  
> Element in unique identification.
As noted above, this is a false assumption.


> 3. Make the AnnotatedTypeMirror immutable after the annotateImplicit  
> call and return the same object for the same Element or Tree in the  
> getAnnotatedType method (instead of returning a copy from the  
> cache). This way I could keep a mapping from AnnotatedType to  
> reciever.
It is desired for that AnnotatedTypeMirror to immutable after  
annotateImplicit and that the Visitor does not modify it.  However, we  
do not enforce this convention.

Can you elaborate on what you want to do or how you are going about it?

> For example there is no way to determine the difference between the  
> return types of methods that have the same type and same  
> annotations. This causes me a problem since I want to be able to  
> retrieve additional information on an AnnotatedType (in particular  
> the receiver of the method, if any, that is scope with the  
> deceleration)
You can AnnotatedExecutableType.getElement() to differentiate between  
them.  You can only use this with method executable type rather than  
the return or the receiver type.

- Mahmood




More information about the checkers mailing list