【发布时间】:2019-03-26 14:22:01
【问题描述】:
当我在 JDK 11 上运行 Groovy 2.5.3 时,它会发出警告消息:
groovy -e 'print "hi"'
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/home/user/.sdkman/candidates/groovy/current/lib/groovy-2.5.3.jar) to constructor 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
是否有禁用此警告消息的选项?
【问题讨论】:
-
似乎有针对这个问题的公开 PR:github.com/apache/groovy/pull/811
-
在我们修复底层代码之前,您可以将
GROOVY_TURN_OFF_JAVA_WARNINGS环境变量设置为true。 -
感谢 Paul,现在又发出警告
WARNING: package sun.awt.windows not in java.desktop -
我想你是在 *nix 上?您能否尝试从您的 startGroovy shell 脚本中删除“--add-opens=java.desktop/sun.awt.windows=ALL-UNNAMED”。在 MS Windows 操作系统上时需要它,但当它发现它在 cygwin 或类似操作系统上时,我们并没有使其成为条件。
-
@phalgun 也许这次更新会对你有所帮助:opencollective.com/friends-of-groovy/updates/…