@@ -193,6 +193,7 @@ public static <T extends Annotation> Set<T> getMergedRepeatableAnnotations(
193
193
public static <T extends Annotation > AnnotationDescriptor <T > findAnnotationDescriptor (
194
194
Class <?> clazz , Class <T > annotationType ) {
195
195
196
+ Assert .notNull (annotationType , "Annotation type must not be null" );
196
197
return findAnnotationDescriptor (clazz , annotationType , TestContextAnnotationUtils ::searchEnclosingClass ,
197
198
new HashSet <>());
198
199
}
@@ -214,7 +215,6 @@ private static <T extends Annotation> AnnotationDescriptor<T> findAnnotationDesc
214
215
@ Nullable Class <?> clazz , Class <T > annotationType , Predicate <Class <?>> searchEnclosingClass ,
215
216
Set <Annotation > visited ) {
216
217
217
- Assert .notNull (annotationType , "Annotation type must not be null" );
218
218
if (clazz == null || Object .class == clazz ) {
219
219
return null ;
220
220
}
@@ -515,7 +515,7 @@ public Class<?> getDeclaringClass() {
515
515
return this .declaringClass ;
516
516
}
517
517
518
- public T getAnnotation () {
518
+ T getAnnotation () {
519
519
return this .annotation ;
520
520
}
521
521
@@ -533,21 +533,21 @@ public T synthesizeAnnotation() {
533
533
}
534
534
535
535
@ SuppressWarnings ("unchecked" )
536
- public Class <T > getAnnotationType () {
536
+ Class <T > getAnnotationType () {
537
537
return (Class <T >) this .annotation .annotationType ();
538
538
}
539
539
540
- public AnnotationAttributes getAnnotationAttributes () {
540
+ AnnotationAttributes getAnnotationAttributes () {
541
541
return this .annotationAttributes ;
542
542
}
543
543
544
544
@ Nullable
545
- public Annotation getComposedAnnotation () {
545
+ Annotation getComposedAnnotation () {
546
546
return this .composedAnnotation ;
547
547
}
548
548
549
549
@ Nullable
550
- public Class <? extends Annotation > getComposedAnnotationType () {
550
+ Class <? extends Annotation > getComposedAnnotationType () {
551
551
return (this .composedAnnotation != null ? this .composedAnnotation .annotationType () : null );
552
552
}
553
553
@@ -633,16 +633,6 @@ public static class UntypedAnnotationDescriptor extends AnnotationDescriptor<Ann
633
633
this .annotationTypes = annotationTypes ;
634
634
}
635
635
636
- /**
637
- * Throws an {@link UnsupportedOperationException} since the type of annotation
638
- * represented by an {@code UntypedAnnotationDescriptor} is unknown.
639
- */
640
- @ Override
641
- public Annotation synthesizeAnnotation () {
642
- throw new UnsupportedOperationException (
643
- "synthesizeAnnotation() is unsupported in UntypedAnnotationDescriptor" );
644
- }
645
-
646
636
/**
647
637
* Find the next {@link UntypedAnnotationDescriptor} for the specified
648
638
* annotation types in the hierarchy above the
0 commit comments