-
Bug
-
Resolution: Fixed
-
P4
-
7
-
b82
-
x86
-
linux
The method MethodHandleNatives.getMethodName:
static MemberName getMethodName(MethodHandle self) { ... }
takes a method handle and returns a MemberName describing it. A MemberName should encode enough information to nominally recreate the method handle via Lookup.find{Virtual,Static,Constructor}, LDC, or reflection.
If you create a method handle with Lookup.findConstructor:
MethodHandle mh = MethodHandles.lookup().findConstructor(String.class,
MethodType.methodType(void.class, char[].class));
MemberName mn = MethodHandleNatives.getMethodName(mh);
you would expect the following results:
mn.getName() => <init>
mn.getDeclaringClass() => String.class
mh.getMethodType() => (char[])String or (char[])V
mh.isConstructor => true
Instead, you get the following results:
mn.getName() => identity
mn.getDeclaringClass() => com.sun.invoke.util.ValueConversions
mh.getMethodType() => (Object)Object
mh.isConstructor => false
static MemberName getMethodName(MethodHandle self) { ... }
takes a method handle and returns a MemberName describing it. A MemberName should encode enough information to nominally recreate the method handle via Lookup.find{Virtual,Static,Constructor}, LDC, or reflection.
If you create a method handle with Lookup.findConstructor:
MethodHandle mh = MethodHandles.lookup().findConstructor(String.class,
MethodType.methodType(void.class, char[].class));
MemberName mn = MethodHandleNatives.getMethodName(mh);
you would expect the following results:
mn.getName() => <init>
mn.getDeclaringClass() => String.class
mh.getMethodType() => (char[])String or (char[])V
mh.isConstructor => true
Instead, you get the following results:
mn.getName() => identity
mn.getDeclaringClass() => com.sun.invoke.util.ValueConversions
mh.getMethodType() => (Object)Object
mh.isConstructor => false
- duplicates
-
JDK-8005119 MethodHandleInfo reports refKind as invokespecial instead of invokevirtual for some method handles
-
- Closed
-