@@ -427,10 +427,10 @@ public static <A extends Annotation> A getMergedAnnotation(AnnotatedElement elem
427427 * single annotation and within annotation hierarchies.
428428 * <p>This method follows <em>get semantics</em> as described in the
429429 * {@linkplain AnnotatedElementUtils class-level javadoc}.
430- * @param element the annotated element; never {@code null}
431- * @param annotationType the annotation type to find; never {@code null}
432- * @return the set of all merged, synthesized {@code Annotations} found, or an empty
433- * set if none were found
430+ * @param element the annotated element ( never {@code null})
431+ * @param annotationType the annotation type to find ( never {@code null})
432+ * @return the set of all merged, synthesized {@code Annotations} found,
433+ * or an empty set if none were found
434434 * @since 4.3
435435 * @see #getMergedAnnotation(AnnotatedElement, Class)
436436 * @see #getAllAnnotationAttributes(AnnotatedElement, String)
@@ -460,10 +460,10 @@ public static <A extends Annotation> Set<A> getAllMergedAnnotations(AnnotatedEle
460460 * single annotation and within annotation hierarchies.
461461 * <p>This method follows <em>get semantics</em> as described in the
462462 * {@linkplain AnnotatedElementUtils class-level javadoc}.
463- * @param element the annotated element; never {@code null}
464- * @param annotationType the annotation type to find; never {@code null}
465- * @return the set of all merged repeatable {@code Annotations} found, or an empty
466- * set if none were found
463+ * @param element the annotated element ( never {@code null})
464+ * @param annotationType the annotation type to find ( never {@code null})
465+ * @return the set of all merged repeatable {@code Annotations} found,
466+ * or an empty set if none were found
467467 * @since 4.3
468468 * @see #getMergedAnnotation(AnnotatedElement, Class)
469469 * @see #getAllMergedAnnotations(AnnotatedElement, Class)
@@ -488,13 +488,13 @@ public static <A extends Annotation> Set<A> getMergedRepeatableAnnotations(Annot
488488 * single annotation and within annotation hierarchies.
489489 * <p>This method follows <em>get semantics</em> as described in the
490490 * {@linkplain AnnotatedElementUtils class-level javadoc}.
491- * @param element the annotated element; never {@code null}
492- * @param annotationType the annotation type to find; never {@code null}
491+ * @param element the annotated element ( never {@code null})
492+ * @param annotationType the annotation type to find ( never {@code null})
493493 * @param containerType the type of the container that holds the annotations;
494494 * may be {@code null} if the container type should be looked up via
495495 * {@link java.lang.annotation.Repeatable}
496- * @return the set of all merged repeatable {@code Annotations} found, or an empty
497- * set if none were found
496+ * @return the set of all merged repeatable {@code Annotations} found,
497+ * or an empty set if none were found
498498 * @since 4.3
499499 * @see #getMergedAnnotation(AnnotatedElement, Class)
500500 * @see #getAllMergedAnnotations(AnnotatedElement, Class)
@@ -724,10 +724,10 @@ public static <A extends Annotation> A findMergedAnnotation(AnnotatedElement ele
724724 * single annotation and within annotation hierarchies.
725725 * <p>This method follows <em>find semantics</em> as described in the
726726 * {@linkplain AnnotatedElementUtils class-level javadoc}.
727- * @param element the annotated element; never {@code null}
728- * @param annotationType the annotation type to find; never {@code null}
729- * @return the set of all merged, synthesized {@code Annotations} found, or an empty
730- * set if none were found
727+ * @param element the annotated element ( never {@code null})
728+ * @param annotationType the annotation type to find ( never {@code null})
729+ * @return the set of all merged, synthesized {@code Annotations} found,
730+ * or an empty set if none were found
731731 * @since 4.3
732732 * @see #findMergedAnnotation(AnnotatedElement, Class)
733733 * @see #getAllMergedAnnotations(AnnotatedElement, Class)
@@ -756,10 +756,10 @@ public static <A extends Annotation> Set<A> findAllMergedAnnotations(AnnotatedEl
756756 * single annotation and within annotation hierarchies.
757757 * <p>This method follows <em>find semantics</em> as described in the
758758 * {@linkplain AnnotatedElementUtils class-level javadoc}.
759- * @param element the annotated element; never {@code null}
760- * @param annotationType the annotation type to find; never {@code null}
761- * @return the set of all merged repeatable {@code Annotations} found, or an empty
762- * set if none were found
759+ * @param element the annotated element ( never {@code null})
760+ * @param annotationType the annotation type to find ( never {@code null})
761+ * @return the set of all merged repeatable {@code Annotations} found,
762+ * or an empty set if none were found
763763 * @since 4.3
764764 * @see #findMergedAnnotation(AnnotatedElement, Class)
765765 * @see #findAllMergedAnnotations(AnnotatedElement, Class)
@@ -784,13 +784,13 @@ public static <A extends Annotation> Set<A> findMergedRepeatableAnnotations(Anno
784784 * single annotation and within annotation hierarchies.
785785 * <p>This method follows <em>find semantics</em> as described in the
786786 * {@linkplain AnnotatedElementUtils class-level javadoc}.
787- * @param element the annotated element; never {@code null}
788- * @param annotationType the annotation type to find; never {@code null}
787+ * @param element the annotated element ( never {@code null})
788+ * @param annotationType the annotation type to find ( never {@code null})
789789 * @param containerType the type of the container that holds the annotations;
790790 * may be {@code null} if the container type should be looked up via
791791 * {@link java.lang.annotation.Repeatable}
792- * @return the set of all merged repeatable {@code Annotations} found, or an empty
793- * set if none were found
792+ * @return the set of all merged repeatable {@code Annotations} found,
793+ * or an empty set if none were found
794794 * @since 4.3
795795 * @see #findMergedAnnotation(AnnotatedElement, Class)
796796 * @see #findAllMergedAnnotations(AnnotatedElement, Class)
@@ -947,9 +947,10 @@ private static <T> T searchWithGetSemanticsInAnnotations(AnnotatedElement elemen
947947
948948 // Search in annotations
949949 for (Annotation annotation : annotations ) {
950- if (!AnnotationUtils .isInJavaLangAnnotationPackage (annotation )) {
951- if (annotation .annotationType () == annotationType ||
952- annotation .annotationType ().getName ().equals (annotationName ) ||
950+ Class <? extends Annotation > currentAnnotationType = annotation .annotationType ();
951+ if (!AnnotationUtils .isInJavaLangAnnotationPackage (currentAnnotationType )) {
952+ if (currentAnnotationType == annotationType ||
953+ currentAnnotationType .getName ().equals (annotationName ) ||
953954 processor .alwaysProcesses ()) {
954955 T result = processor .process (element , annotation , metaDepth );
955956 if (result != null ) {
@@ -962,7 +963,7 @@ private static <T> T searchWithGetSemanticsInAnnotations(AnnotatedElement elemen
962963 }
963964 }
964965 // Repeatable annotations in container?
965- else if (annotation . annotationType () == containerType ) {
966+ else if (currentAnnotationType == containerType ) {
966967 for (Annotation contained : getRawAnnotationsFromContainer (element , annotation )) {
967968 T result = processor .process (element , contained , metaDepth );
968969 if (result != null ) {
@@ -977,8 +978,9 @@ else if (annotation.annotationType() == containerType) {
977978
978979 // Recursively search in meta-annotations
979980 for (Annotation annotation : annotations ) {
980- if (!AnnotationUtils .isInJavaLangAnnotationPackage (annotation )) {
981- T result = searchWithGetSemantics (annotation .annotationType (), annotationType ,
981+ Class <? extends Annotation > currentAnnotationType = annotation .annotationType ();
982+ if (!AnnotationUtils .isInJavaLangAnnotationPackage (currentAnnotationType )) {
983+ T result = searchWithGetSemantics (currentAnnotationType , annotationType ,
982984 annotationName , containerType , processor , visited , metaDepth + 1 );
983985 if (result != null ) {
984986 processor .postProcess (element , annotation , result );
@@ -1051,7 +1053,7 @@ private static <T> T searchWithFindSemantics(AnnotatedElement element, Class<? e
10511053 * have already been <em>visited</em>.
10521054 * <p>The {@code metaDepth} parameter is explained in the
10531055 * {@link Processor#process process()} method of the {@link Processor} API.
1054- * @param element the annotated element; never {@code null}
1056+ * @param element the annotated element ( never {@code null})
10551057 * @param annotationType the annotation type to find
10561058 * @param annotationName the fully qualified class name of the annotation
10571059 * type to find (as an alternative to {@code annotationType})
@@ -1077,11 +1079,11 @@ private static <T> T searchWithFindSemantics(AnnotatedElement element, Class<? e
10771079
10781080 // Search in local annotations
10791081 for (Annotation annotation : annotations ) {
1080- if (! AnnotationUtils . isInJavaLangAnnotationPackage ( annotation )) {
1081- if (annotation . annotationType () == annotationType
1082- || annotation . annotationType (). getName (). equals ( annotationName )
1083- || processor . alwaysProcesses ()) {
1084-
1082+ Class <? extends Annotation > currentAnnotationType = annotation . annotationType ();
1083+ if (! AnnotationUtils . isInJavaLangAnnotationPackage ( currentAnnotationType )) {
1084+ if ( currentAnnotationType == annotationType ||
1085+ currentAnnotationType . getName (). equals ( annotationName ) ||
1086+ processor . alwaysProcesses ()) {
10851087 T result = processor .process (element , annotation , metaDepth );
10861088 if (result != null ) {
10871089 if (processor .aggregates () && metaDepth == 0 ) {
@@ -1093,7 +1095,7 @@ private static <T> T searchWithFindSemantics(AnnotatedElement element, Class<? e
10931095 }
10941096 }
10951097 // Repeatable annotations in container?
1096- else if (annotation . annotationType () == containerType ) {
1098+ else if (currentAnnotationType == containerType ) {
10971099 for (Annotation contained : getRawAnnotationsFromContainer (element , annotation )) {
10981100 T result = processor .process (element , contained , metaDepth );
10991101 if (result != null ) {
@@ -1108,11 +1110,12 @@ else if (annotation.annotationType() == containerType) {
11081110
11091111 // Search in meta annotations on local annotations
11101112 for (Annotation annotation : annotations ) {
1111- if (!AnnotationUtils .isInJavaLangAnnotationPackage (annotation )) {
1112- T result = searchWithFindSemantics (annotation .annotationType (), annotationType , annotationName ,
1113+ Class <? extends Annotation > currentAnnotationType = annotation .annotationType ();
1114+ if (!AnnotationUtils .isInJavaLangAnnotationPackage (currentAnnotationType )) {
1115+ T result = searchWithFindSemantics (currentAnnotationType , annotationType , annotationName ,
11131116 containerType , processor , visited , metaDepth + 1 );
11141117 if (result != null ) {
1115- processor .postProcess (annotation . annotationType () , annotation , result );
1118+ processor .postProcess (currentAnnotationType , annotation , result );
11161119 if (processor .aggregates () && metaDepth == 0 ) {
11171120 aggregatedResults .add (result );
11181121 }
@@ -1252,7 +1255,7 @@ private static <A extends Annotation> A[] getRawAnnotationsFromContainer(Annotat
12521255 * Resolve the container type for the supplied repeatable {@code annotationType}.
12531256 * <p>Delegates to {@link AnnotationUtils#resolveContainerAnnotationType(Class)}.
12541257 * @param annotationType the annotation type to resolve the container for
1255- * @return the container type; never {@code null}
1258+ * @return the container type ( never {@code null})
12561259 * @throws IllegalArgumentException if the container type cannot be resolved
12571260 * @since 4.3
12581261 */
@@ -1403,8 +1406,8 @@ private interface Processor<T> {
14031406 * responsible for asking this processor if it {@link #aggregates} results
14041407 * and then adding the post-processed results to the list returned by this
14051408 * method.
1406- * @return the list of results aggregated by this processor; never
1407- * {@code null} unless {@link #aggregates} returns {@code false}
1409+ * @return the list of results aggregated by this processor
1410+ * (never {@code null} unless {@link #aggregates} returns {@code false})
14081411 * @see #aggregates
14091412 * @since 4.3
14101413 */
0 commit comments