8193072: File.delete() should remove its path from DeleteOnExitHook.files

Brian Burkhalter brian.burkhalter at oracle.com
Mon Jul 8 21:08:36 UTC 2019

Ivan / Jason,

Thanks for the good observations.

> On Jul 8, 2019, at 1:35 PM, Ivan Gerasimov <ivan.gerasimov at oracle.com> wrote:
> I believe this would introduce a behavior change in a scenario lile:
> File f = ...;
> f.deleteOnExit();
> f.delete();
> f.createNewFile();
> I.e. when the with the same name is recreated.  Current behavior is to unlink such a file before exiting, no matter if it were explicitly deleted and then recreated or not.

Good point. Given this consideration I am not sure that this bug can be fixed.

> On Jul 8, 2019, at 1:53 PM, Jason Mehrens <jason_mehrens at hotmail.com> wrote:
> Previously File.delete wouldn't throw IllegalStateException and with this patch it looks like that is possible (and not desirable).  I would think that this change could the break java.util.logging.FileHandler because Handler.close runs in a shutdown hook.

I think you are correct that the ISE should not be thrown.



More information about the core-libs-dev mailing list