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
@ -54,31 +54,32 @@ public class NoStringToLower {
*/
boolean run(String... args) throws Exception {
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
JavaFileManager fm = c.getStandardFileManager(null, null, null);
JavaFileManager.Location javacLoc = findJavacLocation(fm);
String[] pkgs = {
"javax.annotation.processing",
"javax.lang.model",
"javax.tools",
"com.sun.source",
"com.sun.tools.classfile",
"com.sun.tools.doclet",
"com.sun.tools.doclint",
"com.sun.tools.javac",
"com.sun.tools.javadoc",
"com.sun.tools.javah",
"com.sun.tools.javap",
"com.sun.tools.jdeps",
"com.sun.tools.sjavac"
};
for (String pkg: pkgs) {
for (JavaFileObject fo: fm.list(javacLoc,
pkg, EnumSet.of(JavaFileObject.Kind.CLASS), true)) {
scan(fo);
try (JavaFileManager fm = c.getStandardFileManager(null, null, null)) {
JavaFileManager.Location javacLoc = findJavacLocation(fm);
String[] pkgs = {
"javax.annotation.processing",
"javax.lang.model",
"javax.tools",
"com.sun.source",
"com.sun.tools.classfile",
"com.sun.tools.doclet",
"com.sun.tools.doclint",
"com.sun.tools.javac",
"com.sun.tools.javadoc",
"com.sun.tools.javah",
"com.sun.tools.javap",
"com.sun.tools.jdeps",
"com.sun.tools.sjavac"
};
for (String pkg: pkgs) {
for (JavaFileObject fo: fm.list(javacLoc,
pkg, EnumSet.of(JavaFileObject.Kind.CLASS), true)) {
scan(fo);
}
}
}
return (errors == 0);
return (errors == 0);
}
}
// depending on how the test is run, javac may be on bootclasspath or classpath