@@ -445,10 +445,10 @@ public static <A extends Annotation> A getMergedAnnotation(AnnotatedElement elem
445445 * single annotation and within annotation hierarchies.
446446 * <p>This method follows <em>get semantics</em> as described in the
447447 * {@linkplain AnnotatedElementUtils class-level javadoc}.
448- * @param element the annotated element; never {@code null}
449- * @param annotationType the annotation type to find; never {@code null}
450- * @return the set of all merged, synthesized {@code Annotations} found, or an empty
451- * set if none were found
448+ * @param element the annotated element ( never {@code null})
449+ * @param annotationType the annotation type to find ( never {@code null})
450+ * @return the set of all merged, synthesized {@code Annotations} found,
451+ * or an empty set if none were found
452452 * @since 4.3
453453 * @see #getMergedAnnotation(AnnotatedElement, Class)
454454 * @see #getAllAnnotationAttributes(AnnotatedElement, String)
@@ -478,10 +478,10 @@ public static <A extends Annotation> Set<A> getAllMergedAnnotations(AnnotatedEle
478478 * single annotation and within annotation hierarchies.
479479 * <p>This method follows <em>get semantics</em> as described in the
480480 * {@linkplain AnnotatedElementUtils class-level javadoc}.
481- * @param element the annotated element; never {@code null}
482- * @param annotationType the annotation type to find; never {@code null}
483- * @return the set of all merged repeatable {@code Annotations} found, or an empty
484- * set if none were found
481+ * @param element the annotated element ( never {@code null})
482+ * @param annotationType the annotation type to find ( never {@code null})
483+ * @return the set of all merged repeatable {@code Annotations} found,
484+ * or an empty set if none were found
485485 * @since 4.3
486486 * @see #getMergedAnnotation(AnnotatedElement, Class)
487487 * @see #getAllMergedAnnotations(AnnotatedElement, Class)
@@ -506,13 +506,13 @@ public static <A extends Annotation> Set<A> getMergedRepeatableAnnotations(Annot
506506 * single annotation and within annotation hierarchies.
507507 * <p>This method follows <em>get semantics</em> as described in the
508508 * {@linkplain AnnotatedElementUtils class-level javadoc}.
509- * @param element the annotated element; never {@code null}
510- * @param annotationType the annotation type to find; never {@code null}
509+ * @param element the annotated element ( never {@code null})
510+ * @param annotationType the annotation type to find ( never {@code null})
511511 * @param containerType the type of the container that holds the annotations;
512512 * may be {@code null} if the container type should be looked up via
513513 * {@link java.lang.annotation.Repeatable}
514- * @return the set of all merged repeatable {@code Annotations} found, or an empty
515- * set if none were found
514+ * @return the set of all merged repeatable {@code Annotations} found,
515+ * or an empty set if none were found
516516 * @since 4.3
517517 * @see #getMergedAnnotation(AnnotatedElement, Class)
518518 * @see #getAllMergedAnnotations(AnnotatedElement, Class)
@@ -771,10 +771,10 @@ public static <A extends Annotation> A findMergedAnnotation(AnnotatedElement ele
771771 * single annotation and within annotation hierarchies.
772772 * <p>This method follows <em>find semantics</em> as described in the
773773 * {@linkplain AnnotatedElementUtils class-level javadoc}.
774- * @param element the annotated element; never {@code null}
775- * @param annotationType the annotation type to find; never {@code null}
776- * @return the set of all merged, synthesized {@code Annotations} found, or an empty
777- * set if none were found
774+ * @param element the annotated element ( never {@code null})
775+ * @param annotationType the annotation type to find ( never {@code null})
776+ * @return the set of all merged, synthesized {@code Annotations} found,
777+ * or an empty set if none were found
778778 * @since 4.3
779779 * @see #findMergedAnnotation(AnnotatedElement, Class)
780780 * @see #getAllMergedAnnotations(AnnotatedElement, Class)
@@ -803,10 +803,10 @@ public static <A extends Annotation> Set<A> findAllMergedAnnotations(AnnotatedEl
803803 * single annotation and within annotation hierarchies.
804804 * <p>This method follows <em>find semantics</em> as described in the
805805 * {@linkplain AnnotatedElementUtils class-level javadoc}.
806- * @param element the annotated element; never {@code null}
807- * @param annotationType the annotation type to find; never {@code null}
808- * @return the set of all merged repeatable {@code Annotations} found, or an empty
809- * set if none were found
806+ * @param element the annotated element ( never {@code null})
807+ * @param annotationType the annotation type to find ( never {@code null})
808+ * @return the set of all merged repeatable {@code Annotations} found,
809+ * or an empty set if none were found
810810 * @since 4.3
811811 * @see #findMergedAnnotation(AnnotatedElement, Class)
812812 * @see #findAllMergedAnnotations(AnnotatedElement, Class)
@@ -831,13 +831,13 @@ public static <A extends Annotation> Set<A> findMergedRepeatableAnnotations(Anno
831831 * single annotation and within annotation hierarchies.
832832 * <p>This method follows <em>find semantics</em> as described in the
833833 * {@linkplain AnnotatedElementUtils class-level javadoc}.
834- * @param element the annotated element; never {@code null}
835- * @param annotationType the annotation type to find; never {@code null}
834+ * @param element the annotated element ( never {@code null})
835+ * @param annotationType the annotation type to find ( never {@code null})
836836 * @param containerType the type of the container that holds the annotations;
837837 * may be {@code null} if the container type should be looked up via
838838 * {@link java.lang.annotation.Repeatable}
839- * @return the set of all merged repeatable {@code Annotations} found, or an empty
840- * set if none were found
839+ * @return the set of all merged repeatable {@code Annotations} found,
840+ * or an empty set if none were found
841841 * @since 4.3
842842 * @see #findMergedAnnotation(AnnotatedElement, Class)
843843 * @see #findAllMergedAnnotations(AnnotatedElement, Class)
@@ -994,9 +994,10 @@ private static <T> T searchWithGetSemanticsInAnnotations(AnnotatedElement elemen
994994
995995 // Search in annotations
996996 for (Annotation annotation : annotations ) {
997- if (!AnnotationUtils .isInJavaLangAnnotationPackage (annotation )) {
998- if (annotation .annotationType () == annotationType ||
999- annotation .annotationType ().getName ().equals (annotationName ) ||
997+ Class <? extends Annotation > currentAnnotationType = annotation .annotationType ();
998+ if (!AnnotationUtils .isInJavaLangAnnotationPackage (currentAnnotationType )) {
999+ if (currentAnnotationType == annotationType ||
1000+ currentAnnotationType .getName ().equals (annotationName ) ||
10001001 processor .alwaysProcesses ()) {
10011002 T result = processor .process (element , annotation , metaDepth );
10021003 if (result != null ) {
@@ -1009,7 +1010,7 @@ private static <T> T searchWithGetSemanticsInAnnotations(AnnotatedElement elemen
10091010 }
10101011 }
10111012 // Repeatable annotations in container?
1012- else if (annotation . annotationType () == containerType ) {
1013+ else if (currentAnnotationType == containerType ) {
10131014 for (Annotation contained : getRawAnnotationsFromContainer (element , annotation )) {
10141015 T result = processor .process (element , contained , metaDepth );
10151016 if (result != null ) {
@@ -1024,8 +1025,9 @@ else if (annotation.annotationType() == containerType) {
10241025
10251026 // Recursively search in meta-annotations
10261027 for (Annotation annotation : annotations ) {
1027- if (!AnnotationUtils .isInJavaLangAnnotationPackage (annotation )) {
1028- T result = searchWithGetSemantics (annotation .annotationType (), annotationType ,
1028+ Class <? extends Annotation > currentAnnotationType = annotation .annotationType ();
1029+ if (!AnnotationUtils .isInJavaLangAnnotationPackage (currentAnnotationType )) {
1030+ T result = searchWithGetSemantics (currentAnnotationType , annotationType ,
10291031 annotationName , containerType , processor , visited , metaDepth + 1 );
10301032 if (result != null ) {
10311033 processor .postProcess (element , annotation , result );
@@ -1098,7 +1100,7 @@ private static <T> T searchWithFindSemantics(AnnotatedElement element, Class<? e
10981100 * have already been <em>visited</em>.
10991101 * <p>The {@code metaDepth} parameter is explained in the
11001102 * {@link Processor#process process()} method of the {@link Processor} API.
1101- * @param element the annotated element; never {@code null}
1103+ * @param element the annotated element ( never {@code null})
11021104 * @param annotationType the annotation type to find
11031105 * @param annotationName the fully qualified class name of the annotation
11041106 * type to find (as an alternative to {@code annotationType})
@@ -1124,11 +1126,11 @@ private static <T> T searchWithFindSemantics(AnnotatedElement element, Class<? e
11241126
11251127 // Search in local annotations
11261128 for (Annotation annotation : annotations ) {
1127- if (! AnnotationUtils . isInJavaLangAnnotationPackage ( annotation )) {
1128- if (annotation . annotationType () == annotationType
1129- || annotation . annotationType (). getName (). equals ( annotationName )
1130- || processor . alwaysProcesses ()) {
1131-
1129+ Class <? extends Annotation > currentAnnotationType = annotation . annotationType ();
1130+ if (! AnnotationUtils . isInJavaLangAnnotationPackage ( currentAnnotationType )) {
1131+ if ( currentAnnotationType == annotationType ||
1132+ currentAnnotationType . getName (). equals ( annotationName ) ||
1133+ processor . alwaysProcesses ()) {
11321134 T result = processor .process (element , annotation , metaDepth );
11331135 if (result != null ) {
11341136 if (processor .aggregates () && metaDepth == 0 ) {
@@ -1140,7 +1142,7 @@ private static <T> T searchWithFindSemantics(AnnotatedElement element, Class<? e
11401142 }
11411143 }
11421144 // Repeatable annotations in container?
1143- else if (annotation . annotationType () == containerType ) {
1145+ else if (currentAnnotationType == containerType ) {
11441146 for (Annotation contained : getRawAnnotationsFromContainer (element , annotation )) {
11451147 T result = processor .process (element , contained , metaDepth );
11461148 if (result != null ) {
@@ -1155,11 +1157,12 @@ else if (annotation.annotationType() == containerType) {
11551157
11561158 // Search in meta annotations on local annotations
11571159 for (Annotation annotation : annotations ) {
1158- if (!AnnotationUtils .isInJavaLangAnnotationPackage (annotation )) {
1159- T result = searchWithFindSemantics (annotation .annotationType (), annotationType , annotationName ,
1160+ Class <? extends Annotation > currentAnnotationType = annotation .annotationType ();
1161+ if (!AnnotationUtils .isInJavaLangAnnotationPackage (currentAnnotationType )) {
1162+ T result = searchWithFindSemantics (currentAnnotationType , annotationType , annotationName ,
11601163 containerType , processor , visited , metaDepth + 1 );
11611164 if (result != null ) {
1162- processor .postProcess (annotation . annotationType () , annotation , result );
1165+ processor .postProcess (currentAnnotationType , annotation , result );
11631166 if (processor .aggregates () && metaDepth == 0 ) {
11641167 aggregatedResults .add (result );
11651168 }
@@ -1299,7 +1302,7 @@ private static <A extends Annotation> A[] getRawAnnotationsFromContainer(Annotat
12991302 * Resolve the container type for the supplied repeatable {@code annotationType}.
13001303 * <p>Delegates to {@link AnnotationUtils#resolveContainerAnnotationType(Class)}.
13011304 * @param annotationType the annotation type to resolve the container for
1302- * @return the container type; never {@code null}
1305+ * @return the container type ( never {@code null})
13031306 * @throws IllegalArgumentException if the container type cannot be resolved
13041307 * @since 4.3
13051308 */
@@ -1450,8 +1453,8 @@ private interface Processor<T> {
14501453 * responsible for asking this processor if it {@link #aggregates} results
14511454 * and then adding the post-processed results to the list returned by this
14521455 * method.
1453- * @return the list of results aggregated by this processor; never
1454- * {@code null} unless {@link #aggregates} returns {@code false}
1456+ * @return the list of results aggregated by this processor
1457+ * (never {@code null} unless {@link #aggregates} returns {@code false})
14551458 * @see #aggregates
14561459 * @since 4.3
14571460 */
0 commit comments