Skip to content

AnnotatedElementUtils.getMergedAnnotation does not merge deep value attributes correctly #22703

Closed
@philwebb

Description

@philwebb

Most likely related to the fix for #22654 we have another subtle regression when dealing with value attributes on meta meta-annotations.

The following test passes with 5.1 but fails with 5.2

@Test
public void testName() {
	ValueAttribute annotation = AnnotatedElementUtils
			.getMergedAnnotation(AnotherConfig.class, ValueAttribute.class);
	assertThat(annotation.value()).containsExactly("FromAliasedValueAttributeMeta");
}

@Retention(RetentionPolicy.RUNTIME)
static @interface ValueAttribute {

	String[] value();

}

@Retention(RetentionPolicy.RUNTIME)
@ValueAttribute("FromAliasedValueAttributeMeta")
static @interface AliasedValueAttributeMeta {

	@AliasFor("alias")
	String[] value() default {};

	@AliasFor("value")
	String[] alias() default {};

}

@Retention(RetentionPolicy.RUNTIME)
@AliasedValueAttributeMeta("FromAliasedValueAttributeMetaMeta")
static @interface AliasedValueAttributeMetaMeta {

}

@AliasedValueAttributeMetaMeta
static class AnotherConfig {

}

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions