List.getSize() returns different result when run in Eclipse debugger
I found something strange about an eclipse debugger. First of all, when a program runs as a simple Java Application, everything is ok, but when I use debugger some references become null so that I catch NullPointerException.
Here is much more strange example:
System.out.println("the list size is " + list.getSize());
System.out.println("the list size is " + list.getSize());
System.out.println("the list size is " + list.getSize());
System.out.println("the list size is " + list.getSize());
开发者_JAVA技巧
When I start a program the output is : 50, 50, 50, 50.
But when I use debugger the output is : 50, 49, 48, 47. That is REALLY strange, because getSize() method changes nothing.
Do you have any custom code in the debugger ("change value" in variables view accepts statements) that might change the list? Like list.remove()
as a custom value for some variable?
Also check the "detail formatters" for the variables in the variables view, whether there is some code there for this list or some other variable.
It's impossible if the list is created just before and with a single threaded application.
精彩评论