RFR: JDK-8317633: Modernize text.testlib.HexDumpReader [v2]

Justin Lu jlu at openjdk.org
Fri Oct 6 21:07:59 UTC 2023


On Fri, 6 Oct 2023 18:58:56 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> Justin Lu has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Reflect review comments
>
> test/jdk/java/text/testlib/HexDumpReader.java line 65:
> 
>> 63:         String hexString = lines.stream().map(String::trim)
>> 64:                 .map(s -> (s.contains("#")) ? s.substring(0, s.indexOf("#")).trim() : s)
>> 65:                 .filter(s -> !s.isEmpty()).collect(Collectors.joining());
> 
> I think the common style is to wrap the line per each stream operation. Also, `trim()` can be done after removing `#` so that trimming is not necessary in that map operation.

Thanks for the review. Talked with Lance offline, and since none of the existing dump files actually use a non-leading comment, I changed the stream to only look for leading comments (removed ternary map operation).

As a result, I adjusted the documentation to state that a valid valid hex dump file format does not allow non-leading comments.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16075#discussion_r1349317598


More information about the core-libs-dev mailing list