简体   繁体   English

IntelliJ IDEA 未在 Kotlin 主脚本 (main.kts) 的调试中显示变量

[英]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?任何想法为什么在调试器中看不到声明的值和变量?

screenshot截屏

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.

相关问题 IntelliJ IDEA:如何在 Kotlin 中指定主类? - IntelliJ IDEA: How to specify main class in Kotlin? kotlin IntelliJ IDEA 主函数不返回任何内容 - kotlin IntelliJ IDEA main function not returning anything 使用 IntelliJ IDEA 创建 Kotlin jar 时出现“No main manifest attribute” - "No main manifest attribute" when creating Kotlin jar using IntelliJ IDEA intellij IDEA调试模式:线程“main”中的异常java.lang.ClassNotFoundException:kotlinx.coroutines.debug.AgentPremain - intellij IDEA debug mode: Exception in thread "main" java.lang.ClassNotFoundException: kotlinx.coroutines.debug.AgentPremain Kotlin IntelliJ IDEA 更新 - 在包中找不到顶级函数“main()” - Kotlin IntelliJ IDEA update - Top-Level function 'main()' not found in package 无法在IntelliJ Idea中运行或调试Kotlin - Cant Run or Debug Kotlin In IntelliJ Idea 在 IntelliJ IDEA 中,创建和执行依赖于我的项目代码的 kotlin 脚本 (.kts) 的正确方法是什么? - In IntelliJ IDEA, what is the proper way to create and execute kotlin scripts (.kts) that depends on code in my project? 尝试在IntelliJ IDEA中运行Kotlin脚本 - Trying to run Kotlin script in IntelliJ IDEA IntelliJ 2021.2.3 中的 Kotlin 控制台应用程序 -> 无法在运行/调试配置中添加主 class“MainKt” - Kotlin Console Application in IntelliJ 2021.2.3 -> Cannot add main class "MainKt" in Run/Debug configuration 如何在 IntelliJ 中不使用 gradle 执行 Kotlin main - How to not use gradle in IntelliJ to execute Kotlin main
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM