GROOVY-12093: Static method override on trait implementer ignored whe…#2618
GROOVY-12093: Static method override on trait implementer ignored whe…#2618paulk-asert wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2618 +/- ##
==================================================
- Coverage 68.4541% 68.4528% -0.0013%
- Complexity 33505 33521 +16
==================================================
Files 1518 1518
Lines 127107 127162 +55
Branches 23065 23079 +14
==================================================
+ Hits 87010 87046 +36
- Misses 32371 32380 +9
- Partials 7726 7736 +10
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Implements GROOVY-12093 by introducing an @Anchored marker for trait static methods to opt out of per-implementer override-style dispatch and (by default) promote those methods onto the generated trait interface, plus adds comprehensive tests covering the resulting dispatch matrix.
Changes:
- Add
groovy.transform.Anchoredannotation withinInterfaceopt-out. - Update trait static dispatch rewriting to treat
@Anchoredstatics as declarer-bound (helper/interface-static flavor). - Extend
TraitASTTransformationto validate@Anchoredusage and generate interface forwarders; add new regression/behavior tests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/main/java/groovy/transform/Anchored.java |
Adds the public @Anchored marker annotation and its inInterface option. |
src/main/java/org/codehaus/groovy/transform/trait/TraitReceiverTransformer.java |
Skips implementer-routing for @Anchored trait statics during receiver rewriting. |
src/main/java/org/codehaus/groovy/transform/trait/TraitASTTransformation.java |
Validates @Anchored usage and generates interface forwarders for anchored statics. |
src/test/groovy/org/codehaus/groovy/transform/traitx/TraitStaticDispatchMatrix.groovy |
Adds an executable behavior matrix covering trait/static dispatch scenarios (incl. anchored rows). |
src/test/groovy/org/codehaus/groovy/transform/traitx/Groovy12093.groovy |
Adds targeted tests for @Anchored semantics, STC interactions, and validation errors. |
…n called via this in trait body (cont'd)
✅ All tests passed ✅Test SummaryBuild and test / lts (17, windows-latest, 1) > :test
🏷️ Commit: 19fa2a8 Learn more about TestLens at testlens.app. |
…n called via this in trait body (cont'd)