mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8187826: Avoid using reflection to bootstrap NamedFunctions
Reviewed-by: psandoz
This commit is contained in:
parent
2e46c1508a
commit
0355224df8
3 changed files with 48 additions and 36 deletions
|
@ -28,6 +28,7 @@ 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.*;
|
||||
|
||||
/**
|
||||
|
@ -158,8 +159,11 @@ abstract class DelegatingMethodHandle extends MethodHandle {
|
|||
static final NamedFunction NF_getTarget;
|
||||
static {
|
||||
try {
|
||||
NF_getTarget = new NamedFunction(DelegatingMethodHandle.class
|
||||
.getDeclaredMethod("getTarget"));
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue