发生了非法反射访问操作

4

我正在尝试在Visual Studio Code中使用Kotlin。我刚刚选择了环境路径,但每次尝试运行程序时都会收到以下警告:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.intellij.util.ReflectionUtil to method java.util.ResourceBundle.setParent(java.util.ResourceBundle)
WARNING: Please consider reporting this to the maintainers of com.intellij.util.ReflectionUtil
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

如果我尝试运行

--illegal-access=deny

我遇到了以下错误:
error: unresolved reference: illegal
--illegal-access=deny
  ^
error: variable expected
--illegal-access=deny
  ^
error: unresolved reference: access
--illegal-access=deny
          ^
error: unresolved reference: deny
--illegal-access=deny

我是个初学者,那么我该如何解决这个问题呢? 感谢每一个回答!


1
我猜这可能是一个 bug,将在 Kotlin 1.5 中修复: https://youtrack.jetbrains.com/issue/KT-43520 - Joffrey
1个回答

3
我知道这很烦人,但实际上你不需要太担心。你可以使用标志运行程序,不必太担心警告。如果需要更详细的信息,可以参考一些资源,如https://www.logicbig.com/tutorials/core-java-tutorial/modules/illegal-access-operations.html,其中包含更多详细信息。这更多是为了促使库作者采取行动。
该标志需要传递给执行程序的Java命令。
例如:java --illegal-access=deny --module-path <path> --module <module>/<main-class> [args...]

好的,谢谢!我期待着更新或者其他什么的 :// - Perjesisza597

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接