0
다음 코드 예제입니다 :이상한 행동은
class StaticTest {
static def list = [1, 2, 3]
void printsNothing() {
[].with { list.each { println it } }
}
void printsList() {
new Object().with { list.each { println it } }
}
public static void main(String[] args) {
new StaticTest().with {
println "Expected: "
printsList()
println "Strange: "
printsNothing()
}
}
}
당신이 볼 수 있듯이, 폐쇄 printsNothing
및 printsList
list
인 것처럼 정말로 아무것도 출력하지 printsNothing
로 동일이, 그럼에도 불구하고 결과는 차이가 있습니다 빈. 결과는 다음과 같습니다.
invokedynamic 지원이 활성화 된 상태에서 Groovy 2.2.2를 사용하고 있습니다.
버그인지 또는 Groovy에 대해 알지 못합니다.