8062348: langtools tests should close file manager (group 1)

Reviewed-by: darcy
This commit is contained in:
Jonathan Gibbons 2014-10-29 17:25:23 -07:00
parent b587478f7c
commit 8bd23f1681
145 changed files with 2701 additions and 2452 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -66,22 +66,23 @@ public class DocTreePathScannerTest {
}
JavacTool javac = JavacTool.create();
StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);
try (StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null)) {
Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
JavacTask t = javac.getTask(null, fm, null, null, null, fos);
DocTrees trees = DocTrees.instance(t);
JavacTask t = javac.getTask(null, fm, null, null, null, fos);
DocTrees trees = DocTrees.instance(t);
Iterable<? extends CompilationUnitTree> units = t.parse();
Iterable<? extends CompilationUnitTree> units = t.parse();
DeclScanner ds = new DeclScanner(trees);
for (CompilationUnitTree unit: units) {
ds.scan(unit, null);
DeclScanner ds = new DeclScanner(trees);
for (CompilationUnitTree unit: units) {
ds.scan(unit, null);
}
if (errors > 0)
throw new Exception(errors + " errors occurred");
}
if (errors > 0)
throw new Exception(errors + " errors occurred");
}
void error(String msg) {