On Thu, 6 Apr 2023 17:56:23 GMT, Mandy Chung <mch...@openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line >> 213: >> >>> 211: .defineClassAsLookup(true, List.of(mhs)); >>> 212: proxy = lookup.findConstructor(lookup.lookupClass(), >>> methodType(void.class)) >>> 213: .asType(methodType(Object.class)).invokeExact(); >> >> This can use `invoke` instead of an explicit `asType` and `invokeExact`. It >> is more or less the same. >> Suggestion: >> >> proxy = lookup.findConstructor(lookup.lookupClass(), >> methodType(void.class)).invoke(); > > @JornVernee Is there any performance difference with `invokeExact` vs > `invoke`? I have the impression there is. It only matters when we get to C2 compilation for a constant method handle instance being called, which is not the case here. `invoke` is just a nice shorthand for doing an inexact call. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13197#discussion_r1160263910