Honor default values for implicit aliases in composed annotations

Spring Framework 5.2 introduced a regression for implicit aliases
declared via @AliasFor. Specifically, Spring's merged annotation
algorithms stopped honoring default values for implicit alias pairs if
the composed annotation was used without specifying the aliased
attributes.

This commit fixes this regression.

Closes gh-24110
This commit is contained in:
wanxiangming1994
2019-12-01 20:22:41 +08:00
committed by Sam Brannen
parent 1bff7ce141
commit 6f15f32be3
2 changed files with 6 additions and 3 deletions

View File

@@ -368,13 +368,13 @@ class AnnotationTypeMappingsTests {
}
@Test
void resolveMirrorsWhenOnlyHasDefaultValuesResolvesNone() {
void resolveMirrorsWhenOnlyHasDefaultValuesUsesFirst() {
AnnotationTypeMapping mapping = AnnotationTypeMappings.forAnnotationType(
AliasPair.class).get(0);
Method[] resolved = resolveMirrorSets(mapping, WithDefaultValueAliasPair.class,
AliasPair.class);
assertThat(resolved[0]).isNull();
assertThat(resolved[1]).isNull();
assertThat(resolved[0].getName()).isEqualTo("a");
assertThat(resolved[1].getName()).isEqualTo("a");
}
@Test