Details
-
Enhancement
-
Resolution: Fixed
-
P4
-
17, 21, 22, 23
Description
In `Method` and `Constructor`, we have two methods that clone the relevant arrays before returning them to external code:
/**
* {@inheritDoc}
*/
@Override
public Class<?>[] getParameterTypes() {
return parameterTypes.clone();
}
/**
* {@inheritDoc}
*/
@Override
public Class<?>[] getExceptionTypes() {
return exceptionTypes.clone();
}
Frequently, those are empty arrays, and we do not really need to clone them. Note thatJDK-8177107 did a related thing in shared parts: it would effectively populate these fields with a singleton empty class array.
/**
* {@inheritDoc}
*/
@Override
public Class<?>[] getParameterTypes() {
return parameterTypes.clone();
}
/**
* {@inheritDoc}
*/
@Override
public Class<?>[] getExceptionTypes() {
return exceptionTypes.clone();
}
Frequently, those are empty arrays, and we do not really need to clone them. Note that
Attachments
Issue Links
- relates to
-
JDK-8177107 Reduce memory footprint of java.lang.reflect.Constructor/Method
- Resolved