-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
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:
- Component scanning doesn't find enums in annotations [SPR-5479] #10152 Component scanning doesn't find enums in annotations
- AnnotationMetadataReadingVisitor doesn't consider annotation method returning classes [SPR-5477] #10150 AnnotationMetadataReadingVisitor doesn't consider annotation method returning classes