RFR: 8276764: Enable deterministic file content ordering for Jar and Jmod
Lance Andersen
lancea at openjdk.java.net
Wed Nov 17 20:24:44 UTC 2021
On Wed, 17 Nov 2021 19:18:19 GMT, Magnus Ihse Bursie <ihse at 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 <anleonar at redhat.com>
>
> src/jdk.jartool/share/classes/sun/tools/jar/Main.java line 828:
>
>> 826: String[] dirFiles = f.list();
>> 827: // Ensure files list is sorted for reproducible jar content
>> 828: if (dirFiles != null)
>
> Style issue. I strongly dislike multi-line if statements without braces. I don't know if that style is followed in the rest of the code, but if it seems to fit in I strongly recommend using braces.
I agree, we should change this to include braces with the if statement.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6395
More information about the compiler-dev
mailing list