Groovy subclass called superclass method that accesses closure

前端 未结 1 888
一个人的身影
一个人的身影 2021-01-19 09:53

I have a groovy superclass that looks like:

class AGroovyClass {
   private String str = \"hello\"
   void printString(int nTimes) {
     nTimes.times { prin         


        
相关标签:
1条回答
  • 2021-01-19 10:34

    It is an old bug with private access modifier. It works if you define str protected. https://issues.apache.org/jira/browse/GROOVY-2433

    edit: Can you avoid closure, use a for loop instead? Not so cool, but works :)

    0 讨论(0)
提交回复
热议问题