Search in sources :

Example 1 with AnnotationType

use of sun.reflect.annotation.AnnotationType in project jdk8u_jdk by JetBrains.

the class TypeVariableImpl method mapAnnotations.

private static Map<Class<? extends Annotation>, Annotation> mapAnnotations(Annotation[] annos) {
    Map<Class<? extends Annotation>, Annotation> result = new LinkedHashMap<>();
    for (Annotation a : annos) {
        Class<? extends Annotation> klass = a.annotationType();
        AnnotationType type = AnnotationType.getInstance(klass);
        if (type.retention() == RetentionPolicy.RUNTIME)
            if (result.put(klass, a) != null)
                throw new AnnotationFormatError("Duplicate annotation for class: " + klass + ": " + a);
    }
    return result;
}
Also used : AnnotationType(sun.reflect.annotation.AnnotationType) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

LinkedHashMap (java.util.LinkedHashMap)1 AnnotationType (sun.reflect.annotation.AnnotationType)1