title: Gradle/Groovy closure scope confusion
body: <p>I'm new to Gradle/Groovy and am running into issues with variable name resolution in nested closures. I have a custom task class that defines some properties and I am instantiating potentially multiple tasks of that type using a closure. This closure defines a variable named the same as one of the properties in the custom task class and I am running into some odd behavior which seems to go against what is defined in the Groovy language guide. Could someone please answer the questions in the code below?</p>
  
  <pre><code>class Something extends DefaultTask {
      def thing = "a"
  }
  /*
  def thing = "b" // produces the error message:
                  // &gt; Could not find method b() for arguments [build_63hfhkn4xq8gcqdsf98mf9qak$_run_closure1@70805a56] on root project 'gradle-test'.
                  // ...why?
  */
  (1..1).each {
      def thing = "c"
      task ("someTask${it}", type: Something) {
          println resolveStrategy == Closure.DELEGATE_FIRST // prints "true"
          println delegate.class // prints "class Something_Decorated"
          println thing // prints "c" shouldn't this be "a" since it's using DELEGATE_FIRST?
          /*
          println owner.thing // produces the error message:
                              // &gt; Could not find property 'thing' on root project 'gradle-test'
                              // shouldn't the "owner" of this closure be the enclosing closure?
                              // in that case shouldn't this resolve to "c"
          */
      }
  }
  </code></pre>
  
  <p><br/>
  <strong>EDIT:</strong> 
  For some reason after changing all of the <code>def</code> into <code>String</code> and then back into <code>def</code> I can no longer replicate the <code>def thing = "b"</code> line producing that weird error</p>