7018753: tools/javac/varargs/warning/Warn5.java times out on slow machines
authorjjh
Thu, 24 Feb 2011 08:40:49 -0800
changeset 8613 d8e9b6d6ccee
parent 8612 1512fadfa26c
child 8614 06e42328ddab
7018753: tools/javac/varargs/warning/Warn5.java times out on slow machines Summary: Use a single file manager for all JavacTasks Reviewed-by: jjg, mcimadamore
langtools/test/tools/javac/varargs/6199075/T6199075.java
langtools/test/tools/javac/varargs/warning/Warn4.java
langtools/test/tools/javac/varargs/warning/Warn5.java
--- a/langtools/test/tools/javac/varargs/6199075/T6199075.java	Wed Feb 23 10:34:45 2011 -0800
+++ b/langtools/test/tools/javac/varargs/6199075/T6199075.java	Thu Feb 24 08:40:49 2011 -0800
@@ -37,6 +37,7 @@
 import com.sun.tools.classfile.Code_attribute;
 import com.sun.tools.classfile.ConstantPool.*;
 import com.sun.tools.classfile.Method;
+import com.sun.tools.javac.api.JavacTool;
 import com.sun.tools.javac.util.List;
 
 import java.io.File;
@@ -47,6 +48,7 @@
 import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
 import javax.tools.ToolProvider;
 
 public class T6199075 {
@@ -157,11 +159,14 @@
         System.out.println("Bytecode checks made: " + bytecodeCheckCount);
     }
 
+    // Create a single file manager and reuse it for each compile to save time.
+    StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
+
     void compileAndCheck(VarargsMethod m1, VarargsMethod m2, TypeKind actual, ArgumentsArity argsArity) throws Exception {
         final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
         JavaSource source = new JavaSource(m1, m2, actual, argsArity);
         ErrorChecker ec = new ErrorChecker();
-        JavacTask ct = (JavacTask)tool.getTask(null, null, ec,
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, ec,
                 null, null, Arrays.asList(source));
         ct.generate();
         check(source, ec, m1, m2, actual, argsArity);
--- a/langtools/test/tools/javac/varargs/warning/Warn4.java	Wed Feb 23 10:34:45 2011 -0800
+++ b/langtools/test/tools/javac/varargs/warning/Warn4.java	Thu Feb 24 08:40:49 2011 -0800
@@ -29,6 +29,7 @@
  * @run main Warn4
  */
 import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.JavacTool;
 import java.net.URI;
 import java.util.Arrays;
 import java.util.Set;
@@ -37,6 +38,7 @@
 import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
 import javax.tools.ToolProvider;
 
 public class Warn4 {
@@ -187,12 +189,15 @@
         }
     }
 
+    // Create a single file manager and reuse it for each compile to save time.
+    static StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
+
     static void test(SourceLevel sourceLevel, TrustMe trustMe, SuppressLevel suppressLevelClient,
             SuppressLevel suppressLevelDecl, ModifierKind modKind, Signature vararg_meth, Signature client_meth) throws Exception {
         final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
         JavaSource source = new JavaSource(trustMe, suppressLevelClient, suppressLevelDecl, modKind, vararg_meth, client_meth);
         DiagnosticChecker dc = new DiagnosticChecker();
-        JavacTask ct = (JavacTask)tool.getTask(null, null, dc,
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, dc,
                 Arrays.asList("-Xlint:unchecked", "-source", sourceLevel.sourceKey),
                 null, Arrays.asList(source));
         ct.generate(); //to get mandatory notes
--- a/langtools/test/tools/javac/varargs/warning/Warn5.java	Wed Feb 23 10:34:45 2011 -0800
+++ b/langtools/test/tools/javac/varargs/warning/Warn5.java	Thu Feb 24 08:40:49 2011 -0800
@@ -29,6 +29,7 @@
  * @run main Warn5
  */
 import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.JavacTool;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -36,6 +37,7 @@
 import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
 import javax.tools.ToolProvider;
 
 public class Warn5 {
@@ -207,12 +209,15 @@
         }
     }
 
+    // Create a single file manager and reuse it for each compile to save time.
+    static StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
+
     static void test(SourceLevel sourceLevel, XlintOption xlint, TrustMe trustMe, SuppressLevel suppressLevel,
             ModifierKind modKind, MethodKind methKind, SignatureKind sig, BodyKind body) throws Exception {
         final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
         JavaSource source = new JavaSource(trustMe, suppressLevel, modKind, methKind, sig, body);
         DiagnosticChecker dc = new DiagnosticChecker();
-        JavacTask ct = (JavacTask)tool.getTask(null, null, dc,
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, dc,
                 Arrays.asList(xlint.getXlintOption(), "-source", sourceLevel.sourceKey), null, Arrays.asList(source));
         ct.analyze();
         check(sourceLevel, dc, source, xlint, trustMe,