Skip to content

Regression: AnnotationMetadataReadingVisitor doesn't consider annotation method returning classes (SPR-5477) [SPR-5827] #10497

@spring-projects-issues

Description

@spring-projects-issues

Tuomas Kiviaho opened SPR-5827 and commented

AnnotationAttributesReadingVisitor doesn't convert ASM Type to Class as it used to in 3.0.0M2 after #10150 fix. Annotation attributes returning classes (such as javax.xml.bind.annotation.XmlType#factoryClass) do not function anymore as they used to because revision from AnnotationMetadataReadingVisitor:1033 to AnnotationAttributesReadingVisitor:1061 left (intentionally?) classLoader part behind.

AnnotationMetadataReadingVisitor 1033

76 public void visit(String name, Object value) {
77 // Explicitly defined annotation attribute value.
78 Object valueToUse = value;
79 if (value instanceof Type) {
80 try {
81 valueToUse = classLoader.loadClass(((Type) value).getClassName());
82 }
83 catch (ClassNotFoundException ex) {
84 // Class not found - can't resolve class reference in annotation attribute.
85 }
86 }
87 attributes.put(name, valueToUse);
88 }

AnnotationAttributesReadingVisitor:1061

64 public void visit(String name, Object value) {
65 Object valueToUse = value;
66 if (valueToUse instanceof Type) {
67 valueToUse = ((Type) value).getClassName();
68 }
69 this.attributes.put(name, valueToUse);
70 }

What makes the change interesting visitEnum() that still uses the classLoader in similar manner what visit() did.


Affects: 3.0 M3

Issue Links:

Referenced from: commits a06adf7, bbd7fb3

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions