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

@CompileStatic: Chained assignment to delegate property broken

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.7
    • 2.4.0-beta-4
    • Static compilation
    • None
    • JDK 7u55 on Win7 x64, IntellJ Idea 13.1.5

    Description

      This script failes, unless @CompileStatic is removed:

      import groovy.transform.CompileStatic
      
      test()
      
      @CompileStatic
      void test() {
      
          def obj = new DelegateClass()
          obj.with {
              def locl = prop = "XYZ"
              assert locl == prop
          }
      }
      
      class DelegateClass {
          String prop
      }
      

      Decompiling the class file shows that the inner, right-most assignment to the property of the closure delegate produces a constant null result instead of passing the right hand side result through all chained assignments.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: