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

Paul King edited comment on GROOVY-9789 at 10/21/20, 8:25 AM:
--------------------------------------------------------------

This is relatively easy to do programmatically but not something currently 
supported from the command line. For programmatic usage, you'd need something 
like [1], but with the phase on the referenced line changed to 
SEMANTIC_ANALYSIS. You'd also need to keep the stubs as per [2].

To enable this from the command line, the FileSystemCompiler would need to know 
about a finishing phase and the unit.compile() statements at [3] would need to 
be made aware of that phase. But I haven't actually tried those changes myself.

[1] 
https://github.com/apache/groovy/blob/master/src/test/groovy/bugs/Groovy6086Bug.groovy#L63

[2] 
https://github.com/apache/groovy/blob/master/src/test/groovy/bugs/Groovy9031.groovy#L33

[3] 
https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/tools/FileSystemCompiler.java#L309-L317

You could probably also achieve something similar to the programmatic approach 
using ASTTest.


was (Author: paulk):
This is relatively easy to do programmatically but not something currently 
supported from the command line. For programmatic usage, you'd need something 
like [1], but with the phase on the referenced line changed to 
SEMANTIC_ANALYSIS. You'd also need to keep the stubs as per [2].

To enable this from the command line, the FileSystemCompiler would need to know 
about a finishing phase and the unit.compile() statements at [3] would need to 
be made aware of that phase. But I haven't actually tried those changes myself.

[1] 
https://github.com/apache/groovy/blob/master/src/test/groovy/bugs/Groovy6086Bug.groovy#L63

[2] 
https://github.com/apache/groovy/blob/master/src/test/groovy/bugs/Groovy9031.groovy#L33

[3] 
https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/tools/FileSystemCompiler.java#L309-L317

> Stubbing: Mode of running Groovyc to only output stubs
> ------------------------------------------------------
>
>                 Key: GROOVY-9789
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9789
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Compiler
>            Reporter: Endre Stølsvik
>            Priority: Major
>
> So, I'd love if I could instruct groovyc to only perform the Java stubbing 
> part (and stop there).
> The rationale for this is described in this StackOverflow question: 
> [https://stackoverflow.com/q/53759596/39334]
> Basically, *I want to have three-way joint/mixed compilation between Java, 
> Groovy and Kotlin.* And I figure that if I first could get the java stubs of 
> all groovy files, I could manage to do this in four steps as described in the 
> SO question.
> If this logic holds, it would probably hold for other languages too, so it 
> could conceivably be a nice feature to have not only for my scenario with 
> Java+Groovy+Kotlin.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to