RFR: 8332586: Avoid cloning empty arrays in java.lang.reflect.{Method,Constructor}

Chen Liang liach at openjdk.org
Thu May 30 19:30:14 UTC 2024


On Wed, 22 May 2024 12:58:40 GMT, jengebr <duke at openjdk.org> wrote:

>> Can't this be used by class cloning interfaces too?
>
> @liach I see such an opportunity in `Proxy.getProxyConstructor`, is that what you have in mind?

No, I mean here: https://github.com/openjdk/jdk/blob/4f1a10f84bcfadef263a0890b6834ccd3d5bb52f/src/java.base/share/classes/java/lang/Class.java#L1329

(That's also why I suggest putting the utiltiy method in ReflectionFactory instead of AccessibleObject or Executable)

`Proxy` is meaningless with an empty list of interfaces, as it's solely for implementing interfaces and delegating method calls to the given InvocationHandler. So I would ignore that scenario.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19327#discussion_r1609992490


More information about the core-libs-dev mailing list