On Thu, 10 Jun 2021 23:26:21 GMT, Vicente Romero <vrom...@openjdk.org> wrote:

>> Please review this PR which is just syncing the implementation of 
>> DirectMethodHandleDesc.Kind.valueOf(int) with its spec. My reading of the 
>> method's spec is that if the value of the `refKind` parameter is: 
>> MethodHandleInfo.REF_invokeInterface, then 
>> DirectMethodHandleDesc.Kind.valueOf(int, boolean) should be called with a 
>> value of `true` for its second argument, currently it is invoked with 
>> `false` regardless of the value of the `refKind` parameter
>> 
>> TIA
>
> Vicente Romero has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   addressing review changes

src/java.base/share/classes/java/lang/constant/DirectMethodHandleDesc.java line 
143:

> 141:                 }
> 142:                 if (kind.refKind == refKind &&
> 143:                         (refKind != REF_invokeStatic || refKind != 
> REF_invokeSpecial || kind.isInterface == isInterface)){

It reads to me that the static initializer tries to set up the table such that 
`valueOf(refKind, isInterface)` should find the proper kind to return except 
this:

// There is not a specific Kind for interfaces
if (kind == VIRTUAL) kind = INTERFACE_VIRTUAL;

This changes the entry for `REF_invokeVirtual` to kind `INTERFACE_VIRTUAL`.  Do 
you know why?    If this entry is set to VIRTUAL, then each refKind has two 
entries in the table corresponding to the correct result for `valueOf`.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4416

Reply via email to