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

Regression if @DelegatesTo delegate to a Java class and use of property notation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.3.4
    • 2.3.5
    • Static compilation
    • None

    Description

      If @DelegatesTo tells that the delegate is a Java class (which doesn't implement GroovyObject), then the static compiler generates wrong bytecode, like in the following example:

      class MyHandlers {
                    def handler(@DelegatesTo(GroovyContext) Closure<?> c) {
                      def l = new GroovyContext()
                      c.delegate = l
                      c.call()
                    }
                    def execute() {
                      handler {
                        request.headers.bar
                      }
                    }
      
                  }
      

      Issue highlighted in Ratpack, responsible for the joint build failure. See https://github.com/ratpack/ratpack/pull/375#issuecomment-49249705

      Attachments

        Activity

          People

            melix Cédric Champeau
            melix Cédric Champeau
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: