groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bartoleo <bartolole...@gmail.com>
Subject problem accessing class method from FileTreeBuilder in a closure
Date Fri, 11 Mar 2016 12:29:19 GMT
Hi I'm using FileTreBuilder to create ten dirs with a file in it, the content
is returned by a class method.

Here is an example: 

class MyFileTreeBuilder {
  
  static def testData(){
    "my test data..."
  }
  
  static void main(String[] args) {
  
    def tree = new FileTreeBuilder()
    10.times{index->
      tree.dir("tests/test${index}"){
        file "test.txt", testData() 
      }
      println(new File("tests/test${index}/test.txt").text)
    }
    
  }

}

It seems that FileTreeBuilder cannot find my class method if used in a
closure. (it works correctly if I remove the '10.times...'

Could it be a bug?




--
View this message in context: http://groovy.329449.n5.nabble.com/problem-accessing-class-method-from-FileTreeBuilder-in-a-closure-tp5731840.html
Sent from the Groovy Users mailing list archive at Nabble.com.

Mime
View raw message