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] AbstractMethodError not thrown #14985

Closed
babsingh opened this issue May 2, 2022 · 1 comment
Closed

[JDK8 OJDK-MH] AbstractMethodError not thrown #14985

babsingh opened this issue May 2, 2022 · 1 comment
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_unreflect_interface_ITest_private_non_static_method
java.lang.AssertionError: Should have thrown AbstractMethodError!!
	at org.testng.Assert.fail(Assert.java:96)
	at org.openj9.test.jsr335.interfacePrivateMethod.Test_ReflectionAndMethodHandles.test_unreflect_interface_ITest_private_non_static_method(Test_ReflectionAndMethodHandles.java:724)
	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 the project:MH Used to track Method Handles related work label May 2, 2022
ThanHenderson added a commit to ThanHenderson/openj9-openjdk-jdk8 that referenced this issue Dec 1, 2023
This patch addresses eclipse-openj9/openj9#14985.
For MethodHandles to private interface methods, the RI erroneously
initializes the MethodHandle to have an InvokeInterface reference
kind, leading to an invoke-time AbstractMethodError throw.

As per the spec, OpenJ9 initializes MethodHandles to private interface
methods to have an InvokeSpecial reference kind which does not throw
the error.

This distinction causes a test failure for a test reported in
eclipse-openj9/openj9#14985. Though not-spec compliant, the test expects
an AbstractMethodError to be thrown to conform to the RI behaviour. For
OpenJ9 MHs, MethodHandles.unreflect identifies private interface methods
and installs an AbstractMethodError-thrower MH. This patch sets up a
similar mechanisms for OpenJDK MHs by calling a MethodHandleResolver
method that installs the AbstractMethodError-thrower MH.

Issues: eclipse-openj9/openj9#14985
Signed-off-by: Nathan Henderson <[email protected]>
ThanHenderson added a commit to ThanHenderson/openj9-openjdk-jdk8 that referenced this issue Dec 1, 2023
This patch addresses eclipse-openj9/openj9#14985.
For MethodHandles to private interface methods, the RI erroneously
initializes the MethodHandle to have an InvokeInterface reference
kind, leading to an invoke-time AbstractMethodError throw.

As per the spec, OpenJ9 initializes MethodHandles to private interface
methods to have an InvokeSpecial reference kind which does not throw
the error.

This distinction causes a test failure for a test reported in
eclipse-openj9/openj9#14985. Though not-spec compliant, the test expects
an AbstractMethodError to be thrown to conform to the RI behaviour. For
OpenJ9 MHs, MethodHandles.unreflect identifies private interface methods
and installs an AbstractMethodError-thrower MH. This patch sets up a
similar mechanisms for OpenJDK MHs by calling a MethodHandleResolver
method that installs the AbstractMethodError-thrower MH.

Issues: eclipse-openj9/openj9#14985
Signed-off-by: Nathan Henderson <[email protected]>
ThanHenderson added a commit to ThanHenderson/openj9-openjdk-jdk8 that referenced this issue Dec 1, 2023
This patch addresses eclipse-openj9/openj9#14985.
For MethodHandles to private interface methods, the RI erroneously
initializes the MethodHandle to have an InvokeInterface reference
kind, leading to an invoke-time AbstractMethodError throw.

As per the spec, OpenJ9 initializes MethodHandles to private interface
methods to have an InvokeSpecial reference kind which does not throw
the error.

This distinction causes a test failure for a test reported in
eclipse-openj9/openj9#14985. Though not-spec compliant, the test expects
an AbstractMethodError to be thrown to conform to the RI behaviour. For
OpenJ9 MHs, MethodHandles.unreflect identifies private interface methods
and installs an AbstractMethodError-thrower MH. This patch sets up a
similar mechanisms for OpenJDK MHs by calling a MethodHandleResolver
method that installs the AbstractMethodError-thrower MH.

Issues: eclipse-openj9/openj9#14985
Signed-off-by: Nathan Henderson <[email protected]>
ThanHenderson added a commit to ThanHenderson/openj9 that referenced this issue Dec 4, 2023
This patch addresses eclipse-openj9#14985.
For MethodHandles to private interface methods, the RI erroneously
initializes the MethodHandle to have an InvokeInterface reference
kind, leading to an invoke-time AbstractMethodError throw.

As per the spec, OpenJ9 initializes MethodHandles to private interface
methods to have an InvokeSpecial reference kind which does not throw
the error.

This distinction causes a test failure for a test reported in
eclipse-openj9#14985. Though not-spec compliant, the test expects
an AbstractMethodError to be thrown to conform to the RI behaviour in
JDK8. For OpenJ9 MHs, MethodHandles.unreflect identifies private
interface methods and installs an AbstractMethodError-thrower MH.
This patch sets up a MethodHandleResolver method that installs the
AbstractMethodError-thrower MH when called from OpenJDK MH unreflect
implementation.

Issues: eclipse-openj9#14985
Signed-off-by: Nathan Henderson <[email protected]>
ThanHenderson added a commit to ThanHenderson/openj9-openjdk-jdk8 that referenced this issue Dec 4, 2023
This patch addresses eclipse-openj9/openj9#14985.
For MethodHandles to private interface methods, the RI erroneously
initializes the MethodHandle to have an InvokeInterface reference
kind, leading to an invoke-time AbstractMethodError throw.

As per the spec, OpenJ9 initializes MethodHandles to private interface
methods to have an InvokeSpecial reference kind which does not throw
the error.

This distinction causes a test failure for a test reported in
eclipse-openj9/openj9#14985. Though not-spec compliant, the test expects
an AbstractMethodError to be thrown to conform to the RI behaviour. For
OpenJ9 MHs, MethodHandles.unreflect identifies private interface methods
and installs an AbstractMethodError-thrower MH. This patch sets up a
similar mechanism for OpenJDK MHs by calling a MethodHandleResolver
method that installs the AbstractMethodError-thrower MH.

Issues: eclipse-openj9/openj9#14985
Signed-off-by: Nathan Henderson <[email protected]>
@ThanHenderson
Copy link
Contributor

Closing due to PRs #18552 and ibmruntimes/openj9-openjdk-jdk8#715

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

No branches or pull requests

2 participants