Skip to content

GROOVY-12008: Sealed types: graduate from incubating status#2532

Merged
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy12008
May 14, 2026
Merged

GROOVY-12008: Sealed types: graduate from incubating status#2532
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy12008

Conversation

@paulk-asert
Copy link
Copy Markdown
Contributor

No description provided.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.50000% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.1370%. Comparing base (a34df97) to head (37d0ae3).
⚠️ Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
...haus/groovy/transform/SealedASTTransformation.java 44.1860% 10 Missing and 14 partials ⚠️
...codehaus/groovy/tools/javac/JavaStubGenerator.java 72.9730% 0 Missing and 10 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##               master      #2532        +/-   ##
==================================================
- Coverage     68.1373%   68.1370%   -0.0003%     
- Complexity      32717      32755        +38     
==================================================
  Files            1499       1499                
  Lines          125162     125233        +71     
  Branches        22566      22604        +38     
==================================================
+ Hits            85282      85330        +48     
- Misses          32388      32391         +3     
- Partials         7492       7512        +20     
Files with missing lines Coverage Δ
...c/main/java/org/codehaus/groovy/ast/ClassNode.java 87.5740% <ø> (ø)
...codehaus/groovy/tools/javac/JavaStubGenerator.java 86.2637% <72.9730%> (-0.7493%) ⬇️
...haus/groovy/transform/SealedASTTransformation.java 66.6667% <44.1860%> (-18.2390%) ⬇️

... and 9 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
Copy link
Copy Markdown

testlens-app Bot commented May 14, 2026

✅ All tests passed ✅

🏷️ Commit: 37d0ae3
▶️ Tests: 98854 executed
⚪️ Checks: 28/28 completed


Learn more about TestLens at testlens.app.

Copy link
Copy Markdown

Copilot AI left a comment

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 graduates Groovy's sealed types feature from incubating to stable. It removes @Incubating annotations from the @Sealed/@NonSealed/@SealedOptions API and from ClassNode.isSealed/getPermittedSubclasses/setPermittedSubclasses, drops the "(incubating)" tag from the docs, and—more substantively—teaches the joint-compilation stub generator to emit native sealed/non-sealed/permits declarations so Java sources can correctly extend Groovy sealed types under JDK17+. Several new helper APIs are added to SealedASTTransformation to support phase-independent queries from the stub generator. Test coverage is reorganized: Groovy11292 is folded into a new SealedJointCompilationTest, and SealedTransformTest is extended with restricted-identifier, implicit-non-sealed, anonymous-class, coercion, retention, and @Delegate-interaction tests.

Changes:

  • Strip @Incubating from sealed-related public API and update spec doc (also fixes a copy-paste mention of "record").
  • Add wouldBeNativeSealed, getDeclaredPermittedSubclasses, getEffectivePermittedSubclasses, sealedSkipAnnotationFromSource in SealedASTTransformation and use them from JavaStubGenerator to emit sealed/non-sealed/permits and to suppress source-only sealed annotations.
  • Add SealedJointCompilationTest (consolidating/expanding Groovy11292) and new GEP-13 conformance tests in SealedTransformTest; minor comment fix in Delegate.java.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/main/java/groovy/transform/Sealed.java Remove @Incubating.
src/main/java/groovy/transform/NonSealed.java Remove @Incubating.
src/main/java/groovy/transform/SealedOptions.java Remove @Incubating.
src/main/java/groovy/lang/Delegate.java Comment grammar fix.
src/main/java/org/codehaus/groovy/ast/ClassNode.java Remove @Incubating from isSealed/`get
src/main/java/org/codehaus/groovy/transform/SealedASTTransformation.java Add phase-independent helpers used by stub generation.
src/main/java/org/codehaus/groovy/tools/javac/JavaStubGenerator.java Emit native sealed/non-sealed/permits and filter source-only sealed annotations from stubs.
src/spec/doc/_sealed.adoc Drop "(incubating)" heading and fix AUTO description (record→sealed).
src/test/groovy/org/codehaus/groovy/transform/SealedJointCompilationTest.groovy New consolidated joint-compile matrix for sealed types.
src/test/groovy/org/codehaus/groovy/transform/SealedTransformTest.groovy New GEP-13 conformance tests (identifiers, implicit non-sealed, anon, coercion, retention, @DeleGate).
src/test/groovy/bugs/Groovy11292.groovy Removed; merged into SealedJointCompilationTest.

@paulk-asert paulk-asert merged commit 6b109a6 into apache:master May 14, 2026
29 checks passed
@paulk-asert paulk-asert deleted the groovy12008 branch May 14, 2026 22:12
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