mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 08:24:13 +00:00
In commit622fc3edf7, I introduced a check in TypeMappedAnnotation#isSynthesizable() intended to force synthesis when an attribute value needs to be resolved from a different level of a multi-level annotation hierarchy whose root annotation does not redeclare the target attribute itself. That check tested if `resolvedMirrors.length > 0` for a meta-annotation; however, resolvedMirrors is always sized according to the number of attributes declared by the mapped annotation type, regardless of whether any of those attributes actually participate in mirroring or an @AliasFor override. As a result, the check effectively synthesized any meta-annotation that declares at least one attribute, which reintroduced the unnecessary-synthesis behavior that commitd6768ccc18had fixed, merely narrowed to meta-annotations with attributes. This commit replaces that overly broad check with a precise one in AnnotationTypeMapping#computeSynthesizableFlag(), which now also considers whether any attribute's value must be resolved from a different annotation in the meta-annotation hierarchy (tracked via annotationValueSource). This correctly identifies the original multi-level hierarchy scenario without over-matching on ordinary meta-annotations that have nothing to merge or override. See gh-28704 See gh-28716 Closes gh-37135