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

Paul King commented on GROOVY-8814:
-----------------------------------

The proposed fix for GROOVY-8806 partially fixes this issue in that it allows 
the collector annotation to remain in the codebase as a real annotation. 
Obviously, actually doing the replacement is possibly preferred and/or if the 
legacy serialization approach is used (still allowed with the 8806 fix), then 
it would be good to remove or replace..

> AnnotationCollector not removed during stub generation
> ------------------------------------------------------
>
>                 Key: GROOVY-8814
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8814
>             Project: Groovy
>          Issue Type: Bug
>          Components: Stub generator / Joint compiler
>    Affects Versions: 2.4.15, 2.5.2
>            Reporter: Leonard Brünings
>            Priority: Major
>         Attachments: groovy-stubs-annotation.zip
>
>
> The Groovy Stubs generator leaves the AnnotationCollectors in the generator 
> stubs sources instead of replacing them with the collected annotations, which 
> in turn causes javac to fail, since they are not valid annotations. (Related 
> to GROOVY-7056)
> {{[ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) 
> on project example: Compilation failure}}
>  {{[ERROR] 
> /C:/dev/github/groovy-stubs-annotation/target/generated-sources/groovy-stubs/main/org/example/Service.java:[19,18]
>  incompatible types: groovy.transform.CompileDynamic cannot be converted to 
> java.lang.annotation.Annotation}}
> {code:title=Groovy Source}
> @CompileStatic
> class Service {
>   @CompileDynamic
>   List<String> dynamic() {
>     []
>   }
> }
> {code}
> gets transformed into
> {code:java|title=Generated Stub}
> @groovy.transform.CompileStatic() public class Service
>   extends java.lang.Object  implements
>     groovy.lang.GroovyObject {
> @groovy.transform.CompileDynamic() public  java.util.List<java.lang.String> 
> dynamic() { return (java.util.List<java.lang.String>)null;}
> }
> {code}
>  
> See attached Project to reproduce
> For groovy 2.4.15: {{./mvnw clean install}}
> For groovy 2.5.2: {{./mvnw clean install -Pgroovy-2.5}}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to