RFR: 8281104: jar --create should create missing parent directories

Lance Andersen lancea at openjdk.java.net
Thu Feb 3 21:46:09 UTC 2022


On Thu, 3 Feb 2022 19:42:25 GMT, Christian Stein <cstein at openjdk.org> wrote:

> Thanks for the review, Lance.
> 
> I didn't change order of creation, validation, and movement of the temporary JAR file in order to keep existing behaviour consistent.

I do think we are better served with the validation check earlier on.  In the case of a failure, we do not make the tmp file name known so it could be easy to miss. 

I think it makes sense to report the issue before erring out after creating the jar..  If the behavior stays as is, it would be best to document that the tmp file would still be there.

Let's see what others think.  Either way we can accomplish the additional change if we reach consensus via a separate PR.
> 
> A reason to use the main-based testing approach was also the ability to run the test via JEP 330: `java CreateMissingParentDirectories.java`

For me personally,  I would not use that means to run the tests as typically  would from an IDE.  Plus there is a benefit of leveraging the test framework in TestNG.    I totally understand everyone has a personal preference.  A discussion for another day I guess ;-).
> 
> > Also, we should update jar.properties to indicate that the directory path will be created as needed in the help section for jar.
> 
> That's a good point. Where would we put that information?
> 
> * [ ]  Extend the descriptions of option `c`/`--create` and/or option `f`/`--file`?

I think this would be the appropriate place for documenting the behavior.

> * [ ]  As a post scriptum note below the options?
>   https://github.com/openjdk/jdk/blob/master/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties#L309-L317


Also we will need to update the MD file which represents the jar man page via a separate PR.

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

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


More information about the compiler-dev mailing list