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

Reviewed-by: darcy, vromero
This commit is contained in:
Archie L. Cobbs 2023-02-27 16:21:57 +00:00 committed by Vicente Romero
parent f5a12768fb
commit 55e6bb6b85
58 changed files with 240 additions and 391 deletions

View file

@ -42,6 +42,7 @@ import combo.ComboInstance;
import combo.ComboParameter;
import combo.ComboTask;
import combo.ComboTestHelper;
import java.io.InputStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Iterator;
@ -110,7 +111,10 @@ public class ConditionalExpressionResolvePending extends ComboInstance<Condition
if (filesIt.hasNext()) {
throw new IllegalStateException("More than one classfile returned!");
}
byte[] data = file.openInputStream().readAllBytes();
byte[] data;
try (InputStream input = file.openInputStream()) {
data = input.readAllBytes();
}
ClassLoader inMemoryLoader = new ClassLoader() {
protected Class<?> findClass(String name) throws ClassNotFoundException {
if ("Test".equals(name)) {