[9] RFR 8055251: Re-examine Integer.parseInt and Long.parseLong methods
Hi, I'm requesting reviews and a sponsor for these changes to the recently added parse methods (8041972), suggested during discussions on net-dev: bug: https://bugs.openjdk.java.net/browse/JDK-8055251 webrev: http://cr.openjdk.java.net/~redestad/8055251/webrev.1/ discussion:http://mail.openjdk.java.net/pipermail/net-dev/2014-August/008625.html Changes: - Removethe following methods: Integer::parseInt(CharSequence s, int radix, int beginIndex) Integer::parseUnsignedInt(CharSequence s, int radix, int beginIndex) Long::parseLong(CharSequence s, int radix, int beginIndex) Long::parseUnsignedLong(CharSequence s, int radix, int beginIndex) - Move radix parameter to the end in the following methods: Integer::parseInt(CharSequence s, int radix, int beginIndex, int endIndex) Integer::parseUnsignedInt(CharSequence s, int radix, int beginIndex, int endIndex) Long::parseLong(CharSequence s, int radix, int beginIndex, int endIndex) Long::parseUnsignedLong(CharSequence s, int radix, int beginIndex, int endIndex) - Change all places in the code where the methods already have been adopted - Add some tests for parseUnsignedInt/-Long - Ensure that when parsing fails the correct index is reported in the exception /Claes
On 05/09/2014 14:03, Claes Redestad wrote:
Hi,
I'm requesting reviews and a sponsor for these changes to the recently added parse methods (8041972), suggested during discussions on net-dev:
bug: https://bugs.openjdk.java.net/browse/JDK-8055251 webrev: http://cr.openjdk.java.net/~redestad/8055251/webrev.1/ Thanks for doing this, I think the API is much better now and much less error prone.
The drive-by fix to the index in the NumberFormatException also looks good. -Alan.
On 09/05/2014 03:49 PM, Alan Bateman wrote:
On 05/09/2014 14:03, Claes Redestad wrote:
Hi,
I'm requesting reviews and a sponsor for these changes to the recently added parse methods (8041972), suggested during discussions on net-dev:
bug: https://bugs.openjdk.java.net/browse/JDK-8055251 webrev: http://cr.openjdk.java.net/~redestad/8055251/webrev.1/ Thanks for doing this, I think the API is much better now and much less error prone.
The drive-by fix to the index in the NumberFormatException also looks good.
Thanks! /Claes
-Alan.
On 09/10/2014 01:55 PM, Claes Redestad wrote:
On 09/05/2014 03:49 PM, Alan Bateman wrote:
On 05/09/2014 14:03, Claes Redestad wrote:
Hi,
I'm requesting reviews and a sponsor for these changes to the recently added parse methods (8041972), suggested during discussions on net-dev:
bug: https://bugs.openjdk.java.net/browse/JDK-8055251 webrev: http://cr.openjdk.java.net/~redestad/8055251/webrev.1/ Thanks for doing this, I think the API is much better now and much less error prone.
The drive-by fix to the index in the NumberFormatException also looks good.
Thanks!
/Claes
Looks good to me, nitpicking, line 672 of Long.java, I think it's better to use a for instead of a while, the incrementation will be more obvious. Also, but it's not fully related to this patch, the first line of parseInt/parseLong(CharSequence, int, int, int) is uncommon, s = Objects.requireNonNull(s); can be simplified to Objects.requireNonNull(s); regards, Rémi
-Alan.
participants (3)
-
Alan Bateman
-
Claes Redestad
-
Remi Forax