[JSR308] Constructor Annotation Inference

Artemus Harper subanark at gmail.com
Fri Jan 16 18:27:46 EST 2009


Just make sure you are overriding both annotateImplicit methods. As  
one gets types from within the same source file (e.g. local  
variables), and the other gets it from compiled code (e.g. the  
implicit anotations on Object.getClass())
On Jan 16, 2009, at 6:10 AM, Niko Matsakis wrote:

>
>>> Before answering your email, I would like to mention a convention
>>> used within AnnotatedTypeFactory.  Many methods in the class follow
>>> a naming convention: .fromFOO methods (e.g. fromTree,
>>> fromExpression) return types with only the annotations that the user
>>> explicitly inserted; .getAnnotatedType* methods (e.g.
>>> getAnnotatedType, getAnnotatedTypeFromTypeTree) return types with
>>> the annotations enforced in such trees whether explicitly inserted
>>> by the user or implicitly inserted by the checker.
>>
>> Good to know.  Perhaps I am using the wrong method.  If I can't  
>> find a
>> better one, however, I will simply override fromExpression().  I have
>> to think about it a bit.
>
> Ok, now I understand this part of the design better!  Once I switched
> to using getAnnotatedType() instead of fromExpression(), I realized I
> could easily add my inferred annotations in annotateImplicit(), and
> all is well (for the moment, at least ;).  Thanks again for the help!
>
>
> Niko
>
> _______________________________________________
> JSR308 mailing list
> JSR308 at lists.csail.mit.edu
> https://lists.csail.mit.edu/mailman/listinfo/jsr308




More information about the JSR308 mailing list