[JSR308] Creating new annotated types.

Mahmood Ali mahmood at MIT.EDU
Wed Nov 12 12:24:15 EST 2008


Hi Niko,

> That said, in most cases it is not necessary
> to manipulate the AnnotatedTypeMirrors-- except when it is.
Can you provide cases when it is necessary to manipulate  
AnnotatedTypeMirror?

> I'm not quite sure what you think is not kosher.
I meant that currently we don't support it yet.  It may be supported  
in the future.

>> annotateImplicit({MethodInvocation}Tree, AnnotatedTypeMirror) should
>> be passed the resolved type of such method.
> annotateImplicit() does not solve my problem, because -- due to the
> use of a type parameter -- the ExecutableType I get back has linked
> the return type and the type of the argument (they are the same
> pointer).  So if I modify the annotations on one, I modify the
> annotations on the other.  This is incorrect.

There are two issues here:
Manipulating annotateImplicit(MethodTree, AnnotatedExecutableType):
   Your analysis is correct.  The return type and the parameter type  
(which are the same type variable) are linked.

Manipulating annotateImplicit(MethodInvocationTree,  
AnnotatedTypeMirror):
   When annotateImplicit is invoked on a method invocation, the  
returning result should be the unaliased type-resolved return type.   
You should be able to modify it without impacting the parameter type.

Note: I realize that AnnotatedTypeFactory.methodFromUse() may result  
in a bit of undesired aliasing of the resolved types (I can elaborate  
on this more if needed).  I will fix this by the next release.

Regards,
Mahmood




More information about the JSR308 mailing list