RFR: 8251989: Hex formatting and parsing utility [v6]

Chris Hegarty chegar at openjdk.java.net
Tue Oct 20 10:33:28 UTC 2020


On Mon, 12 Oct 2020 22:17:58 GMT, Marcono1234 <github.com+11685886+Marcono1234 at openjdk.org> wrote:

>> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Correct length of StringBuilder in formatHex;
>>   Correct bug in formatHex(char[], 2, 3) and add test for subranges of char[]
>
> src/java.base/share/classes/java/util/HexFormat.java line 836:
> 
>> 834:      *          otherwise {@code false}
>> 835:      */
>> 836:     public boolean isHexDigit(int ch) {
> 
> Should this method be `static`? Or otherwise should it consider the `uppercase()` setting?
> (Same for `fromHexDigit` and all the other subsequent methods)
> 
> These methods being instance methods is likely pretty confusing because they are unrelated to the HexFormat instance
> and makes using them cumbersome because the user has to create a HexFormat instance first.

Agree. I had the very same thought. In fact, these format agnostic methods have little to do with formatting.

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

PR: https://git.openjdk.java.net/jdk/pull/482


More information about the core-libs-dev mailing list