mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:30:28 +00:00
Avoid retaining class files in annotation metadata
ClassFileAnnotationDelegate passed the raw java.lang.classfile Annotation to MergedAnnotation.of() as the annotation source. That annotation holds a Utf8Entry, so retaining the metadata of an annotated class also retained its class file byte[], the parsed constant pool, and the class model. Store the declaring class name instead, as the ASM variant does. See gh-37111 Signed-off-by: Boris Perović <boris.perovic@sysdig.com>
This commit is contained in:
committed by
Brian Clozel
parent
0c281fd1ce
commit
b556766e1a
+2
-2
@@ -76,7 +76,7 @@ abstract class ClassFileAnnotationDelegate {
|
||||
}
|
||||
}
|
||||
Map<String, Object> compactedAttributes = (attributes.isEmpty() ? Collections.emptyMap() : attributes);
|
||||
return MergedAnnotation.of(classLoader, new Source(annotation), annotationType, compactedAttributes);
|
||||
return MergedAnnotation.of(classLoader, new Source(className), annotationType, compactedAttributes);
|
||||
}
|
||||
catch (ClassNotFoundException | LinkageError ex) {
|
||||
// Non-loadable annotation type -> ignore.
|
||||
@@ -146,7 +146,7 @@ abstract class ClassFileAnnotationDelegate {
|
||||
}
|
||||
|
||||
|
||||
record Source(Annotation annotation) {
|
||||
record Source(String className) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user