On Wed, 22 May 2024 13:44:59 GMT, Chen Liang <li...@openjdk.org> wrote:
>> @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. Thanks. Unfortunately the variable `cloneArray` is actually a method parameter, and most of the callers pass in `false` - so using this utility method to control cloning would actually introduce cloning in several places where it is explicitly avoided. We may get a performance gain by modifying `Class.getInterfaces()` directly (the sole caller that passes `true`) then eliminating the parameter, then modifying each caller, etc. but that feels like a separate change inspired by this one. Thoughts? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19327#discussion_r1610079752