Skip to content

GROOVY-11982: Default methods in interface throw IncompatibleClassCha…#2507

Merged
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy11982
May 3, 2026
Merged

GROOVY-11982: Default methods in interface throw IncompatibleClassCha…#2507
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy11982

Conversation

@paulk-asert
Copy link
Copy Markdown
Contributor

…ngeError under indy=false

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes GROOVY-11982 where interface default methods that require Groovy call sites could fail with IncompatibleClassChangeError when indy=false, by ensuring the generated bytecode targets and emits the correct synthetic helper class.

Changes:

  • Route $getCallSiteArray() INVOKESTATIC owner to the interface helper class (instead of the interface) in non-clinit method prologues.
  • Ensure the interface helper class is materialized when call sites exist, even if no interface synthetic static fields are otherwise needed.
  • Add regression tests covering non-indy interface default methods (including default-to-default calls and a @CompileStatic consumer).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/test/groovy/bugs/Groovy11982.groovy Adds regression tests reproducing the ICCE scenario under indy=false.
src/main/java/org/codehaus/groovy/classgen/asm/CallSiteWriter.java Fixes call site array prologue to invoke $getCallSiteArray() on the helper class for interfaces.
src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java Ensures the interface helper inner class is generated when call sites are present.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.3211%. Comparing base (ced726c) to head (e74384d).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##               master      #2507        +/-   ##
==================================================
+ Coverage     67.3060%   67.3211%   +0.0151%     
- Complexity      32213      32253        +40     
==================================================
  Files            1489       1490         +1     
  Lines          124867     125044       +177     
  Branches        22485      22505        +20     
==================================================
+ Hits            84043      84181       +138     
- Misses          33512      33537        +25     
- Partials         7312       7326        +14     
Files with missing lines Coverage Δ
...rg/codehaus/groovy/classgen/AsmClassGenerator.java 84.9224% <100.0000%> (+0.0111%) ⬆️
...g/codehaus/groovy/classgen/asm/CallSiteWriter.java 80.0971% <100.0000%> (+0.4854%) ⬆️

... and 22 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@paulk-asert paulk-asert merged commit 88ca738 into apache:master May 3, 2026
40 of 41 checks passed
@paulk-asert paulk-asert deleted the groovy11982 branch May 3, 2026 01:15
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