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

@DelegatesTo added by AST assumes static context

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.1
    • 2.1.3
    • Static compilation
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: