Why this matters
File.deleteOnExit() only deletes files on a normal JVM shutdown, and memory associated with handlers is released only at the end of the process, which can cause resource leaks.
deleteOnExit()Ensure that File.deleteOnExit() is not used, as it can cause memory and resource leaks.
File.deleteOnExit() only deletes files on a normal JVM shutdown, and memory associated with handlers is released only at the end of the process, which can cause resource leaks.
Side-by-side examples engineers can pattern-match during review.
File file = new File("file.txt");
file.deleteOnExit(); // Noncompliant// (no example provided)From the same buckets as this rule.