GROOVY-12105: Unqualified super.m(...) from a static trait method thr…#2629
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses GROOVY-12105 by turning an unqualified super.m(...) call from within a static trait method into a compile-time error (instead of compiling and later failing at runtime with MissingMethodException), while keeping the explicit T.super.m(...) form supported.
Changes:
- Add a new compile-time diagnostic in
TraitReceiverTransformerto reject unqualifiedsuperusage in static trait method bodies. - Add focused regression tests in a new
Groovy12105.groovytest class and promote matrix row 15 from@NotYetImplementedto an enforced compile error expectation. - Update matrix documentation/comments to reference GROOVY-12105 and point to the focused regression test.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/test/groovy/org/codehaus/groovy/transform/traitx/TraitStaticDispatchMatrix.groovy | Enables row 15 as an active compile-error expectation for unqualified super in static trait methods. |
| src/test/groovy/org/codehaus/groovy/transform/traitx/Groovy12105.groovy | Adds focused regression coverage for the new compile-time rejection and ensures T.super still works. |
| src/main/java/org/codehaus/groovy/transform/trait/TraitReceiverTransformer.java | Implements the compile-time rejection heuristic and emits a SyntaxException with guidance toward T.super.m(...). |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2629 +/- ##
==================================================
+ Coverage 68.5110% 68.5148% +0.0038%
- Complexity 33588 33591 +3
==================================================
Files 1519 1519
Lines 127378 127387 +9
Branches 23119 23124 +5
==================================================
+ Hits 87268 87279 +11
+ Misses 32362 32357 -5
- Partials 7748 7751 +3
🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
…ows MissingMethodException — should be a compile error
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.
…ows MissingMethodException — should be a compile error