[ 
https://issues.apache.org/jira/browse/GROOVY-12026?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18082720#comment-18082720
 ] 

ASF GitHub Bot commented on GROOVY-12026:
-----------------------------------------

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.
   





> Graduate JavaShell from incubating to stable
> --------------------------------------------
>
>                 Key: GROOVY-12026
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12026
>             Project: Groovy
>          Issue Type: Task
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>             Fix For: 6.0.0-alpha-2
>
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to