GROOVY-11968: SC: trait static field access generates invalid bytecod…#2495
Merged
paulk-asert merged 1 commit intoapache:masterfrom May 1, 2026
Merged
GROOVY-11968: SC: trait static field access generates invalid bytecod…#2495paulk-asert merged 1 commit intoapache:masterfrom
paulk-asert merged 1 commit intoapache:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes GROOVY-11968 (follow-up to GROOVY-11907) where statically compiled trait static-field access could route sub-expressions through the regular (non-static) call-site writer, producing invalid bytecode under indy=false.
Changes:
- Track whether the current statically compiled method contains any
DYNAMIC_RESOLUTIONsub-expressions (via an AST scan). - Ensure the regular
CallSiteWriterper-method prologue is emitted at method entry when such dynamic-resolution sub-expressions exist. - Add a regression test that compiles and runs the reproducer script with
indy=trueandindy=false.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/test/groovy/org/codehaus/groovy/transform/traitx/Groovy11968.groovy | New regression test covering helper verification under both indy modes |
| src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesWriterController.java | Detects presence of DYNAMIC_RESOLUTION within statically compiled methods/ctors |
| src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java | Emits regular call-site writer method prologue when needed to avoid invalid locals |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2495 +/- ##
==================================================
+ Coverage 67.0917% 67.1794% +0.0878%
- Complexity 31765 31852 +87
==================================================
Files 1465 1465
Lines 123373 123511 +138
Branches 22107 22138 +31
==================================================
+ Hits 82773 82974 +201
+ Misses 33493 33400 -93
- Partials 7107 7137 +30
🚀 New features to boost your workflow:
|
blackdrag
reviewed
Apr 29, 2026
…e under indy=false (GROOVY-11907 follow-up)
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.
…e under indy=false (GROOVY-11907 follow-up)
https://issues.apache.org/jira/browse/GROOVY-11968