[JSR308] Creating new annotated types.
Mahmood Ali
mahmood at MIT.EDU
Wed Nov 12 10:16:31 EST 2008
Greetings Niko,
> Unfortunately, I find it very hard to manipulate
> AnnotatedTypeMirrors. It's relatively easy to add or remove
> annotations, but to make other sorts of changes seems to be next to
> impossible.
This is intentional. The goal was to deter checkers from manipulating
the java type and from breaking java conformity.
Can you explained your desired type changes further?
> In my case, the method is declared as:
>
> public static <X> X free(X ptr) { return ptr; }
>
> What I want to do is to change the annotations on the return type.
> Because the return type and the argument type are linked, [...]
Annotating type parameter (explicitly or effectively) is not kosher.
You can special case the given senario, modifying the return type of
the method invocation tree of the method (e.g. free()).
annotateImplicit({MethodInvocation}Tree, AnnotatedTypeMirror) should
be passed the resolved type of such method.
> It does a deep clone of a
> type with appropriate overloadable methods at each point.
Be careful with recursive type parameters (e.g. <T extends Enum<T>>).
- Mahmood
More information about the JSR308
mailing list