< prev index next >

src/java.base/share/classes/sun/reflect/annotation/TypeAnnotationParser.java

Print this page

        

*** 349,364 **** static Map<Class<? extends Annotation>, Annotation> mapTypeAnnotations(TypeAnnotation[] typeAnnos) { Map<Class<? extends Annotation>, Annotation> result = new LinkedHashMap<>(); for (TypeAnnotation t : typeAnnos) { Annotation a = t.getAnnotation(); 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; } // Position codes // Regular type parameter annotations --- 349,367 ---- static Map<Class<? extends Annotation>, Annotation> mapTypeAnnotations(TypeAnnotation[] typeAnnos) { Map<Class<? extends Annotation>, Annotation> result = new LinkedHashMap<>(); for (TypeAnnotation t : typeAnnos) { Annotation a = t.getAnnotation(); + if (a != null) { Class<? extends Annotation> klass = a.annotationType(); AnnotationType type = AnnotationType.getInstance(klass); ! if (type.retention() == RetentionPolicy.RUNTIME && ! result.put(klass, a) != null) { throw new AnnotationFormatError("Duplicate annotation for class: "+klass+": " + a); } + } + } return result; } // Position codes // Regular type parameter annotations
< prev index next >