Skip to content

[Hotspot] Fix CVM8 legacy interface static method resolution - #182

Merged
superajun-wsj merged 1 commit into
jdk17u-target8from
upstream/bugfix/scala-interface-methodref-compat-v2
Oct 8, 2026
Merged

superajun-wsj merged 1 commit into
jdk17u-target8from
upstream/bugfix/scala-interface-methodref-compat-v2

Conversation

@superajun-wsj

Copy link
Copy Markdown
Collaborator

Scala 2.11 may emit invokestatic with a CONSTANT_Methodref when calling a static interface method. JDK17 HotSpot rejects this encoding with an IncompatibleClassChangeError, although it is accepted by JDK8. Allow this legacy encoding in CVM8 and add the default-enabled AllowLegacyInterfaceMethodref flag to restore strict checking when needed.

Scala 2.11 may emit invokestatic with a CONSTANT_Methodref when calling
a static interface method. JDK17 HotSpot rejects this encoding with an
IncompatibleClassChangeError, although it is accepted by JDK8. Allow this
legacy encoding in CVM8 and add the default-enabled
AllowLegacyInterfaceMethodref flag to restore strict checking when needed.
@superajun-wsj
superajun-wsj requested review from K0u1e and luchsh and a balanced review from Copilot October 8, 2026 07:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The exception is narrowly scoped to CVM8, preserves other resolution checks, and includes targeted regression coverage.

0 open findings

What changed in this PR

Adds CVM8 compatibility for Scala 2.11’s legacy interface static-method calls while retaining an option for strict checking.

Changes:

  • Allows Methodref for interface invokestatic calls in CVM8.
  • Adds the default-enabled AllowLegacyInterfaceMethodref flag.
  • Tests default, interpreted, compiled, and strict-mode behavior.
File Description
src/​hotspot/​share/​runtime/​globals.hpp Defines the CVM8 compatibility flag.
src/​hotspot/​share/​interpreter/​linkResolver.cpp Adds the narrowly scoped resolution exception.
cvm/​test/​hotspot/​runtime/​linkResolver/​LegacyInterfaceMethodrefCaller.jasm Supplies legacy-encoded bytecode.
cvm/​test/​hotspot/​runtime/​linkResolver/​LegacyInterfaceMethodref.java Tests compatibility and strict rejection.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@superajun-wsj
superajun-wsj merged commit 826c229 into jdk17u-target8 Oct 8, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants