Re-introduce support for annotation declarations with self references

Closes gh-31400
This commit is contained in:
Juergen Hoeller
2023-10-10 21:54:58 +02:00
parent 00d4830e5c
commit 5459304a4b
4 changed files with 152 additions and 3 deletions

View File

@@ -45,6 +45,7 @@ import org.springframework.util.StringUtils;
*
* @author Phillip Webb
* @author Sam Brannen
* @author Juergen Hoeller
* @since 5.2
* @see AnnotationTypeMappings
*/
@@ -402,9 +403,11 @@ final class AnnotationTypeMapping {
if (type.isAnnotation() || (type.isArray() && type.getComponentType().isAnnotation())) {
Class<? extends Annotation> annotationType =
(Class<? extends Annotation>) (type.isAnnotation() ? type : type.getComponentType());
AnnotationTypeMapping mapping = AnnotationTypeMappings.forAnnotationType(annotationType).get(0);
if (mapping.isSynthesizable()) {
return true;
if (annotationType != this.annotationType) {
AnnotationTypeMapping mapping = AnnotationTypeMappings.forAnnotationType(annotationType).get(0);
if (mapping.isSynthesizable()) {
return true;
}
}
}
}