Copilot commented on code in PR #2550: URL: https://github.com/apache/groovy/pull/2550#discussion_r3285075098
########## subprojects/groovy-console/src/spec/doc/groovy-console.adoc: ########## @@ -83,6 +83,23 @@ executed. * You can turn the System.out capture on and off by selecting `Capture System.out` from the `Actions` menu +[[GroovyConsole-RunningAsJava]] +=== Running and compiling as Java + +The console can also treat the editor contents as Java source rather than Groovy: + +* `Script > Run as Java` (shortcut `Alt+R`) compiles the input as Java and invokes its `main` + method, with any program arguments taken from `Script > Set Script Arguments`. +* `Script > Run Selection as Java` does the same for just the highlighted text. Review Comment: The docs say `Run as Java` uses arguments from `Script > Set Script Arguments`, but the console implementation currently calls `JavaShell.run(primaryClassName, src)` with no args, so Java `main(String[] args)` always receives an empty array. Either update the documentation to match current behavior, or pass `scriptArgsArray` through to `JavaShell.run(...)` for Java runs as well. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
