简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM