RFR: 8251989: Hex formatting and parsing utility [v17]
Roger Riggs
rriggs at openjdk.java.net
Fri Dec 4 22:16:21 UTC 2020
On Fri, 4 Dec 2020 20:39:58 GMT, Joe Darcy <darcy at openjdk.org> wrote:
>> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Add class level clarification of use of uppercase for primitive conversions
>> Switched order of declaration of a couple of method to make the javadoc sequence easier to read
>
> src/java.base/share/classes/java/util/HexFormat.java line 936:
>
>> 934: * if any of the characters is not a hexadecimal character
>> 935: */
>> 936: public int fromHexDigits(CharSequence string) {
>
> I recommend this group of methods include an apinote explaining the differences in behavior of compared to parseInt(s, 16) and parseUnsignedInt(s, 16).
Will add:
* @apiNote
* {@link Integer#parseInt(String, int) Integer.parseInt(s, 16)} and
* {@link Integer#parseUnsignedInt(String, int) Integer.pareUnsignedInt(s, 16)}
* are similar but allow all Unicode hexadecimal digits allowed by
* {@link Character#digit(char, int) Character.digit(ch, 16)}.
* {@code HexFormat} uses only Latin1 hexadecimal characters "0-9, "A-F", and "a-f".
* {@link Integer#parseInt(String, int)} can parse signed hexadecimal strings.
And similar text for Long#parseLong and Long.parseUnsignedLong
-------------
PR: https://git.openjdk.java.net/jdk/pull/482
More information about the core-libs-dev
mailing list