Eclipse: Debugging & inspection of variables causes com.sun.jdi.ObjectCollectedException

前端 未结 4 1645
庸人自扰
庸人自扰 2021-02-07 03:15

I debug my program and add here and there a breakpoint. After a stop I want to inspect some of the variables and get sometimes a com.sun.jdi.ObjectCollectedException

相关标签:
4条回答
  • 2021-02-07 03:19

    Right click the variable, then click "Show Logical Structure", uncheck any collection.

    0 讨论(0)
  • 2021-02-07 03:20

    While execution of your code is stopped at a breakpoint:

    1. Right-click the variable in the Variables pane
    2. Clicking on the collections (such as the Array in the image below) will uncheck them
    3. Now you can inspect the variable

    0 讨论(0)
  • 2021-02-07 03:36

    Instead of turning off logical structure, you can add a logical structure formatter, as detailed in this answer: Eclipse debug mode view instance variable values. This prevents the exception and lets you see the variable in a useful way.

    0 讨论(0)
  • 2021-02-07 03:42

    This bug has been fixed in Eclipse 4.18

    https://www.eclipse.org/eclipse/news/4.18/jdt.php

    Stabilized logical structures in Variables view with active GC

    The Debug view no longer breaks when logical structures are shown while the application's garbage collector is active (com.sun.jdi.ObjectCollectedException occurred while retrieving value).

    0 讨论(0)
提交回复
热议问题