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

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

Copilot commented on code in PR #2741:
URL: https://github.com/apache/groovy/pull/2741#discussion_r3663645894


##########
src/spec/doc/tools-groovyc.adoc:
##########
@@ -46,6 +46,7 @@ a number of command line switches:
 | | --encoding | Encoding of the source files | groovyc --encoding utf-8 
script.groovy
 | | --help | Displays help for the command line groovyc tool | groovyc --help
 | -d | | Specify where to place generated class files. | groovyc -d target 
Person.groovy
+| | --check | Check sources for errors without generating class files (stops 
compilation after static analysis) | groovyc --check Person.groovy

Review Comment:
   The docs say --check "stops compilation after static analysis", but the 
implementation stops at Phases.INSTRUCTION_SELECTION (class generation pt.1). 
To avoid misleading users about where compilation stops, rephrase this to the 
concrete user-facing behavior (no class files written) rather than claiming it 
stops after analysis.



##########
src/main/java/org/codehaus/groovy/tools/FileSystemCompiler.java:
##########
@@ -556,6 +557,9 @@ public static class CompilationOptions {
         @Option(names = {"--type-checked"}, description = "Use TypeChecked")
         private boolean typeChecked;
 
+        @Option(names = {"--check"}, description = "Check sources for errors 
without generating class files (stops compilation after static analysis)")
+        private boolean checkOnly;

Review Comment:
   The --check option sets the target phase to Phases.INSTRUCTION_SELECTION, 
which is part of class generation ("Class generation (pt.1)" per Phases.java). 
The current help text says it "stops compilation after static analysis", which 
is inaccurate/misleading; the observable guarantee is that no class files are 
written. Consider rewording to describe the no-class-file behavior (and/or that 
it stops before disk output) rather than implying compilation stops at analysis.





> Support check-only compilation (stop after a configurable compile phase)
> ------------------------------------------------------------------------
>
>                 Key: GROOVY-12204
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12204
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>
> Groovy has existing machinery to run compilation to a particular phase. This 
> ticket is to make that easier to invoke so that humans and AI agents can 
> check code without generating the full bytecode.



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

Reply via email to