On Wed, 8 Apr 2026 10:12:46 GMT, Jaikiran Pai <[email protected]> wrote:
>> test/jdk/java/util/jar/JarEntry/GetMethodsReturnClones.java line 76:
>>
>>> 74: static void beforeAll() throws Exception {
>>> 75: Path unsigned = createJar();
>>> 76: Path signed = signJar(unsigned);
>>
>> Should these files be deleted again (maybe in a `@AfterAll`?) after the test
>> finished?
>
> jtreg uses a "scratch" directory for each test. That scratch directory is
> also the "current working directory" of the process that runs the test. So
> when files are created (like in this test), unless explicitly created outside
> of these directories, they get created relative to the scratch directory.
> jtreg manages the lifetime of the scratch directory and if a test fails, then
> it retains the file in those directories (it is configurable). The advantage
> of not deleting these files explicitly in the test is that if a test fails,
> then these files are handy during the investigation and if the test succeeds
> then jtreg itself cleans them up (it's configurable through the "-retain"
> option). So unless there's a specific need to delete these files, it's OK to
> leave them around. We don't enforce it though, and some tests delete them
> explicitly and some leave them around.
Thanks for the detailed explanation!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/30602#discussion_r3050773988