2

在 groovy 编译我的程序后,我在预期结果之前得到了这个错误。请问,我该如何解决这个问题?

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/Users/xxxx/.sdkman/candidates/groovy/current/lib/groovy-2.5.8.jar) to construc
tor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

这是我的代码

public class Todo {
    String name
    String note

    public static void main(String[] args) {

        def todos = [
            new Todo(name:"1", note:"one"),
            new Todo(name:"1", note:"one"),
            new Todo(name:"1", note:"one")
        ]

        todos.each {
            println "${it.name} ${it.note}"
        }

    }
}

我期待这个结果没有错误消息

1 one
1 one
1 one
4

0 回答 0