You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "paulk-asert (via GitHub)" <gi...@apache.org> on 2026/05/21 01:24:32 UTC

[PR] GROOVY-12025: Provide a JavaShell compileAllTo method [groovy]

paulk-asert opened a new pull request, #2548:
URL: https://github.com/apache/groovy/pull/2548

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-12025: Provide a JavaShell compileAllTo method [groovy]

Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #2548:
URL: https://github.com/apache/groovy/pull/2548#issuecomment-4504355014

   ## 🚨 TestLens detected 1 failed tests 🚨
   
   Here is what you can do:
   
   1) Inspect the test failures carefully.
   2) If you are convinced that some of the tests are flaky, you can mute them below.
   3) Finally, trigger a rerun by checking the rerun checkbox.
   
   ### Test Summary
   
   | Check | Project/Task | Test | Runs |
   |---|---|---|---|
   | [Build and test / lts \(25, ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/26202241572/job/77094444394?pr=2548) | :groovy-groovysh:test | HelpCommandTest > helpListsKnownCommands\(\) | ❌ |
   
   🏷️ Commit: b5ee3832332ec9ea6c099879acd4fd30af398d3f
   ▶️ Tests:  19794 executed
   🟡 Checks: 4/28 completed
   
   ### Test Failure
   
   <details>
   
   <summary><strong>HelpCommandTest > helpListsKnownCommands()</strong> (:groovy-groovysh:test in <a href="https://github.com/apache/groovy/actions/runs/26202241572/job/77094444394?pr=2548">Build and test / lts (25, ubuntu-latest)</a>)</summary>
   
   ```
   Assertion failed: 
   
   assert out.contains('show')
          |   |
          |   false
          '[?2027$p  System:\r\n    /exit        \r\n    /help        \r\n'
   
   	at org.codehaus.groovy.runtime.InvokerHelper.createAssertError(InvokerHelper.java:400)
   	at org.apache.groovy.groovysh.commands.HelpCommandTest.helpListsKnownCommands(HelpCommandTest.groovy:44)
   ```
   
   </details>
   
   ### Muted Tests
   > [!NOTE]
   > Checks are currently running using the configuration below.
   
   Select tests to mute in this pull request:
   
   🔲 HelpCommandTest > helpListsKnownCommands\(\) <!-- uniqueId=[engine:junit-jupiter]/[class:org.apache.groovy.groovysh.commands.HelpCommandTest]/[method:helpListsKnownCommands()] -->
   
   Reuse successful test results:
   
   🔲 ♻️ Only rerun the tests that failed or were muted before
   
   Click the checkbox to trigger a rerun:
   
   🔲 **Rerun jobs**
   
   ---
   _Learn more about TestLens at [testlens.app](https://testlens.app)._
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-12025: Provide a JavaShell compileAllTo method [groovy]

Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #2548:
URL: https://github.com/apache/groovy/pull/2548#issuecomment-4504224484

   ## ✅ All tests passed ✅
   
   🏷️ Commit: 42d0258636877e1abde0c095dcfb4f403b2b927a
   ▶️ Tests:  94832 executed
   ⚪️ Checks: 28/28 completed
   
   ---
   _Learn more about TestLens at [testlens.app](https://testlens.app)._
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-12025: Provide a JavaShell compileAllTo method [groovy]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #2548:
URL: https://github.com/apache/groovy/pull/2548#discussion_r3278148572


##########
src/main/java/org/apache/groovy/util/JavaShell.java:
##########
@@ -188,6 +221,56 @@ private void doCompile(String className, String src, Iterable<String> options) t
         }
     }
 
+    /**
+     * Compile {@code src} and write each resulting class file beneath {@code outputDir}
+     * as a standard package directory tree (e.g. {@code com.example.Foo$Bar} becomes
+     * {@code <outputDir>/com/example/Foo$Bar.class}). Intermediate directories are
+     * created as needed; existing class files at those locations are overwritten.
+     * The compiled classes also remain available through {@link #getClassLoader()}.
+     *
+     * @param className the main class name (binary name, e.g. {@code com.example.Foo})
+     * @param options   compiler options; see the
+     *                  {@linkplain JavaShell class-level documentation} for the expected format
+     * @param src       the source code
+     * @param outputDir root directory under which class files are written; created if absent
+     * @return a map from binary class name to the {@link Path} of the written
+     *         {@code .class} file, in compilation order
+     * @throws IOException if compilation fails or writing a class file fails

Review Comment:
   The Javadoc says `@throws IOException if compilation fails`, but compilation failures from `doCompile` are reported via `JavaShellCompilationException` (an unchecked `GroovyRuntimeException`), not an `IOException`. Please update the `@throws` clause (and/or method signature) so the documented exceptions match actual behavior.
   



##########
src/main/java/org/apache/groovy/util/JavaShell.java:
##########
@@ -188,6 +221,56 @@ private void doCompile(String className, String src, Iterable<String> options) t
         }
     }
 
+    /**
+     * Compile {@code src} and write each resulting class file beneath {@code outputDir}
+     * as a standard package directory tree (e.g. {@code com.example.Foo$Bar} becomes
+     * {@code <outputDir>/com/example/Foo$Bar.class}). Intermediate directories are
+     * created as needed; existing class files at those locations are overwritten.
+     * The compiled classes also remain available through {@link #getClassLoader()}.
+     *
+     * @param className the main class name (binary name, e.g. {@code com.example.Foo})
+     * @param options   compiler options; see the
+     *                  {@linkplain JavaShell class-level documentation} for the expected format
+     * @param src       the source code
+     * @param outputDir root directory under which class files are written; created if absent
+     * @return a map from binary class name to the {@link Path} of the written
+     *         {@code .class} file, in compilation order

Review Comment:
   The Javadoc promises the returned map is "in compilation order", but the underlying class bytes map originates from a `HashMap` in `BytesJavaFileManager`, so iteration order is not guaranteed. Either make the underlying collection order-preserving (e.g., use a `LinkedHashMap` for captured outputs / sort by class name) or remove the ordering guarantee from the API docs.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-12025: Provide a JavaShell compileAllTo method [groovy]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #2548:
URL: https://github.com/apache/groovy/pull/2548#issuecomment-4504079830

   ## [Codecov](https://app.codecov.io/gh/apache/groovy/pull/2548?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `90.90909%` with `1 line` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 68.1874%. Comparing base ([`7865789`](https://app.codecov.io/gh/apache/groovy/commit/7865789f6d92647c75fe28b0a7ce1d56b5454d63?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`42d0258`](https://app.codecov.io/gh/apache/groovy/commit/42d0258636877e1abde0c095dcfb4f403b2b927a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 3 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/groovy/pull/2548?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...rc/main/java/org/apache/groovy/util/JavaShell.java](https://app.codecov.io/gh/apache/groovy/pull/2548?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Futil%2FJavaShell.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS91dGlsL0phdmFTaGVsbC5qYXZh) | 90.9091% | [0 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/groovy/pull/2548?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree graph](https://app.codecov.io/gh/apache/groovy/pull/2548/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/2548?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #2548        +/-   ##
   ==================================================
   - Coverage     68.1886%   68.1874%   -0.0012%     
   - Complexity      32960      32961         +1     
   ==================================================
     Files            1504       1504                
     Lines          125785     125796        +11     
     Branches        22760      22762         +2     
   ==================================================
   + Hits            85771      85777         +6     
   - Misses          32453      32457         +4     
   - Partials         7561       7562         +1     
   ```
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/groovy/pull/2548?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [...rc/main/java/org/apache/groovy/util/JavaShell.java](https://app.codecov.io/gh/apache/groovy/pull/2548?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Futil%2FJavaShell.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS91dGlsL0phdmFTaGVsbC5qYXZh) | `86.2500% <90.9091%> (+0.7428%)` | :arrow_up: |
   
   ... and [4 files with indirect coverage changes](https://app.codecov.io/gh/apache/groovy/pull/2548/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-12025: Provide a JavaShell compileAllTo method [groovy]

Posted by "paulk-asert (via GitHub)" <gi...@apache.org>.
paulk-asert merged PR #2548:
URL: https://github.com/apache/groovy/pull/2548


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org