英文:
When debugging in IntelliJ IDEA, how do I prevent variables from being affected while the thread is suspended?
问题
抱歉,标题可能有些混乱,但我对手头的问题感到困惑。
目前,在我通过调试器运行我的简单程序时,当我逐步执行程序时,刚刚设置的变量会变成 null。然后这会影响我正在逐步执行的其余代码行。
当正常运行程序时,它完全正常地按预期工作。就好像在调试暂停的时候,Java 将其视为垃圾进行回收,而在正常运行时,变量的活动使用会阻止这种情况。
步骤 1:
步骤 2:
英文:
Sorry for the confusing titles but I confused on the issue at hand.
Currently when I run my simple program through the debugger, as I step through the program the variables that were just set are changed to null. This then affects the rest of the lines I am stepping through.
When running the program regularly it works perfectly normal and as expected. It's almost as if java is collecting it as garbage while the program is suspended in debug and when it runs normally, the active use of the variables prevents this.
Step 1:
Step 2:
答案1
得分: 2
禁用设置(macOS上的首选项)| 构建、执行、部署 | 调试器 | 数据视图 | Java | 启用 'toString()' 对象视图。
英文:
Disable Settings (Preferences on macOS) | Build, Execution, Deployment | Debugger | Data Views | Java | Enable 'toString()' object view.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论