首页 > 解决方案 > 运行 Kotlin 时这些非法访问警告是什么以及如何阻止它们?

问题描述

我是 Kotlin 的新手,在运行任何脚本时,终端都会抛出这些警告。

Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
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

这些是什么,我该如何隐藏它们?如果有帮助,
我正在使用Kotlin version 1.4.21-release-351 (JRE 15.0.1+9-18)

标签: javakotlin

解决方案


也点击这个问题,在https://youtrack.jetbrains.com/issue/KT-43520打开问题

https://github.com/yschimke/okurl-scripts/issues/3

目前,最好的选择是将 JAVA_HOME 设置为 1.8 而不是 9+。

https://raw.githubusercontent.com/yschimke/okurl-scripts/master/commands/tube-status.main.kts

$  ./tube-status.main.kts
Bakerloo    Good Service
Central Good Service
Circle  Minor Delays
District    Part Closure
Hammersmith & City  Minor Delays
Jubilee Good Service
Metropolitan    Minor Delays
Northern    Good Service
Piccadilly  Part Closure
Victoria    Good Service
Waterloo & City Planned Closure

推荐阅读