[
https://issues.apache.org/jira/browse/GROOVY-12311?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18108771#comment-18108771
]
ASF GitHub Bot commented on GROOVY-12311:
-----------------------------------------
paulk-asert opened a new pull request, #2836:
URL: https://github.com/apache/groovy/pull/2836
--check selected Phases.INSTRUCTION_SELECTION, so it reported success for
sources that do not compile. Class verification and bytecode generation are
both registered at Phases.CLASS_GENERATION, which the cutoff excluded, and each
reports errors the earlier phases cannot: duplicate method signatures, illegal
modifier combinations, abstract/final conflicts, and the direct field access
diagnostics from StaticTypesCallSiteWriter.
The two ideas behind --check — check without producing an artefact, and stop
at a phase — line up at CLASS_GENERATION rather than before it. Bytecode is
built in memory there; the class files are written in the OUTPUT phase that
follows, and suppressing that is all a check needs. Selecting an earlier phase
does not check less thoroughly for free, it just misses errors.
--check now does more work than it did, since it generates bytecode it
discards. That is the cost of its result being trustworthy.
Earlier phases remain selectable through
CompilerConfiguration.setTargetPhase and a compiler configuration script.
Config scripts are processed after the option is applied, so a script overrides
--check; the new test pins that, since it is the only route back to a shallower
check.
> 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)