-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8267421: j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling #4416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,7 +53,9 @@ | |
| import static java.lang.constant.ConstantDescs.CD_String; | ||
| import static java.lang.constant.ConstantDescs.CD_int; | ||
| import static java.lang.constant.ConstantDescs.CD_void; | ||
| import static java.lang.invoke.MethodHandleInfo.*; | ||
| import static org.testng.Assert.assertEquals; | ||
| import static org.testng.Assert.assertNotEquals; | ||
| import static org.testng.Assert.assertNotSame; | ||
| import static org.testng.Assert.assertSame; | ||
| import static org.testng.Assert.assertTrue; | ||
|
|
@@ -359,7 +361,21 @@ public void testSymbolicDescsConstants() throws ReflectiveOperationException { | |
|
|
||
| public void testKind() { | ||
| for (Kind k : Kind.values()) { | ||
| assertEquals(Kind.valueOf(k.refKind), Kind.valueOf(k.refKind, k.refKind == MethodHandleInfo.REF_invokeInterface)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the test does not verify the cases specified by Do you mind adding those cases? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
hum, the implementation for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mlchung I have updated the PR with another commit, thanks for your comments There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It may be better to create a new JBS issue to fix this bug as it may take more time to investigate. |
||
| assertEquals(Kind.valueOf(k.refKind, k.isInterface), k); | ||
| } | ||
| // let's now verify those cases for which the value of the isInterface parameter is ignored | ||
| int[] isInterfaceIgnored = new int[] { | ||
| REF_getField, | ||
| REF_getStatic, | ||
| REF_putField, | ||
| REF_putStatic, | ||
| REF_newInvokeSpecial, | ||
| REF_invokeInterface | ||
| }; | ||
|
|
||
| for (int refKind : isInterfaceIgnored) { | ||
| assertEquals(Kind.valueOf(refKind, false), Kind.valueOf(refKind, true)); | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:This changes the entry for
REF_invokeVirtualto kindINTERFACE_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 forvalueOf.