Skip to content

Commit de17a3b

Browse files
committed
fixed ConstantPoolBuilder::methodHandleEntry
1 parent b547682 commit de17a3b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/java.base/share/classes/jdk/classfile/constantpool/ConstantPoolBuilder.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,13 @@ default InterfaceMethodRefEntry interfaceMethodRefEntry(ClassDesc owner, String
346346
* @param descriptor the symbolic descriptor of the method handle
347347
*/
348348
default MethodHandleEntry methodHandleEntry(DirectMethodHandleDesc descriptor) {
349-
return methodHandleEntry(descriptor.refKind(), methodRefEntry(descriptor.owner(), descriptor.methodName(), descriptor.invocationType()));
349+
var owner = classEntry(descriptor.owner());
350+
var nat = natEntry(utf8Entry(descriptor.methodName()), utf8Entry(descriptor.lookupDescriptor()));
351+
return methodHandleEntry(descriptor.refKind(), switch (descriptor.kind()) {
352+
case GETTER, SETTER, STATIC_GETTER, STATIC_SETTER -> fieldRefEntry(owner, nat);
353+
case INTERFACE_STATIC, INTERFACE_VIRTUAL, INTERFACE_SPECIAL -> interfaceMethodRefEntry(owner, nat);
354+
case STATIC, VIRTUAL, SPECIAL, CONSTRUCTOR -> methodRefEntry(owner, nat);
355+
});
350356
}
351357

352358
/**

0 commit comments

Comments
 (0)