On Mon, 15 Nov 2021 18:47:34 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>

Overall I think the change looks sane. A 1% performance penalty for tens of 
thousands of files in a single directory might be acceptable, since that is 
unusual.

Alan or someone else have to say if this needs a CSR, and/or a implNote.

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.

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

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

Reply via email to