You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/07/05 15:08:00 UTC

[jira] [Updated] (GROOVY-10041) @AnnotationCollector - CompileDynamicProcessor seems to be ignored

     [ https://issues.apache.org/jira/browse/GROOVY-10041?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles updated GROOVY-10041:
---------------------------------
    Component/s:     (was: Compiler)

> @AnnotationCollector - CompileDynamicProcessor seems to be ignored
> ------------------------------------------------------------------
>
>                 Key: GROOVY-10041
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10041
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 3.0.7
>            Reporter: Marcin Zajaczkowski
>            Priority: Minor
>
> I'm not able to make CompileDynamicProcessor works with @AnnotationCollector:
> {code:java}
> @Requires({ jvm.java8Compatible })
> @AnnotationCollector(processor = "org.codehaus.groovy.transform.CompileDynamicProcessor")
> @interface MetaRequiresRepeated {
> } {code}
> fails with:
> {code:java}
> Groovyc: [Static type checking] - The variable [jvm] is undeclared. {code}
> The same error is when I try to use @AnnotationCollector with default processor.
>  
> The @Requires annotation is defined in Spock as follows :
> {code:java}
> @Retention(RetentionPolicy.RUNTIME)
> @Target({ElementType.TYPE, ElementType.METHOD})
> @ExtensionAnnotation(RequiresExtension.class)
> @Repeatable(Requires.Container.class)
> public @interface Requires {
>   Class<? extends Closure> value();
>   /**
>    * @since 2.0
>    */
>   @Beta
>   @Retention(RetentionPolicy.RUNTIME)
>   @Target({ElementType.TYPE, ElementType.METHOD})
>   @interface Container {
>     Requires[] value();
>   }
> }{code}
> and the Closure is executed in the context of a PreconditionContext which knows jvm.
> The following code works fine:
> {code:java}
> @Requires({ PreconditionContext pc -> pc.jvm.java8Compatible })
> @AnnotationCollector
> @interface MetaRequiresRepeated {
> }{code}
> Slightly related to GROOVY-10040



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