Annotation element values

Mohan Radhakrishnan radhakrishnan.mohan at gmail.com
Tue Dec 24 04:53:46 PST 2013


Hi,

Tried to subscribe using
http://mail.openjdk.java.net/mailman/listinfo/type-annotations-dev

I could compile the processor code with b113. But with b120 it doesn't.

Is this code supposed to print the annotation element values ? I am also
trying to
get the annotations applied on the bound 'Integer'.

--------------Source--------------
   @TypeUse(value = 0) @TypeUse(value = 1)class Test1< T extends
@TypeUse(value = 2) @TypeUse(value = 3) Integer> {

        /**
         * A type annotation is permitted in front of a constructor
declaration, where declaration annotations are already
         permitted.
         */
        @TypeUse(value = 0) <S> Test1(String s){

        }
    }

}

--------------------Processor code---------------------------

for (TypeParameterElement typeParameterElement : ((TypeElement)
e).getTypeParameters()) {

            for( AnnotationMirror am  :
typeParameterElement.getAnnotationMirrors() ){

                System.out.println( "Annotation [" + am + "] [" +
typeParameterElement  + "]");

                for(Map.Entry< ? extends ExecutableElement, ? extends
AnnotationValue> m : am.getElementValues().entrySet()){

                    System.out.println( "[" + m.getKey() +"][" +
m.getValue() + "]");

                }

            }

            for (TypeMirror typeMirror : typeParameterElement.getBounds()) {

                System.out.println( "Annotation [" +
Arrays.asList(typeMirror.getAnnotationsByType(RepeatableAnnotation.TypeUse.class))
+ "] [" + typeMirror  + "]");

            }
        }
    }

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/type-annotations-dev/attachments/20131224/66ab157b/attachment.html 


More information about the type-annotations-dev mailing list