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

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

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


##########
src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java:
##########
@@ -504,11 +504,16 @@ public void setLogClassgenStackTraceMaxDepth(int 
logClassgenStackTraceMaxDepth)
 
     /**
      * The target compile phase: the last phase to be processed when
-     * {@link CompilationUnit#compile()} is called without an explicit phase
-     * (GROOVY-12204). Defaults to {@link Phases#ALL}. An earlier phase, such 
as
-     * {@link Phases#INSTRUCTION_SELECTION}, gives a check-only compilation
-     * which reports parse, resolution, and static type-checking errors without
-     * generating class files.
+     * {@link CompilationUnit#compile()} is called without an explicit phase.
+     * Defaults to {@link Phases#ALL}.
+     * <p>
+     * {@link Phases#CLASS_GENERATION} gives a check-only compilation: every 
check runs,
+     * but the class files are never written, because that happens in {@link 
Phases#OUTPUT}.
+     * This is what {@code groovyc --check} selects.

Review Comment:
   This updated Javadoc correctly describes CLASS_GENERATION as the check-only 
cutoff used by `groovyc --check`, but 
`CompilerConfiguration#setTargetPhase(int)` further down in this same file 
still documents `--check` as selecting `INSTRUCTION_SELECTION`. Please update 
the setter (and any related docs) to match, otherwise readers will get 
contradictory guidance about which phase `--check` uses.





> Support check-only compilation (stop after CLASS_GENERATION instead of 
> INSTRUCTION_SELECTION but before OUTPUT)
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12311
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12311
>             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. The earlier setting skipped 
> ClassCompletionVisitor and other checks. You can still achieve the early stop 
> using a config script.



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

Reply via email to