On Tue, 1 Dec 2020 11:25:15 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:

>> Roger Riggs has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Clarified hexadecimal characters used in converting from characters to 
>> values to be strictly 0-9, a-f, and A-F.
>>   Added a test to verify isHexDigit and fromHexDigit for the entire range of 
>> chars
>
> src/java.base/share/classes/java/util/HexFormat.java line 887:
> 
>> 885:      * The characters in the range from {@code index} to {@code index + 
>> 1},
>> 886:      * inclusive, must be valid hex digits according to {@link 
>> #fromHexDigit(int)}.
>> 887:      * The delimiter, prefix and suffix are not used.
> 
> In this method - and all similar methods that follow - then is 
> `isUpperCase()` taken into account? If not maybe it should be made explicit - 
> just as for delimiter, prefix, and suffix? 
> Alternatively, remove this line and make the method static. Then it would be 
> clear that upperCase, delimiter, prefix, and suffix are not used.

This is a private method, documented more than is usual.
The fromHexDigit() method it calls is an instance method to be consistent in 
the API with the other methods and still have the context of the HexFormat, 
allowing for possible futures.
(For example, a strict vs lenient setting with respect to uppercase).
The caller is free to use the static method in Character.digit(ch, 16) if that 
is a better fit..

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

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

Reply via email to