Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
269 views
in Technique[技术] by (71.8m points)

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. It runs fine, I can debug it too, but don't see any vars or vals defined further up in the script.

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.

Any thoughts why declared values and variables cannot be seen in the debugger?

screenshot

question from:https://stackoverflow.com/questions/65852993/intellij-idea-not-showing-variables-in-debug-for-kotlin-main-script-main-kts

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

Windows 10 + IDEA CE 2020.3.1 + openjdk-15 did not experience this problem.

I fixed the problem by using adopt-openj9-15 with MacOS 10.15.6 + IDEA CE 2020.3.1. adopt-openj9-15 gives the warning for every main KTS run:

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. 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...