Defensively copy array returned from TypeDescriptor
Update the internal proxy used in `TypeDescriptor` so that it returns a cloned array for calls to `getDeclaredAnnotations` or `getAnnotations`. Closes gh-22695
This commit is contained in:
@@ -765,7 +765,7 @@ public class TypeDescriptor implements Serializable {
|
||||
|
||||
@Override
|
||||
public Annotation[] getAnnotations() {
|
||||
return (this.annotations != null ? this.annotations : EMPTY_ANNOTATION_ARRAY);
|
||||
return (this.annotations != null ? this.annotations.clone() : EMPTY_ANNOTATION_ARRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user