From 718ef42d68acbdc9f62799d2e3762bd4d4361a04 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 26 May 2022 20:53:55 -0700 Subject: [PATCH] Exclude @Reflective from @AliasFor collection Update `RuntimeHintsUtils` to skip `@Reflective` annotations when checking for `@AliasFor`. Since the `@Reflective` annotation is only used at AOT processing time, we shouldn't need a hint for it. See gh-28528 --- .../springframework/aot/hint/support/RuntimeHintsUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-core/src/main/java/org/springframework/aot/hint/support/RuntimeHintsUtils.java b/spring-core/src/main/java/org/springframework/aot/hint/support/RuntimeHintsUtils.java index 3a0e3239948..538381f13e6 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/support/RuntimeHintsUtils.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/support/RuntimeHintsUtils.java @@ -27,6 +27,7 @@ import org.springframework.aot.hint.MemberCategory; import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.TypeHint; import org.springframework.aot.hint.TypeHint.Builder; +import org.springframework.aot.hint.annotation.Reflective; import org.springframework.core.annotation.AliasFor; import org.springframework.core.annotation.MergedAnnotations; import org.springframework.core.annotation.SynthesizedAnnotation; @@ -66,7 +67,7 @@ public abstract class RuntimeHintsUtils { } private static void collectAliasedAnnotations(Set> seen, Set> types, Class annotationType) { - if (seen.contains(annotationType)) { + if (seen.contains(annotationType) || Reflective.class.equals(annotationType)) { return; } seen.add(annotationType);