RFR: JDK-8177107: Reduce memory footprint of java.lang.reflect.Constructor/Method
Claes Redestad
redestad at openjdk.java.net
Thu Mar 3 14:08:02 UTC 2022
On Wed, 2 Mar 2022 20:28:45 GMT, Joe Darcy <darcy at openjdk.org> wrote:
> Refactoring of Method and Constructor to share a single empty array for parameters and exceptions as well as type variables.
>
> Existing core reflection regression tests pass with the change.
src/java.base/share/classes/java/lang/reflect/Executable.java line 61:
> 59: static final TypeVariable[] NO_TYPE_VARS = new TypeVariable[0];
> 60:
> 61: static final Class<?>[] NO_TYPES = new Class<?>[0];
Less concerning since it doesn't add extra classloading, but I note that we have similar constants in a few places, including `j.l.Class.EMPTY_CLASS_ARRAY` and `j.l.r.ProxyGenerator.EMPTY_CLASS_ARRAY`. Perhaps would make sense to consolidate these into a single place/instance (and use consistent names)
-------------
PR: https://git.openjdk.java.net/jdk/pull/7667
More information about the core-libs-dev
mailing list