RFR: 8302685: Some javac unit tests aren't reliably closing open files

Archie L. Cobbs duke at openjdk.org
Thu Feb 16 21:39:45 UTC 2023


Some javac unit tests aren't reliably closing open files. Many were written prior to (or without utilizing) try-with-resources.

Leaving files and other resources open can cause problems during automated builds, etc.

This patch updates these tests to use try-with-resource.

Side note: there is at least one unit test that intentionally leaves a file open - `diags/examples/ProcUnclosedTypeFiles/processors/AnnoProc.java`.

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

Commit messages:
 - Use try-with-resources in unit tests to ensure files are closed.

Changes: https://git.openjdk.org/jdk/pull/12609/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12609&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8302685
  Stats: 445 lines in 58 files changed: 54 ins; 205 del; 186 mod
  Patch: https://git.openjdk.org/jdk/pull/12609.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12609/head:pull/12609

PR: https://git.openjdk.org/jdk/pull/12609


More information about the compiler-dev mailing list