GROOVY-11982: Default methods in interface throw IncompatibleClassCha…#2507
Merged
Conversation
…ngeError under indy=false
There was a problem hiding this comment.
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
@CompileStaticconsumer).
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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ngeError under indy=false