[英]IntelliJ IDEA Not Showing Variables In Debug For Kotlin Main Script (main.kts)
I am running main.kts
Kotlin script in a Kotlin console application project in IntelliJ IDEA.我在 IntelliJ IDEA 的 Kotlin 控制台应用程序项目中运行
main.kts
Kotlin 脚本。 It runs fine, I can debug it too, but don't see any vars or vals defined further up in the script.它运行良好,我也可以调试它,但看不到脚本中进一步定义的任何 var 或 val。
Message where the defined values/variables should be displayed is "Variables are not available".应显示定义的值/变量的消息是“变量不可用”。 If I click around in the stack trace I can see other variables, such as the args that came in the main function of the Kotlin main script.
如果我在堆栈跟踪中单击,我可以看到其他变量,例如 Kotlin 主脚本的主 function 中的参数。
Any thoughts why declared values and variables cannot be seen in the debugger?任何想法为什么在调试器中看不到声明的值和变量?
MacOS 10.15.6 + IDEA CE 2020.3.1 + JDK adopt-openjdk-1.8 was the platform I experienced this problem upon, from where the screenshot came. MacOS 10.15.6 + IDEA CE 2020.3.1 + JDK 采用-openjdk-1.8 是我遇到此问题的平台,截图来自。
Windows 10 + IDEA CE 2020.3.1 + openjdk-15 did not experience this problem. Windows 10 + IDEA CE 2020.3.1 + openjdk-15 没有遇到这个问题。
I fixed the problem by using adopt-openj9-15 with MacOS 10.15.6 + IDEA CE 2020.3.1.我通过在 MacOS 10.15.6 + IDEA CE 2020.3.1 中使用采用 openj9-15 解决了这个问题。 adopt-openj9-15 gives the warning for every main KTS run:
采用-openj9-15 为每个主要的 KTS 运行发出警告:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.intellij.util.ReflectionUtil (file:/Users/ducksnails/Library/Application%20Support/JetBrains/IdeaIC2020.3/plugins/Kotlin/kotlinc/lib/kotlin-compiler.jar) 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
JDKs openjdk-15 & adopt-openjdk-15 do no run or debug main.kts scripts, or kts scripts, at all on MacOS 10.15.6 + IDEA CE 2020.3.1. JDK openjdk-15 和采用openjdk-15 在 MacOS 10.15.6 + IDEA CE 2020.3.1 上根本不运行或调试 main.kts 脚本或 kts 脚本。 The run / debug button silently becomes disabled, hung, and unavailable.
运行/调试按钮静默变为禁用、挂起和不可用。
For the now I'll use adopt-openj9-15 and try to ignore the constant warnings, but I would like to use a JDK that doesn't give the constant warnings, plus see the debug variables.现在我将使用采用 openj9-15 并尝试忽略常量警告,但我想使用不给出常量警告的 JDK,并查看调试变量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.