Skip to content

Commit c9cd53f

Browse files
committed
Revert "Deprecate "enclosing classes" search strategy for MergedAnnotations"
This reverts commit 5689395. See gh-28079
1 parent c462fe3 commit c9cd53f

File tree

4 files changed

+2
-12
lines changed

4 files changed

+2
-12
lines changed

spring-core/src/main/java/org/springframework/core/annotation/AnnotationsScanner.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -92,7 +92,6 @@ private static <C, R> R process(C context, AnnotatedElement source,
9292
}
9393

9494
@Nullable
95-
@SuppressWarnings("deprecation")
9695
private static <C, R> R processClass(C context, Class<?> source,
9796
SearchStrategy searchStrategy, AnnotationsProcessor<C, R> processor) {
9897

@@ -236,7 +235,6 @@ private static <C, R> R processClassHierarchy(C context, int[] aggregateIndex, C
236235
}
237236

238237
@Nullable
239-
@SuppressWarnings("deprecation")
240238
private static <C, R> R processMethod(C context, Method source,
241239
SearchStrategy searchStrategy, AnnotationsProcessor<C, R> processor) {
242240

@@ -512,7 +510,6 @@ static boolean hasPlainJavaAnnotationsOnly(Class<?> type) {
512510
return (type.getName().startsWith("java.") || type == Ordered.class);
513511
}
514512

515-
@SuppressWarnings("deprecation")
516513
private static boolean isWithoutHierarchy(AnnotatedElement source, SearchStrategy searchStrategy) {
517514
if (source == Object.class) {
518515
return true;

spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotations.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,7 @@ enum SearchStrategy {
482482
* need to be meta-annotated with {@link Inherited @Inherited}. When
483483
* searching a {@link Method} source, this strategy is identical to
484484
* {@link #TYPE_HIERARCHY}.
485-
* @deprecated as of Spring Framework 5.3.17; to be removed in Spring Framework 6.0
486485
*/
487-
@Deprecated
488486
TYPE_HIERARCHY_AND_ENCLOSING_CLASSES
489487
}
490488

spring-core/src/test/java/org/springframework/core/annotation/AnnotationsScannerTests.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -421,23 +421,20 @@ void typeHierarchyStrategyOnMethodWithGenericParameterNonOverrideScansAnnotation
421421
}
422422

423423
@Test
424-
@SuppressWarnings("deprecation")
425424
void typeHierarchyWithEnclosedStrategyOnEnclosedStaticClassScansAnnotations() {
426425
Class<?> source = AnnotationEnclosingClassSample.EnclosedStatic.EnclosedStaticStatic.class;
427426
assertThat(scan(source, SearchStrategy.TYPE_HIERARCHY_AND_ENCLOSING_CLASSES))
428427
.containsExactly("0:EnclosedThree", "1:EnclosedTwo", "2:EnclosedOne");
429428
}
430429

431430
@Test
432-
@SuppressWarnings("deprecation")
433431
void typeHierarchyWithEnclosedStrategyOnEnclosedInnerClassScansAnnotations() {
434432
Class<?> source = AnnotationEnclosingClassSample.EnclosedInner.EnclosedInnerInner.class;
435433
assertThat(scan(source, SearchStrategy.TYPE_HIERARCHY_AND_ENCLOSING_CLASSES))
436434
.containsExactly("0:EnclosedThree", "1:EnclosedTwo", "2:EnclosedOne");
437435
}
438436

439437
@Test
440-
@SuppressWarnings("deprecation")
441438
void typeHierarchyWithEnclosedStrategyOnMethodHierarchyUsesTypeHierarchyScan() {
442439
Method source = methodFrom(WithHierarchy.class);
443440
assertThat(scan(source, SearchStrategy.TYPE_HIERARCHY_AND_ENCLOSING_CLASSES)).containsExactly(

spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,15 +712,13 @@ void streamTypeHierarchyFromClassWithInterface() throws Exception {
712712
}
713713

714714
@Test
715-
@SuppressWarnings("deprecation")
716715
void streamTypeHierarchyAndEnclosingClassesFromNonAnnotatedInnerClassWithAnnotatedEnclosingClass() {
717716
Stream<Class<?>> classes = MergedAnnotations.from(AnnotatedClass.NonAnnotatedInnerClass.class,
718717
SearchStrategy.TYPE_HIERARCHY_AND_ENCLOSING_CLASSES).stream().map(MergedAnnotation::getType);
719718
assertThat(classes).containsExactly(Component.class, Indexed.class);
720719
}
721720

722721
@Test
723-
@SuppressWarnings("deprecation")
724722
void streamTypeHierarchyAndEnclosingClassesFromNonAnnotatedStaticNestedClassWithAnnotatedEnclosingClass() {
725723
Stream<Class<?>> classes = MergedAnnotations.from(AnnotatedClass.NonAnnotatedStaticNestedClass.class,
726724
SearchStrategy.TYPE_HIERARCHY_AND_ENCLOSING_CLASSES).stream().map(MergedAnnotation::getType);

0 commit comments

Comments
 (0)