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

Problem With Stubs And Annotation

    XMLWordPrintableJSON

Details

    Description

      I have attached a simple project which includes the following:

      src/main/groovy/demo/Demo.groovy
      package demo
      
      @groovy.transform.CompileStatic
      class Demo {
      
          @groovy.transform.CompileDynamic
          def someMethod() {
      
          }
      }
      
      src/main/groovy/demo/JavaCode.java
      package demo;
      
      public class JavaCode {
          Demo demo;
      }
      

      When I attempt to build the project I get the following error:

      $ ./gradlew compileGroovy
      :compileJava UP-TO-DATE
      :compileGroovy
      /Users/jeff/t/compiledynamicproblem/build/tmp/groovy-java-stubs/demo/Demo.java:19: error: incompatible types
      @groovy.transform.CompileDynamic() public  java.lang.Object someMethod() { return null;}
                       ^
        required: Annotation
        found:    CompileDynamic
      1 error
      startup failed:
      Compilation failed; see the compiler error output for details.
      
      1 error
      
      :compileGroovy FAILED
      
      FAILURE: Build failed with an exception.
      
      * What went wrong:
      Execution failed for task ':compileGroovy'.
      > Compilation failed; see the compiler error output for details.
      
      * Try:
      Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
      
      BUILD FAILED
      
      Total time: 4.401 secs
      compiledynamicproblem master $
      

      Attachments

        1. compiledynamicproblem.zip
          50 kB
          Jeff Brown

        Issue Links

          Activity

            People

              Unassigned Unassigned
              brownj Jeff Brown
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: