AnnotationMetadata.getAnnotationAttributes inconsistency for empty array in ASM implementation [SPR-17347] #21881
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
LutherWest opened SPR-17347 and commented
Different implementations of
AnnotationMetadata
provides different annotation attributes. Currently, it makesImportBeanDefinitionRegistrar
inconsistent due to providedAnnotationMetadata
inregisterBeanDefinitions(...)
method.For the test case below,
StandardAnnotationMetadata
will return an emptyString
array (as expected). ButAnnotationMetadataReadingVisitor
will returnHello world!
.Please, consider the following test case:
A bit more details, which I can found:
https://github.com/spring-projects/spring-framework/blob/master/spring-core/src/main/java/org/springframework/core/type/classreading/RecursiveAnnotationAttributesVisitor.java#L46
This line will trigger registration of default values for annotation.
For given test case, explicitly specified empty array will be treated as absence of value (associated AnnotationAttributes object won't contain 'arrayProperty' value) and default one will be picked up.
Finally
Is it expected behavior?
Affects: 5.0.7
Issue Links:
@Nullable
Referenced from: commits 5343076, 83909e6
Backported to: 5.0.10
The text was updated successfully, but these errors were encountered: