Expecting Integer.valueOf(String) to accept Literal format ...
kedar.mhaswade at gmail.com
Fri Apr 8 22:36:52 UTC 2016
While discussing with colleagues, someone said:
However, my main gripe is about not supporting in String representation of
> an integer what is supported in its literal representation.
> Thus, Integer x = 1_000_000; is valid, whereas
> Integer.valueOf("1_000_000") is not. That sucks.
It seems to me that this is a reasonable expectation and has practical
benefits (e.g. accepting program arguments that are integers with _'s).
Supporting underscores in number literals (beginning JDK 7) was meant for
readability of the
Perhaps doing this correctly incurs unwarranted implementation complexity
in the JDK.
As library writers however, how would you explain this mismatch?
Was this side effect
considered at all?
More information about the core-libs-dev