GROOVY-12235: Interface default method without dynamic calls referenc… - #2767
Merged
Conversation
…es unemitted call-site helper under indy=false
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a non-invokedynamic (indy=false) bytecode generation edge case for interfaces where a call-site array prologue is emitted even when no call sites are registered, which could otherwise lead to NoClassDefFoundError at first invocation.
Changes:
- Track whether the call-site array prologue was emitted during class generation.
- Ensure the interface helper class is materialized whenever a prologue was emitted (not only when call sites were recorded).
- Add regression tests covering interface default and static methods with trivial bodies under
indy=false.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/test/groovy/bugs/Groovy12235.groovy | Adds regression tests for interface default/static methods returning null under indy=false. |
| src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java | Switches interface-helper materialization condition to depend on whether a call-site prologue was emitted. |
| src/main/java/org/codehaus/groovy/classgen/asm/CallSiteWriter.java | Adds a prologueEmitted flag and accessor to indicate whether the call-site prologue was generated for the class. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2767 +/- ##
==================================================
- Coverage 69.9869% 69.9836% -0.0033%
Complexity 35529 35529
==================================================
Files 1557 1557
Lines 131686 131688 +2
Branches 24174 24173 -1
==================================================
- Hits 92163 92160 -3
- Misses 31189 31191 +2
- Partials 8334 8337 +3
🚀 New features to boost your workflow:
|
✅ All tests passed ✅🏷️ Commit: 37a37ff Learn more about TestLens at testlens.app. |
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.
…es unemitted call-site helper under indy=false