Loading... (original) (raw)

A DESCRIPTION OF THE PROBLEM :
I find a strange problem in oracle jdk(jdk8,jdk9)

the problem is :
java BigDecimal class toString() return different value when use idea run and idea debug

code:
BigDecimal bigDecimal = new BigDecimal("1");
System.out.println(bigDecimal.toString());

it is very simple , the value is 1 when we run the code.
but when we add a breaking point in the BigDecimal class source code(the line is 428, if (offset + len > in.length || offset < 0)) ,then we debug the code ,the return value is 0.
i don't known the reason .

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
CODE:
BigDecimal bigDecimal = new BigDecimal("1");
System.out.println(bigDecimal.toString());

desc
when we add a breaking point in the BigDecimal class source code(the line is 428, if (offset + len > in.length || offset < 0)) ,then we debug the code ,the return value is 0.

FREQUENCY : always