[JSR308] Implicit annotations with values

Artemus Harper subanark at gmail.com
Fri Jul 4 16:21:56 EDT 2008


What would be the best way to add an implicit annotation to a type, where
the implicit annotation has some of its elements defined.

My code:
@Override
    protected void annotateImplicit(Tree tree, AnnotatedTypeMirror type) {
    ...
    switch(tree.getKind()) {
    ...
    case NEW_CLASS:
    if(type.getAnnotation(InnerUnique.class.getName()) == null) {
       //I want to add @InnerUnique({"*"})
    ...
    }
}

where InnerUnique is:
@TypeQualifier
@Retention(RetentionPolicy.RUNTIME)
public @interface InnerUnique {
   String[] value();
}

I see that AnnotationUtils has a method to get an AnnotationMirror with no
values defined, but I don't see any to actually set the values.
My best guess is to simply implement AnnotationMirror my self and return the
values I want. Is there a better way to do this?

-- 
Artemus Harper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.csail.mit.edu/pipermail/jsr308/attachments/20080704/73328222/attachment.htm 


More information about the JSR308 mailing list