On Fri, 19 Nov 2021 10:10:33 GMT, Andrew Leonard <aleon...@openjdk.org> wrote:

>> Both jar and jmod utilise java.io file operations whose methods define no 
>> ordering of the return file lists, and in fact rely on OS query file 
>> ordering, which can differ by underlying OS architecture.
>> This PR adds sort processing to the creation of such jar's and jmod's to 
>> enable a deterministic content ordering.
>> 
>> Signed-off-by: Andrew Leonard <anleo...@redhat.com>
>
> Andrew Leonard has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8276764: Enable deterministic file content ordering for Jar and Jmod
>   
>   Signed-off-by: Andrew Leonard <anleo...@redhat.com>

The source change looks good.   I have a couple comments for the tests.

test/jdk/tools/jar/ContentOrder.java line 55:

> 53: import jdk.test.lib.util.FileUtils;
> 54: 
> 55: public class ContentOrder {

It'd be useful to include the test cases to verify the `--release` option with 
the specified files and directories as well.

test/jdk/tools/jar/ContentOrder.java line 89:

> 87:         jar("cf test.jar testjar");
> 88:         jar("tf test.jar");
> 89:         println();

Suggestion:

        System.out.println(new String(baos.toByteArray()));


You can simply print the output from `jar tf` command here and the `println` 
method isn't really needed.

test/jdk/tools/jar/CreateJarBenchmark.java line 56:

> 54: import jdk.test.lib.util.FileUtils;
> 55: 
> 56: public class CreateJarBenchmark {

This is a benchmark which should not be run as regression testing.   I wonder 
if we need this benchmark for future use.  If so I would suggest to convert it 
to JMH and place it under `test/micro/org/openjdk/bench/tools/jar` directory.   
I'm okay with or without it in this patch.

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

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

Reply via email to