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

@DelegatesTo added by AST assumes static context

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.1.3
    • Component/s: Static compilation
    • Labels:
      None
    • Environment:
      java version "1.7.0_17"
      Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
      Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

      Description

      I wanted to add @DelegatesTo annotation to static generated method so it can be used with @CompileStatic but it looks like the method pick the proper type (QueryBuilder) but it tries to pick the missing method from static method instead of instance methods and fails because the static method doesn't exist

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      Script1.groovy: 8: [Static type checking] - Non static method groovyx.gaelyk.query.QueryBuilder#where cannot be called from static context
       @ line 8, column 38.
                             MyPogo3.findAll{ where test == t }
      

      see how the annotation node is created

      see the test (need to uncomment CompileStatic(SKIP) to fail)

        Attachments

          Activity

            People

            • Assignee:
              melix Cédric Champeau
              Reporter:
              musketyr Vladimír Oraný
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: