如果我将类分成另一个文件,则groovy文档的标准示例不起作用。彼此相邻的工作正常。
//File: Expandable.groovy
class Expandable {
def storage = [:]
def getProperty(String name) { storage[name] }
void setProperty(String name, value) { storage[name] = value }
}
//File: Main.groovy
def e = new Expandable()
e.foo = "bar"
println e.foo
异常
Caught: groovy.lang.MissingPropertyException: No such property: foo for class: Expandable