Re: [jdk17] RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling [v2]

2021-06-21 Thread Vicente Romero
On Tue, 22 Jun 2021 00:45:36 GMT, Mandy Chung  wrote:

>> Vicente Romero has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   updating after review comments
>
> test/jdk/java/lang/constant/MethodHandleDescTest.java line 379:
> 
>> 377: for (int refKind : isInterfaceIgnored) {
>> 378: assertEquals(Kind.valueOf(refKind, false), 
>> Kind.valueOf(refKind, true));
>> 379: }
> 
> Can you also add the test cases to verify `Kind::valueOf` with 
> `REF_invokeStatic` and `REF_invokeSpecial`?

please see them below, thanks

-

PR: https://git.openjdk.java.net/jdk17/pull/29


Re: [jdk17] RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling [v4]

2021-06-21 Thread Vicente Romero
> This PR is a copy of [PR-4416](https://github.com/openjdk/jdk/pull/4416) 
> which was intended to openjdk/jdk.
> 
> Please review this PR which is syncing the implementation of 
> `DirectMethodHandleDesc.Kind.valueOf(int)` and 
> `DirectMethodHandleDesc.Kind.valueOf(int, boolean)` 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 comments

-

Changes:
  - all: https://git.openjdk.java.net/jdk17/pull/29/files
  - new: https://git.openjdk.java.net/jdk17/pull/29/files/be1a932c..d36a5528

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk17=29=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk17=29=02-03

  Stats: 9 lines in 1 file changed: 8 ins; 1 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk17/pull/29.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/29/head:pull/29

PR: https://git.openjdk.java.net/jdk17/pull/29


Re: [jdk17] RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling [v2]

2021-06-21 Thread Mandy Chung
On Fri, 11 Jun 2021 18:17:10 GMT, Vicente Romero  wrote:

>> This PR is a copy of [PR-4416](https://github.com/openjdk/jdk/pull/4416) 
>> which was intended to openjdk/jdk.
>> 
>> Please review this PR which is syncing the implementation of 
>> `DirectMethodHandleDesc.Kind.valueOf(int)` and 
>> `DirectMethodHandleDesc.Kind.valueOf(int, boolean)` 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:
> 
>   updating after review comments

Marked as reviewed by mchung (Reviewer).

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

> 136: int i = tableIndex(refKind, isInterface);
> 137: if (i >= 2 && i < TABLE.length) {
> 138: return TABLE[i];

This fix looks good.   The resulting `TABLE` has two entries per `refKind` for 
`isInterface` = `true` and `false`.

test/jdk/java/lang/constant/MethodHandleDescTest.java line 379:

> 377: for (int refKind : isInterfaceIgnored) {
> 378: assertEquals(Kind.valueOf(refKind, false), 
> Kind.valueOf(refKind, true));
> 379: }

Can you also add the test cases to verify `Kind::valueOf` with 
`REF_invokeStatic` and `REF_invokeSpecial`?

-

PR: https://git.openjdk.java.net/jdk17/pull/29


Re: [jdk17] RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling [v3]

2021-06-21 Thread Vicente Romero
> This PR is a copy of [PR-4416](https://github.com/openjdk/jdk/pull/4416) 
> which was intended to openjdk/jdk.
> 
> Please review this PR which is syncing the implementation of 
> `DirectMethodHandleDesc.Kind.valueOf(int)` and 
> `DirectMethodHandleDesc.Kind.valueOf(int, boolean)` 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 with a new target base due to a 
merge or a rebase. The incremental webrev excludes the unrelated changes 
brought in by the merge/rebase. The pull request contains three additional 
commits since the last revision:

 - Merge branch 'master' into JDK-8267421
 - updating after review comments
 - 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) 
implementation doesn't conform to the spec regarding REF_invokeInterface 
handling

-

Changes:
  - all: https://git.openjdk.java.net/jdk17/pull/29/files
  - new: https://git.openjdk.java.net/jdk17/pull/29/files/8ed4cdb3..be1a932c

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk17=29=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk17=29=01-02

  Stats: 16865 lines in 275 files changed: 10155 ins; 6060 del; 650 mod
  Patch: https://git.openjdk.java.net/jdk17/pull/29.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/29/head:pull/29

PR: https://git.openjdk.java.net/jdk17/pull/29


Re: [jdk17] RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling [v2]

2021-06-11 Thread Vicente Romero
On Fri, 11 Jun 2021 18:17:10 GMT, Vicente Romero  wrote:

>> This PR is a copy of [PR-4416](https://github.com/openjdk/jdk/pull/4416) 
>> which was intended to openjdk/jdk.
>> 
>> Please review this PR which is syncing the implementation of 
>> `DirectMethodHandleDesc.Kind.valueOf(int)` and 
>> `DirectMethodHandleDesc.Kind.valueOf(int, boolean)` 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:
> 
>   updating after review comments

@mlchung I have uploaded a new commit, thanks for your comments

-

PR: https://git.openjdk.java.net/jdk17/pull/29


Re: [jdk17] RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling [v2]

2021-06-11 Thread Vicente Romero
> This PR is a copy of [PR-4416](https://github.com/openjdk/jdk/pull/4416) 
> which was intended to openjdk/jdk.
> 
> Please review this PR which is syncing the implementation of 
> `DirectMethodHandleDesc.Kind.valueOf(int)` and 
> `DirectMethodHandleDesc.Kind.valueOf(int, boolean)` 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:

  updating after review comments

-

Changes:
  - all: https://git.openjdk.java.net/jdk17/pull/29/files
  - new: https://git.openjdk.java.net/jdk17/pull/29/files/b6b3f87c..8ed4cdb3

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk17=29=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk17=29=00-01

  Stats: 12 lines in 1 file changed: 0 ins; 9 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk17/pull/29.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/29/head:pull/29

PR: https://git.openjdk.java.net/jdk17/pull/29


Re: [jdk17] RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling

2021-06-11 Thread Vicente Romero
On Fri, 11 Jun 2021 15:15:12 GMT, Vicente Romero  wrote:

>> This PR is a copy of [PR-4416](https://github.com/openjdk/jdk/pull/4416) 
>> which was intended to openjdk/jdk.
>> 
>> Please review this PR which is syncing the implementation of 
>> `DirectMethodHandleDesc.Kind.valueOf(int)` and 
>> `DirectMethodHandleDesc.Kind.valueOf(int, boolean)` 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
>
> 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)){
> 
> @mlchung 13 hours ago Member
> 
> 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.

this is the table that is being generated right now:

Table has 20 entries
0: null
1: null
2: Kind: [name: GETTER, refKind: 1, isInterface: false]
3: Kind: [name: GETTER, refKind: 1, isInterface: false]
4: Kind: [name: STATIC_GETTER, refKind: 2, isInterface: false]
5: Kind: [name: STATIC_GETTER, refKind: 2, isInterface: false]
6: Kind: [name: SETTER, refKind: 3, isInterface: false]
7: Kind: [name: SETTER, refKind: 3, isInterface: false]
8: Kind: [name: STATIC_SETTER, refKind: 4, isInterface: false]
9: Kind: [name: STATIC_SETTER, refKind: 4, isInterface: false]
10: Kind: [name: VIRTUAL, refKind: 5, isInterface: false]
11: Kind: [name: INTERFACE_VIRTUAL, refKind: 9, isInterface: true]
12: Kind: [name: STATIC, refKind: 6, isInterface: false]
13: Kind: [name: INTERFACE_STATIC, refKind: 6, isInterface: true]
14: Kind: [name: SPECIAL, refKind: 7, isInterface: false]
15: Kind: [name: INTERFACE_SPECIAL, refKind: 7, isInterface: true]
16: Kind: [name: CONSTRUCTOR, refKind: 8, isInterface: false]
17: Kind: [name: CONSTRUCTOR, refKind: 8, isInterface: false]
18: Kind: [name: INTERFACE_VIRTUAL, refKind: 9, isInterface: true]
19: Kind: [name: INTERFACE_VIRTUAL, refKind: 9, isInterface: true]

-

PR: https://git.openjdk.java.net/jdk17/pull/29


Re: [jdk17] RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling

2021-06-11 Thread Vicente Romero
On Fri, 11 Jun 2021 15:01:20 GMT, Vicente Romero  wrote:

> This PR is a copy of [PR-4416](https://github.com/openjdk/jdk/pull/4416) 
> which was intended to openjdk/jdk.
> 
> Please review this PR which is syncing the implementation of 
> `DirectMethodHandleDesc.Kind.valueOf(int)` and 
> `DirectMethodHandleDesc.Kind.valueOf(int, boolean)` 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

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)){

@mlchung 13 hours ago Member

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.

test/jdk/java/lang/constant/MethodHandleDescTest.java line 364:

> 362: public void testKind() {
> 363: for (Kind k : Kind.values()) {
> 364: assertEquals(Kind.valueOf(k.refKind), 
> Kind.valueOf(k.refKind, k.refKind == MethodHandleInfo.REF_invokeInterface));

@mlchung mlchung 2 days ago Member

Looks like the test does not verify the cases specified by valueOf(int refKind, 
boolean isInterface).
i.e. For most values of refKind, there is an exact match regardless of the 
value of isInterface except REF_invokeStatic and REF_invokeSpecial.

Do you mind adding those cases?

@vicente-romero-oracle vicente-romero-oracle 22 hours ago •

hum, the implementation for valueOf(int refKind, boolean isInterface) is 
incorrect, the behavior does depends on the value of isInterface for example: 
Kind.valueOf(1, false) returns GETTER while Kind.valueOf(1, true) fails with 
java.lang.IllegalArgumentException will fix the implementation of valueOf(int 
refKind, boolean isInterface) for it to match its spec

-

PR: https://git.openjdk.java.net/jdk17/pull/29


Re: RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling [v2]

2021-06-11 Thread Vicente Romero
On Thu, 10 Jun 2021 23:26:21 GMT, Vicente Romero  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

I will be withdrawing this one to open a new 
[PR-29](https://github.com/openjdk/jdk17/pull/29) intended to jdk17, please 
let's follow the discussion there

-

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


[jdk17] RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling

2021-06-11 Thread Vicente Romero
This PR is a copy of [PR-4416](https://github.com/openjdk/jdk/pull/4416) which 
was intended to openjdk/jdk.

Please review this PR which is syncing the implementation of 
`DirectMethodHandleDesc.Kind.valueOf(int)` and 
`DirectMethodHandleDesc.Kind.valueOf(int, boolean)` 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

-

Commit messages:
 - 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) 
implementation doesn't conform to the spec regarding REF_invokeInterface 
handling

Changes: https://git.openjdk.java.net/jdk17/pull/29/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk17=29=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8267421
  Stats: 21 lines in 2 files changed: 17 ins; 0 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk17/pull/29.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/29/head:pull/29

PR: https://git.openjdk.java.net/jdk17/pull/29


Re: RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling [v2]

2021-06-10 Thread Mandy Chung
On Thu, 10 Jun 2021 23:23:23 GMT, Vicente Romero  wrote:

>> test/jdk/java/lang/constant/MethodHandleDescTest.java line 362:
>> 
>>> 360: public void testKind() {
>>> 361: for (Kind k : Kind.values()) {
>>> 362: assertEquals(Kind.valueOf(k.refKind), 
>>> Kind.valueOf(k.refKind, k.refKind == MethodHandleInfo.REF_invokeInterface));
>> 
>> Looks like the test does not verify the cases specified by `valueOf(int 
>> refKind, boolean isInterface)`.  
>> i.e. For most values of refKind, there is an exact match regardless of the 
>> value of isInterface except `REF_invokeStatic` and `REF_invokeSpecial`.
>> 
>> Do you mind adding those cases?
>
> @mlchung I have updated the PR with another commit, thanks for your comments

It may be better to create a new JBS issue to fix this bug as it may take more 
time to investigate.

-

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


Re: RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling [v2]

2021-06-10 Thread Mandy Chung
On Thu, 10 Jun 2021 23:26:21 GMT, Vicente Romero  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


Re: RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling [v2]

2021-06-10 Thread Vicente Romero
On Wed, 9 Jun 2021 17:22:30 GMT, Mandy Chung  wrote:

>> Vicente Romero has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   addressing review changes
>
> test/jdk/java/lang/constant/MethodHandleDescTest.java line 362:
> 
>> 360: public void testKind() {
>> 361: for (Kind k : Kind.values()) {
>> 362: assertEquals(Kind.valueOf(k.refKind), 
>> Kind.valueOf(k.refKind, k.refKind == MethodHandleInfo.REF_invokeInterface));
> 
> Looks like the test does not verify the cases specified by `valueOf(int 
> refKind, boolean isInterface)`.  
> i.e. For most values of refKind, there is an exact match regardless of the 
> value of isInterface except `REF_invokeStatic` and `REF_invokeSpecial`.
> 
> Do you mind adding those cases?

@mlchung I have updated the PR with another commit, thanks for your comments

-

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


Re: RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling [v2]

2021-06-10 Thread Vicente Romero
> 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

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/4416/files
  - new: https://git.openjdk.java.net/jdk/pull/4416/files/ea47769d..a5e1c8e5

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=4416=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=4416=00-01

  Stats: 19 lines in 2 files changed: 16 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4416.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4416/head:pull/4416

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


Re: RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling

2021-06-10 Thread Vicente Romero
On Wed, 9 Jun 2021 17:22:30 GMT, Mandy Chung  wrote:

> Looks like the test does not verify the cases specified by `valueOf(int 
> refKind, boolean isInterface)`.
> i.e. For most values of refKind, there is an exact match regardless of the 
> value of isInterface except `REF_invokeStatic` and `REF_invokeSpecial`.
> 
> Do you mind adding those cases?

hum, the spec for `valueOf(int refKind, boolean isInterface)` is incorrect, the 
behavior does depends on the value of `isInterface` for example: 
`Kind.valueOf(1, false)` returns GETTER while `Kind.valueOf(1, true)` fails 
with `java.lang.IllegalArgumentException` will fix the implementation of 
`valueOf(int refKind, boolean isInterface)` for it to match its spec

-

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


Re: RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling

2021-06-09 Thread Mandy Chung
On Tue, 8 Jun 2021 16:46:36 GMT, Vicente Romero  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

test/jdk/java/lang/constant/MethodHandleDescTest.java line 362:

> 360: public void testKind() {
> 361: for (Kind k : Kind.values()) {
> 362: assertEquals(Kind.valueOf(k.refKind), 
> Kind.valueOf(k.refKind, k.refKind == MethodHandleInfo.REF_invokeInterface));

Looks like the test does not verify the cases specified by `valueOf(int 
refKind, boolean isInterface)`.  
i.e. For most values of refKind, there is an exact match regardless of the 
value of isInterface except `REF_invokeStatic` and `REF_invokeSpecial`.

Do you mind adding those cases?

-

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


Re: RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling

2021-06-09 Thread Jorn Vernee
On Tue, 8 Jun 2021 16:46:36 GMT, Vicente Romero  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

Looks good to me.

-

Marked as reviewed by jvernee (Reviewer).

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


RFR: 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling

2021-06-08 Thread Vicente Romero
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

-

Commit messages:
 - 8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) 
implementation doesn't conform to the spec regarding REF_invokeInterface 
handling

Changes: https://git.openjdk.java.net/jdk/pull/4416/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=4416=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8267421
  Stats: 2 lines in 2 files changed: 1 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4416.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4416/head:pull/4416

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