[
https://issues.apache.org/jira/browse/GROOVY-7155?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-7155.
-----------------------------
> Java stub generation fails on statically imported field used as annotation
> parameter
> ------------------------------------------------------------------------------------
>
> Key: GROOVY-7155
> URL: https://issues.apache.org/jira/browse/GROOVY-7155
> Project: Groovy
> Issue Type: Bug
> Components: Stub generator / Joint compiler
> Affects Versions: 2.3.7
> Reporter: Marcin Zajaczkowski
> Assignee: Eric Milles
> Priority: Minor
>
> groovyc fails to generate compiling Java stub for Groovy classes which use
> statically imported field as an annotation parameter. E.g.
> {code}
> import static stub.Constants.CONST1
> class GroovyToStub {
> @GroovyAnn(CONST1) //fails
> void methodToStub() {
> }
> }
> {code}
> {code}
> /tmp/groovy-java-stubs/stub/GroovyToStub.java:21: error: cannot find symbol
> @stub.GroovyAnn(value=CONST1) public void methodToStub() { }
> ^
> symbol: variable CONST1
> location: class GroovyToStub
> 1 error
> startup failed:
> Compilation failed; see the compiler error output for details.
> 1 error
> {code}
> A simple workaround is to use Constants.CONST1 with normal import, but in
> some cases it can reduce original code readability.
> Looking briefly at the code there could be missing "printing" static imports
> in JavaStubGenerator.printImports().
> Sample project reproducing problem:
> https://github.com/szpak/code-examples-and-poc/tree/master/groovy-joint-compilation-issue
--
This message was sent by Atlassian Jira
(v8.20.1#820001)