opal icon indicating copy to clipboard operation
opal copied to clipboard

Support new Java 21 INVOKEDYNAMIC bootstrap methods

Open johannesduesing opened this issue 2 months ago • 1 comments

Describe the Problem Java 21 has introduced new types of bootstrap methods for switch statements. There is at least the java/lang/runtime/SwitchBootstraps class that is currently not supported by the InvokeDynamicRewriting of OPAL. This is not a functional problem, as the instruction will simply not be rewritten - rewriting is a "best-effort" approach. However, we do have an integration test case in the InvokedymamicRewritingTest that assumes we can rewrite every INVOKEDYNAMIC in the current Java Base. This is no longer true for Java 21+, so the integration test fails.

Solution you'd like Support the rewriting of new bootstrap methods added in Java 21 and above. If rewriting is not always possible, change the test case assumption that we no longer assume we can rewrite all INVOKEDYNAMICs of every Java version.

johannesduesing avatar Oct 09 '25 08:10 johannesduesing

There are also new forms of invokedynamic in recent Scala versions that should be considered

errt avatar Oct 09 '25 10:10 errt