mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
6982992: Tests CheckAttributedTree.java, JavacTreeScannerTest.java, and SourceTreeeScannerTest.java timeout
Hoist some invariant code out of a loop Reviewed-by: ksrini
This commit is contained in:
parent
089d748192
commit
4157467833
3 changed files with 24 additions and 14 deletions
|
@ -252,6 +252,13 @@ public class CheckAttributedTree {
|
||||||
error("File " + file + " ignored");
|
error("File " + file + " ignored");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See CR: 6982992 Tests CheckAttributedTree.java, JavacTreeScannerTest.java, and SourceTreeeScannerTest.java timeout
|
||||||
|
StringWriter sw = new StringWriter();
|
||||||
|
PrintWriter pw = new PrintWriter(sw);
|
||||||
|
Reporter r = new Reporter(pw);
|
||||||
|
JavacTool tool = JavacTool.create();
|
||||||
|
StandardJavaFileManager fm = tool.getStandardFileManager(r, null, null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a file.
|
* Read a file.
|
||||||
* @param file the file to be read
|
* @param file the file to be read
|
||||||
|
@ -260,12 +267,8 @@ public class CheckAttributedTree {
|
||||||
* @throws TreePosTest.ParseException if any errors occur while parsing the file
|
* @throws TreePosTest.ParseException if any errors occur while parsing the file
|
||||||
*/
|
*/
|
||||||
List<Pair<JCCompilationUnit, JCTree>> read(File file) throws IOException, AttributionException {
|
List<Pair<JCCompilationUnit, JCTree>> read(File file) throws IOException, AttributionException {
|
||||||
StringWriter sw = new StringWriter();
|
|
||||||
PrintWriter pw = new PrintWriter(sw);
|
|
||||||
Reporter r = new Reporter(pw);
|
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
Charset cs = (encoding == null ? null : Charset.forName(encoding));
|
r.errors = 0;
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(r, null, null);
|
|
||||||
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(file);
|
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(file);
|
||||||
String[] opts = { "-XDshouldStopPolicy=ATTR", "-XDverboseCompilePolicy" };
|
String[] opts = { "-XDshouldStopPolicy=ATTR", "-XDverboseCompilePolicy" };
|
||||||
JavacTask task = tool.getTask(pw, fm, r, Arrays.asList(opts), null, files);
|
JavacTask task = tool.getTask(pw, fm, r, Arrays.asList(opts), null, files);
|
||||||
|
|
|
@ -143,6 +143,13 @@ public abstract class AbstractTreeScannerTest {
|
||||||
|
|
||||||
abstract int test(JCCompilationUnit t);
|
abstract int test(JCCompilationUnit t);
|
||||||
|
|
||||||
|
// See CR: 6982992 Tests CheckAttributedTree.java, JavacTreeScannerTest.java, and SourceTreeeScannerTest.java timeout
|
||||||
|
StringWriter sw = new StringWriter();
|
||||||
|
PrintWriter pw = new PrintWriter(sw);
|
||||||
|
Reporter r = new Reporter(pw);
|
||||||
|
JavacTool tool = JavacTool.create();
|
||||||
|
StandardJavaFileManager fm = tool.getStandardFileManager(r, null, null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a file.
|
* Read a file.
|
||||||
* @param file the file to be read
|
* @param file the file to be read
|
||||||
|
@ -151,11 +158,8 @@ public abstract class AbstractTreeScannerTest {
|
||||||
* @throws TreePosTest.ParseException if any errors occur while parsing the file
|
* @throws TreePosTest.ParseException if any errors occur while parsing the file
|
||||||
*/
|
*/
|
||||||
JCCompilationUnit read(File file) throws IOException, ParseException {
|
JCCompilationUnit read(File file) throws IOException, ParseException {
|
||||||
StringWriter sw = new StringWriter();
|
|
||||||
PrintWriter pw = new PrintWriter(sw);
|
|
||||||
Reporter r = new Reporter(pw);
|
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(r, null, null);
|
r.errors = 0;
|
||||||
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(file);
|
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(file);
|
||||||
JavacTask task = tool.getTask(pw, fm, r, Collections.<String>emptyList(), null, files);
|
JavacTask task = tool.getTask(pw, fm, r, Collections.<String>emptyList(), null, files);
|
||||||
Iterable<? extends CompilationUnitTree> trees = task.parse();
|
Iterable<? extends CompilationUnitTree> trees = task.parse();
|
||||||
|
|
|
@ -249,6 +249,13 @@ public class TreePosTest {
|
||||||
error("File " + file + " ignored");
|
error("File " + file + " ignored");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See CR: 6982992 Tests CheckAttributedTree.java, JavacTreeScannerTest.java, and SourceTreeeScannerTest.java timeout
|
||||||
|
StringWriter sw = new StringWriter();
|
||||||
|
PrintWriter pw = new PrintWriter(sw);
|
||||||
|
Reporter r = new Reporter(pw);
|
||||||
|
JavacTool tool = JavacTool.create();
|
||||||
|
StandardJavaFileManager fm = tool.getStandardFileManager(r, null, null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a file.
|
* Read a file.
|
||||||
* @param file the file to be read
|
* @param file the file to be read
|
||||||
|
@ -257,12 +264,8 @@ public class TreePosTest {
|
||||||
* @throws TreePosTest.ParseException if any errors occur while parsing the file
|
* @throws TreePosTest.ParseException if any errors occur while parsing the file
|
||||||
*/
|
*/
|
||||||
JCCompilationUnit read(File file) throws IOException, ParseException {
|
JCCompilationUnit read(File file) throws IOException, ParseException {
|
||||||
StringWriter sw = new StringWriter();
|
|
||||||
PrintWriter pw = new PrintWriter(sw);
|
|
||||||
Reporter r = new Reporter(pw);
|
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
Charset cs = (encoding == null ? null : Charset.forName(encoding));
|
r.errors = 0;
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(r, null, null);
|
|
||||||
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(file);
|
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(file);
|
||||||
JavacTask task = tool.getTask(pw, fm, r, Collections.<String>emptyList(), null, files);
|
JavacTask task = tool.getTask(pw, fm, r, Collections.<String>emptyList(), null, files);
|
||||||
Iterable<? extends CompilationUnitTree> trees = task.parse();
|
Iterable<? extends CompilationUnitTree> trees = task.parse();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue