@@ -445,10 +445,10 @@ public static <A extends Annotation> A getMergedAnnotation(AnnotatedElement elem
445
445
* single annotation and within annotation hierarchies.
446
446
* <p>This method follows <em>get semantics</em> as described in the
447
447
* {@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
452
452
* @since 4.3
453
453
* @see #getMergedAnnotation(AnnotatedElement, Class)
454
454
* @see #getAllAnnotationAttributes(AnnotatedElement, String)
@@ -478,10 +478,10 @@ public static <A extends Annotation> Set<A> getAllMergedAnnotations(AnnotatedEle
478
478
* single annotation and within annotation hierarchies.
479
479
* <p>This method follows <em>get semantics</em> as described in the
480
480
* {@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
485
485
* @since 4.3
486
486
* @see #getMergedAnnotation(AnnotatedElement, Class)
487
487
* @see #getAllMergedAnnotations(AnnotatedElement, Class)
@@ -506,13 +506,13 @@ public static <A extends Annotation> Set<A> getMergedRepeatableAnnotations(Annot
506
506
* single annotation and within annotation hierarchies.
507
507
* <p>This method follows <em>get semantics</em> as described in the
508
508
* {@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})
511
511
* @param containerType the type of the container that holds the annotations;
512
512
* may be {@code null} if the container type should be looked up via
513
513
* {@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
516
516
* @since 4.3
517
517
* @see #getMergedAnnotation(AnnotatedElement, Class)
518
518
* @see #getAllMergedAnnotations(AnnotatedElement, Class)
@@ -771,10 +771,10 @@ public static <A extends Annotation> A findMergedAnnotation(AnnotatedElement ele
771
771
* single annotation and within annotation hierarchies.
772
772
* <p>This method follows <em>find semantics</em> as described in the
773
773
* {@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
778
778
* @since 4.3
779
779
* @see #findMergedAnnotation(AnnotatedElement, Class)
780
780
* @see #getAllMergedAnnotations(AnnotatedElement, Class)
@@ -803,10 +803,10 @@ public static <A extends Annotation> Set<A> findAllMergedAnnotations(AnnotatedEl
803
803
* single annotation and within annotation hierarchies.
804
804
* <p>This method follows <em>find semantics</em> as described in the
805
805
* {@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
810
810
* @since 4.3
811
811
* @see #findMergedAnnotation(AnnotatedElement, Class)
812
812
* @see #findAllMergedAnnotations(AnnotatedElement, Class)
@@ -831,13 +831,13 @@ public static <A extends Annotation> Set<A> findMergedRepeatableAnnotations(Anno
831
831
* single annotation and within annotation hierarchies.
832
832
* <p>This method follows <em>find semantics</em> as described in the
833
833
* {@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})
836
836
* @param containerType the type of the container that holds the annotations;
837
837
* may be {@code null} if the container type should be looked up via
838
838
* {@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
841
841
* @since 4.3
842
842
* @see #findMergedAnnotation(AnnotatedElement, Class)
843
843
* @see #findAllMergedAnnotations(AnnotatedElement, Class)
@@ -994,9 +994,10 @@ private static <T> T searchWithGetSemanticsInAnnotations(AnnotatedElement elemen
994
994
995
995
// Search in annotations
996
996
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 ) ||
1000
1001
processor .alwaysProcesses ()) {
1001
1002
T result = processor .process (element , annotation , metaDepth );
1002
1003
if (result != null ) {
@@ -1009,7 +1010,7 @@ private static <T> T searchWithGetSemanticsInAnnotations(AnnotatedElement elemen
1009
1010
}
1010
1011
}
1011
1012
// Repeatable annotations in container?
1012
- else if (annotation . annotationType () == containerType ) {
1013
+ else if (currentAnnotationType == containerType ) {
1013
1014
for (Annotation contained : getRawAnnotationsFromContainer (element , annotation )) {
1014
1015
T result = processor .process (element , contained , metaDepth );
1015
1016
if (result != null ) {
@@ -1024,8 +1025,9 @@ else if (annotation.annotationType() == containerType) {
1024
1025
1025
1026
// Recursively search in meta-annotations
1026
1027
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 ,
1029
1031
annotationName , containerType , processor , visited , metaDepth + 1 );
1030
1032
if (result != null ) {
1031
1033
processor .postProcess (element , annotation , result );
@@ -1098,7 +1100,7 @@ private static <T> T searchWithFindSemantics(AnnotatedElement element, Class<? e
1098
1100
* have already been <em>visited</em>.
1099
1101
* <p>The {@code metaDepth} parameter is explained in the
1100
1102
* {@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})
1102
1104
* @param annotationType the annotation type to find
1103
1105
* @param annotationName the fully qualified class name of the annotation
1104
1106
* type to find (as an alternative to {@code annotationType})
@@ -1124,11 +1126,11 @@ private static <T> T searchWithFindSemantics(AnnotatedElement element, Class<? e
1124
1126
1125
1127
// Search in local annotations
1126
1128
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 ()) {
1132
1134
T result = processor .process (element , annotation , metaDepth );
1133
1135
if (result != null ) {
1134
1136
if (processor .aggregates () && metaDepth == 0 ) {
@@ -1140,7 +1142,7 @@ private static <T> T searchWithFindSemantics(AnnotatedElement element, Class<? e
1140
1142
}
1141
1143
}
1142
1144
// Repeatable annotations in container?
1143
- else if (annotation . annotationType () == containerType ) {
1145
+ else if (currentAnnotationType == containerType ) {
1144
1146
for (Annotation contained : getRawAnnotationsFromContainer (element , annotation )) {
1145
1147
T result = processor .process (element , contained , metaDepth );
1146
1148
if (result != null ) {
@@ -1155,11 +1157,12 @@ else if (annotation.annotationType() == containerType) {
1155
1157
1156
1158
// Search in meta annotations on local annotations
1157
1159
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 ,
1160
1163
containerType , processor , visited , metaDepth + 1 );
1161
1164
if (result != null ) {
1162
- processor .postProcess (annotation . annotationType () , annotation , result );
1165
+ processor .postProcess (currentAnnotationType , annotation , result );
1163
1166
if (processor .aggregates () && metaDepth == 0 ) {
1164
1167
aggregatedResults .add (result );
1165
1168
}
@@ -1299,7 +1302,7 @@ private static <A extends Annotation> A[] getRawAnnotationsFromContainer(Annotat
1299
1302
* Resolve the container type for the supplied repeatable {@code annotationType}.
1300
1303
* <p>Delegates to {@link AnnotationUtils#resolveContainerAnnotationType(Class)}.
1301
1304
* @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})
1303
1306
* @throws IllegalArgumentException if the container type cannot be resolved
1304
1307
* @since 4.3
1305
1308
*/
@@ -1450,8 +1453,8 @@ private interface Processor<T> {
1450
1453
* responsible for asking this processor if it {@link #aggregates} results
1451
1454
* and then adding the post-processed results to the list returned by this
1452
1455
* 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})
1455
1458
* @see #aggregates
1456
1459
* @since 4.3
1457
1460
*/
0 commit comments