GROOVY-12026: Graduate JavaShell from incubating to stable#2550
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Graduates org.apache.groovy.util.JavaShell to a stable API surface (no longer class-level @Incubating) and adds user/testing documentation plus executable spec examples demonstrating in-memory Java compilation and optional .class file emission.
Changes:
- Removes
@IncubatingfromJavaShelland scopes@Incubatingto thecompileAllTooverloads only. - Documents JavaShell usage in the integration guide and testing guide with executable
src/spec/testexamples. - Documents Groovy Console’s “Run/Compile as Java” actions and ties them to JavaShell-backed compilation.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| subprojects/groovy-console/src/spec/doc/groovy-console.adoc | Adds “Running and compiling as Java” section for groovyConsole. |
| src/spec/test/testingguide/JavaShellExampleTests.groovy | Adds executable snippets (tagged includes) for testing-guide documentation. |
| src/spec/test/IntegrationTest.groovy | Adds executable integration-guide snippets covering compile, compileAll, compileAllTo. |
| src/spec/doc/guide-integrating.adoc | Adds a new “JavaShell” section explaining runtime Java compilation and APIs. |
| src/spec/doc/core-testing-guide.adoc | Adds a “JavaShell” subsection showing testing use cases and includes examples. |
| src/main/java/org/apache/groovy/util/JavaShell.java | Removes class-level incubation; marks only compileAllTo overloads as incubating. |
Comments suppressed due to low confidence (1)
src/main/java/org/apache/groovy/util/JavaShell.java:246
- Now that
JavaShellis no longer@Incubating, it should fail predictably on a JRE.ToolProvider.getSystemJavaCompiler()can returnnull, and the current implementation will NPE when callingcompiler.getStandardFileManager(...). Consider adding an explicit null check (e.g., throw an IllegalStateException with a clear message about requiring a JDK) before proceeding with compilation.
@Incubating
public Map<String, Path> compileAllTo(String className, Iterable<String> options,
String src, Path outputDir)
throws IOException {
doCompile(className, src, options); // populates jscl's classMap
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2550 +/- ##
==================================================
+ Coverage 68.1850% 68.1855% +0.0005%
- Complexity 32960 32963 +3
==================================================
Files 1504 1504
Lines 125796 125798 +2
Branches 22762 22763 +1
==================================================
+ Hits 85774 85776 +2
Misses 32457 32457
Partials 7565 7565
🚀 New features to boost your workflow:
|
✅ All tests passed ✅🏷️ Commit: 72c37f0 Learn more about TestLens at testlens.app. |
Contributor
|
Merged. Thanks. |
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.
No description provided.