< prev index next >

src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java

Print this page
rev 47249 : 8187826: Avoid using reflection to bootstrap NamedFunctions
Reviewed-by: TBD

*** 26,35 **** --- 26,36 ---- package java.lang.invoke; import java.util.Arrays; import static java.lang.invoke.LambdaForm.*; import static java.lang.invoke.LambdaForm.Kind.*; + import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeVirtual; import static java.lang.invoke.MethodHandleStatics.*; /** * A method handle whose invocation behavior is determined by a target. * The delegating MH itself can hold extra "intentions" beyond the simple behavior.
*** 156,167 **** } static final NamedFunction NF_getTarget; static { try { ! NF_getTarget = new NamedFunction(DelegatingMethodHandle.class ! .getDeclaredMethod("getTarget")); } catch (ReflectiveOperationException ex) { throw newInternalError(ex); } // The Holder class will contain pre-generated DelegatingMethodHandles resolved // speculatively using MemberName.getFactory().resolveOrNull. However, that --- 157,171 ---- } static final NamedFunction NF_getTarget; static { try { ! MemberName member = new MemberName(DelegatingMethodHandle.class, "getTarget", ! MethodType.methodType(MethodHandle.class), REF_invokeVirtual); ! NF_getTarget = new NamedFunction( ! MemberName.getFactory() ! .resolveOrFail(REF_invokeVirtual, member, DelegatingMethodHandle.class, NoSuchMethodException.class)); } catch (ReflectiveOperationException ex) { throw newInternalError(ex); } // The Holder class will contain pre-generated DelegatingMethodHandles resolved // speculatively using MemberName.getFactory().resolveOrNull. However, that
< prev index next >