Ensure meta-annotations are not unnecessarily synthesized
Prior to this commit, meta-annotations were unnecessarily synthesized when attempting to synthesize a MergedAnnotation retrieved via the MergedAnnotations.from(AnnotatedElement, ...).get(<annotationType>) API. This is a regression in our merged annotation support that was introduced when the MergedAnnotations API replaced our previous support. This commit fixes this by revising the logic in TypeMappedAnnotation's createSynthesizedAnnotation() method so that a meta-annotation is returned unmodified if it is not synthesizable. This commit also updates BootstrapUtilsTests, since @BootstrapWith should never have been synthesized, and Class#getCanonicalName() is only used in the toString() implementation of an annotation synthesized by Spring or normal annotations on Java 19+ (see https://bugs.openjdk.org/browse/JDK-8281462). Closes gh-28704
This commit is contained in:
@@ -73,8 +73,8 @@ class BootstrapUtilsTests {
|
||||
assertThatIllegalStateException()
|
||||
.isThrownBy(() -> resolveTestContextBootstrapper(bootstrapContext))
|
||||
.withMessageContaining("Configuration error: found multiple declarations of @BootstrapWith")
|
||||
.withMessageContaining(FooBootstrapper.class.getCanonicalName())
|
||||
.withMessageContaining(BarBootstrapper.class.getCanonicalName());
|
||||
.withMessageContaining(FooBootstrapper.class.getSimpleName())
|
||||
.withMessageContaining(BarBootstrapper.class.getSimpleName());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user