Skip to content
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

[JDK8 OJDK-MH] IllegalAccessException not thrown #14984

Closed
babsingh opened this issue May 2, 2022 · 0 comments · Fixed by #18476
Closed

[JDK8 OJDK-MH] IllegalAccessException not thrown #14984

babsingh opened this issue May 2, 2022 · 0 comments · Fixed by #18476
Labels
jdk8 project:MH Used to track Method Handles related work triageRequired

Comments

@babsingh
Copy link
Contributor

babsingh commented May 2, 2022

The below failure(s) is(are) only seen when OJDK MHs are enabled in OpenJ9.

Errors

FAILED: test_find_virtual_interface_ITest_private_non_static
java.lang.AssertionError: Should have thrown an IllegalAccessException
	at org.testng.Assert.fail(Assert.java:96)
	at org.openj9.test.jsr335.interfacePrivateMethod.Test_ReflectionAndMethodHandles.test_find_virtual_interface_ITest_private_non_static(Test_ReflectionAndMethodHandles.java:454)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:580)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:716)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:988)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
	at org.testng.TestRunner.privateRun(TestRunner.java:648)
	at org.testng.TestRunner.run(TestRunner.java:505)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
	at org.testng.SuiteRunner.run(SuiteRunner.java:364)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
	at org.testng.TestNG.runSuites(TestNG.java:1049)
	at org.testng.TestNG.run(TestNG.java:1017)
	at org.testng.TestNG.privateMain(TestNG.java:1354)
	at org.testng.TestNG.main(TestNG.java:1323)

Failing Test Targets

  • BUILD_LIST=functional
    • jsr335_interfacePrivateMethod_0
    • jsr335_interfacePrivateMethod_1

How-to Run Tests?

https://github.com/eclipse/openj9/blob/master/test/docs/OpenJ9TestUserGuide.md

Steps to build an OpenJ9 JDK8 with OJDK MHs enabled

Refer to #14541.

@babsingh babsingh added jdk8 project:MH Used to track Method Handles related work triageRequired labels May 2, 2022
ThanHenderson added a commit to ThanHenderson/openj9 that referenced this issue Nov 21, 2023
This patch fixes eclipse-openj9#14984.
For Java 10-, private interface lookups should fail with a
IncompatibleClassChangeError that is caught and wrapped in an
IllegalAccessException. For OJ9 MHs, the IllegalAccessException
is thrown in findInterface based on Java-code guards on method
modifiers. For OJDK MHs, the IncompatibleClassChangeError is
expected from a call to MethodHandleNatives.resolve and wrapped.

This patch ensures that the correct error is thrown for private
interfaces during method lookup for Java 11- with OJDK MHs.

Issues: eclipse-openj9#14984
Signed-off-by: Nathan Henderson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jdk8 project:MH Used to track Method Handles related work triageRequired
Projects
Development

Successfully merging a pull request may close this issue.

1 participant