test/tools/javac/varargs/6199075/T6199075.java

changeset 892
3e30c95da3c6
parent 787
b1c98bfd4709
child 962
0ff2bbd38f10
     1.1 --- a/test/tools/javac/varargs/6199075/T6199075.java	Wed Feb 23 10:34:45 2011 -0800
     1.2 +++ b/test/tools/javac/varargs/6199075/T6199075.java	Thu Feb 24 08:40:49 2011 -0800
     1.3 @@ -37,6 +37,7 @@
     1.4  import com.sun.tools.classfile.Code_attribute;
     1.5  import com.sun.tools.classfile.ConstantPool.*;
     1.6  import com.sun.tools.classfile.Method;
     1.7 +import com.sun.tools.javac.api.JavacTool;
     1.8  import com.sun.tools.javac.util.List;
     1.9  
    1.10  import java.io.File;
    1.11 @@ -47,6 +48,7 @@
    1.12  import javax.tools.JavaCompiler;
    1.13  import javax.tools.JavaFileObject;
    1.14  import javax.tools.SimpleJavaFileObject;
    1.15 +import javax.tools.StandardJavaFileManager;
    1.16  import javax.tools.ToolProvider;
    1.17  
    1.18  public class T6199075 {
    1.19 @@ -157,11 +159,14 @@
    1.20          System.out.println("Bytecode checks made: " + bytecodeCheckCount);
    1.21      }
    1.22  
    1.23 +    // Create a single file manager and reuse it for each compile to save time.
    1.24 +    StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
    1.25 +
    1.26      void compileAndCheck(VarargsMethod m1, VarargsMethod m2, TypeKind actual, ArgumentsArity argsArity) throws Exception {
    1.27          final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
    1.28          JavaSource source = new JavaSource(m1, m2, actual, argsArity);
    1.29          ErrorChecker ec = new ErrorChecker();
    1.30 -        JavacTask ct = (JavacTask)tool.getTask(null, null, ec,
    1.31 +        JavacTask ct = (JavacTask)tool.getTask(null, fm, ec,
    1.32                  null, null, Arrays.asList(source));
    1.33          ct.generate();
    1.34          check(source, ec, m1, m2, actual, argsArity);

mercurial