RFR: 8317980: Optimization for Integer.parseInt and Long.parseLong

Chen Liang liach at openjdk.org
Thu Oct 12 02:20:50 UTC 2023


On Thu, 12 Oct 2023 00:06:30 GMT, Shaojin Wen <duke at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/Integer.java line 560:
>> 
>>> 558:         if (radix > Character.MAX_RADIX) {
>>> 559:             throw NumberFormatException.forMaxRadix(radix);
>>> 560:         }
>> 
>> It sounds like these methods are now already under the default common inline threshold, but wondering if it would be worthwhile to pull out the radix validation to a separate method.
>
> Code style should be consistent

He means to pull the `radix< Character,MIN_RADIX` and `radix > Character.MAX_RADIX` shared code in Integer and Long.parseInt (with radix version) to a helper method.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16112#discussion_r1355904991


More information about the core-libs-dev mailing list