From a55b50b512fb8a849d283e8eeeec8a99c861263e Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 22 Aug 2023 14:58:19 +0200 Subject: [PATCH] Simplify implementation of AnnotationMetadata.getMetaAnnotationTypes() Since an annotation cannot be extended in Java, there is no need to use the INHERITED_ANNOTATIONS SearchStrategy to search for meta-annotations on an annotation. --- .../java/org/springframework/core/type/AnnotationMetadata.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/type/AnnotationMetadata.java b/spring-core/src/main/java/org/springframework/core/type/AnnotationMetadata.java index 7658126b514..532630a76b0 100644 --- a/spring-core/src/main/java/org/springframework/core/type/AnnotationMetadata.java +++ b/spring-core/src/main/java/org/springframework/core/type/AnnotationMetadata.java @@ -23,7 +23,6 @@ import java.util.stream.Collectors; import org.springframework.core.annotation.MergedAnnotation; import org.springframework.core.annotation.MergedAnnotations; -import org.springframework.core.annotation.MergedAnnotations.SearchStrategy; /** * Interface that defines abstract access to the annotations of a specific @@ -64,7 +63,7 @@ public interface AnnotationMetadata extends ClassMetadata, AnnotatedTypeMetadata if (!annotation.isPresent()) { return Collections.emptySet(); } - return MergedAnnotations.from(annotation.getType(), SearchStrategy.INHERITED_ANNOTATIONS).stream() + return MergedAnnotations.from(annotation.getType()).stream() .map(mergedAnnotation -> mergedAnnotation.getType().getName()) .collect(Collectors.toCollection(LinkedHashSet::new)); }