RFR 8196740 : Character.digit(int, int) returns wrong value for out of range radix

Ivan Gerasimov ivan.gerasimov at oracle.com
Sat Feb 3 01:14:51 UTC 2018


Hello!

The recent fix for JDK-8196331 [1] appeared to slightly change the behavior.
Specifically, if the radix is greater than MAX_RADIX then the method may 
return a non-negative value, even though the spec requires it must 
return -1 [2].

[1] https://bugs.openjdk.java.net/browse/JDK-8196331
[2] 
https://docs.oracle.com/javase/9/docs/api/java/lang/Character.html#digit-int-int-

Would you please help review the fix?

BUGURL: https://bugs.openjdk.java.net/browse/JDK-8196740
WEBREV: http://cr.openjdk.java.net/~igerasim/8196740/00/webrev/

I suspect that this version may even work a tiny bit faster, as we 
perform less comparisons in a common case.

Thanks in advance!

-- 
With kind regards,
Ivan Gerasimov



More information about the core-libs-dev mailing list