Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-10041

@AnnotationCollector - CompileDynamicProcessor seems to be ignored

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.0.7
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Groovy 3.0.7

      Description

      I'm not able to make CompileDynamicProcessor works with @AnnotationCollector:

      @Requires({ jvm.java8Compatible })
      @AnnotationCollector(processor = "org.codehaus.groovy.transform.CompileDynamicProcessor")
      @interface MetaRequiresRepeated {
      } 

      fails with:

      Groovyc: [Static type checking] - The variable [jvm] is undeclared. 

      The same error is when I try to use @AnnotationCollector with default processor.

       

      The @Requires annotation is defined in Spock as follows :

      @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();
        }
      }

      and the Closure is executed in the context of a PreconditionContext which knows jvm.

      The following code works fine:

      @Requires({ PreconditionContext pc -> pc.jvm.java8Compatible })
      @AnnotationCollector
      @interface MetaRequiresRepeated {
      }

      Slightly related to GROOVY-10040

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              szpak Marcin Zajaczkowski
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: