GROOVY-12008: Sealed types: graduate from incubating status#2532
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
✅ All tests passed ✅🏷️ Commit: 37d0ae3 Learn more about TestLens at testlens.app. |
There was a problem hiding this comment.
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
@Incubatingfrom sealed-related public API and update spec doc (also fixes a copy-paste mention of "record"). - Add
wouldBeNativeSealed,getDeclaredPermittedSubclasses,getEffectivePermittedSubclasses,sealedSkipAnnotationFromSourceinSealedASTTransformationand use them fromJavaStubGeneratorto emitsealed/non-sealed/permitsand to suppress source-only sealed annotations. - Add
SealedJointCompilationTest(consolidating/expandingGroovy11292) and new GEP-13 conformance tests inSealedTransformTest; minor comment fix inDelegate.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. |
No description provided.