Skip to content

GROOVY-12105: Unqualified super.m(...) from a static trait method thr…#2629

Merged
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy12105
Jun 27, 2026
Merged

GROOVY-12105: Unqualified super.m(...) from a static trait method thr…#2629
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy12105

Conversation

@paulk-asert

Copy link
Copy Markdown
Contributor

…ows MissingMethodException — should be a compile error

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 TraitReceiverTransformer to reject unqualified super usage in static trait method bodies.
  • Add focused regression tests in a new Groovy12105.groovy test class and promote matrix row 15 from @NotYetImplemented to 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(...).

Comment thread src/test/groovy/org/codehaus/groovy/transform/traitx/Groovy12105.groovy Outdated
@codecov-commenter

codecov-commenter commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.5148%. Comparing base (6a1571d) to head (e583923).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...oovy/transform/trait/TraitReceiverTransformer.java 77.7778% 0 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@                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     
Files with missing lines Coverage Δ
...oovy/transform/trait/TraitReceiverTransformer.java 88.8889% <77.7778%> (-0.5291%) ⬇️

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@testlens-app

This comment has been minimized.

…ows MissingMethodException — should be a compile error
@paulk-asert paulk-asert merged commit da821d9 into apache:master Jun 27, 2026
28 of 29 checks passed
@paulk-asert paulk-asert deleted the groovy12105 branch June 27, 2026 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants