RFR: 8302685: Some javac unit tests aren't reliably closing open files
Andrey Turbanov
aturbanov at openjdk.org
Sat Feb 25 19:10:06 UTC 2023
On Thu, 16 Feb 2023 21:32:44 GMT, Archie L. Cobbs <duke at openjdk.org> wrote:
> 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`.
test/langtools/tools/javac/T8071847/T8071847.java line 86:
> 84: File writeHexFile(String classFileName, String hexString) throws IOException {
> 85: File f = new File(classFileName);
> 86: try (FileOutputStream output = new FileOutputStream(f)) {
Suggestion:
try (FileOutputStream output = new FileOutputStream(f)) {
-------------
PR: https://git.openjdk.org/jdk/pull/12609
More information about the compiler-dev
mailing list