[JSR308] AnnotationBuilder request

Artemus Harper subanark at gmail.com
Wed Jul 23 23:53:00 EDT 2008


Any chance of adding a constructor to the AnnotationBuilder that takes an
existing AnnotationMirror as a base for a set of values?

My current situation is that when you invoke a method the annotations on the
parameters and return type can change based on the annotations of callee's
object.

E.g.

If I have a method (lets say add in an erased List):
void add(@Unique({"T"}) Object o) { ... }

and I have code:
@InnerUnique({"T"}) List foo = ...;
@Unique Object o = new Object();
foo.add(o);

would be valid (as I've defined these annotations) since having foo
annotated with @InnerUnique({"T"}) will change the add method for the
invocation to:
void add(@Unique Object o) { ... }

But, if the InnerUnique annotation was not present (or did not match
parameters) the method instead would be:
void add(Object o) { ... }

With the way the current system is built I can annotate elements differently
depending on use.

By giving an easy way to modify the annotation's values I can adjust an
annotation depending on its use without changing its other values.
-- 
Artemus Harper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.csail.mit.edu/pipermail/jsr308/attachments/20080723/3694887f/attachment.htm 


More information about the JSR308 mailing list