8052398: Uniqify test framework class names
authorjjg
Fri, 12 Aug 2016 17:45:31 -0700
changeset 40316 20b50a99fe8d
parent 40315 9e994c77db6a
child 40317 78115e0f10f3
8052398: Uniqify test framework class names Reviewed-by: darcy
langtools/test/tools/javac/MethodParameters/AnnotationTest.java
langtools/test/tools/javac/MethodParameters/AnonymousClass.java
langtools/test/tools/javac/MethodParameters/ClassFileVisitor.java
langtools/test/tools/javac/MethodParameters/Constructors.java
langtools/test/tools/javac/MethodParameters/EnumTest.java
langtools/test/tools/javac/MethodParameters/InstanceMethods.java
langtools/test/tools/javac/MethodParameters/LambdaTest.java
langtools/test/tools/javac/MethodParameters/LocalClassTest.java
langtools/test/tools/javac/MethodParameters/MemberClassTest.java
langtools/test/tools/javac/MethodParameters/MethodParametersTester.java
langtools/test/tools/javac/MethodParameters/ReflectionVisitor.java
langtools/test/tools/javac/MethodParameters/StaticMethods.java
langtools/test/tools/javac/MethodParameters/Tester.java
langtools/test/tools/javac/MethodParameters/UncommonParamNames.java
langtools/test/tools/javac/options/modes/AtFilesTest.java
langtools/test/tools/javac/options/modes/DocLintTest.java
langtools/test/tools/javac/options/modes/FSInfoTest.java
langtools/test/tools/javac/options/modes/InfoOptsTest.java
langtools/test/tools/javac/options/modes/NoOperandsTest.java
langtools/test/tools/javac/options/modes/OptionModesTester.java
langtools/test/tools/javac/options/modes/OutputDirTest.java
langtools/test/tools/javac/options/modes/ProfileBootClassPathTest.java
langtools/test/tools/javac/options/modes/ProfileTargetTest.java
langtools/test/tools/javac/options/modes/SourceTargetTest.java
langtools/test/tools/javac/options/modes/StdOutTest.java
langtools/test/tools/javac/options/modes/Tester.java
langtools/test/tools/javadoc/annotations/annotateMethodsFields/Main.java
langtools/test/tools/javadoc/annotations/annotatePackage/Main.java
langtools/test/tools/javadoc/annotations/annotateParams/Main.java
langtools/test/tools/javadoc/annotations/badVals/Main.java
langtools/test/tools/javadoc/annotations/defaults/Main.java
langtools/test/tools/javadoc/annotations/elementTypes/Main.java
langtools/test/tools/javadoc/annotations/missing/Main.java
langtools/test/tools/javadoc/annotations/shortcuts/Main.java
langtools/test/tools/javadoc/enum/docComments/Main.java
langtools/test/tools/javadoc/enum/enumType/Main.java
langtools/test/tools/javadoc/generics/genericClass/Main.java
langtools/test/tools/javadoc/generics/genericInnerAndOuter/Main.java
langtools/test/tools/javadoc/generics/genericInterface/Main.java
langtools/test/tools/javadoc/generics/genericMethod/Main.java
langtools/test/tools/javadoc/generics/genericSuper/Main.java
langtools/test/tools/javadoc/generics/supertypes/Main.java
langtools/test/tools/javadoc/generics/throwsGeneric/Main.java
langtools/test/tools/javadoc/generics/tparamCycle/Main.java
langtools/test/tools/javadoc/generics/tparamTagOnMethod/Main.java
langtools/test/tools/javadoc/generics/tparamTagOnType/Main.java
langtools/test/tools/javadoc/generics/wildcards/Main.java
langtools/test/tools/javadoc/lib/OldToolTester.java
langtools/test/tools/javadoc/lib/Tester.java
langtools/test/tools/javadoc/varArgs/Main.java
langtools/test/tools/javap/output/JavapTester.java
langtools/test/tools/javap/output/RepeatingTypeAnnotations.java
langtools/test/tools/javap/output/Tester.java
--- a/langtools/test/tools/javac/MethodParameters/AnnotationTest.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/MethodParameters/AnnotationTest.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -26,9 +26,9 @@
  * @bug 8006582
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build Tester
+ * @build MethodParametersTester
  * @compile -parameters AnnotationTest.java
- * @run main Tester AnnotationTest AnnotationTest.out
+ * @run main MethodParametersTester AnnotationTest AnnotationTest.out
  */
 
 import java.lang.annotation.*;
--- a/langtools/test/tools/javac/MethodParameters/AnonymousClass.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/MethodParameters/AnonymousClass.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -26,9 +26,9 @@
  * @bug 8006582
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build Tester
+ * @build MethodParametersTester
  * @compile -parameters AnonymousClass.java
- * @run main Tester AnonymousClass AnonymousClass.out
+ * @run main MethodParametersTester AnonymousClass AnonymousClass.out
  */
 
 class AnonymousClass {
--- a/langtools/test/tools/javac/MethodParameters/ClassFileVisitor.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/MethodParameters/ClassFileVisitor.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -52,9 +52,9 @@
  * rule is checked: <i>param[n] == ++param[n-1].charAt(0) + param[n-1]</i>
  * </ul>
  */
-class ClassFileVisitor extends Tester.Visitor {
+class ClassFileVisitor extends MethodParametersTester.Visitor {
 
-    Tester tester;
+    MethodParametersTester tester;
 
     public String cname;
     public boolean isEnum;
@@ -66,7 +66,7 @@
     public ClassFile classFile;
 
 
-    public ClassFileVisitor(Tester tester) {
+    public ClassFileVisitor(MethodParametersTester tester) {
         super(tester);
     }
 
--- a/langtools/test/tools/javac/MethodParameters/Constructors.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/MethodParameters/Constructors.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -26,9 +26,9 @@
  * @bug 8006582
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build Tester
+ * @build MethodParametersTester
  * @compile -parameters Constructors.java
- * @run main Tester Constructors Constructors.out
+ * @run main MethodParametersTester Constructors Constructors.out
  */
 
 public class Constructors {
--- a/langtools/test/tools/javac/MethodParameters/EnumTest.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/MethodParameters/EnumTest.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -26,9 +26,9 @@
  * @bug 8006582 8008658
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build Tester
+ * @build MethodParametersTester
  * @compile -parameters EnumTest.java
- * @run main Tester EnumTest EnumTest.out
+ * @run main MethodParametersTester EnumTest EnumTest.out
  */
 
 /** Test that parameter names are recorded for enum methods */
--- a/langtools/test/tools/javac/MethodParameters/InstanceMethods.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/MethodParameters/InstanceMethods.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -26,9 +26,9 @@
  * @bug 8006582
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build Tester
+ * @build MethodParametersTester
  * @compile -parameters InstanceMethods.java
- * @run main Tester InstanceMethods InstanceMethods.out
+ * @run main MethodParametersTester InstanceMethods InstanceMethods.out
  */
 
 public class InstanceMethods {
--- a/langtools/test/tools/javac/MethodParameters/LambdaTest.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/MethodParameters/LambdaTest.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -26,9 +26,9 @@
  * @bug 8006582 8037546 8138729
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build Tester
+ * @build MethodParametersTester
  * @compile -parameters LambdaTest.java
- * @run main Tester LambdaTest LambdaTest.out
+ * @run main MethodParametersTester LambdaTest LambdaTest.out
  */
 
 /**
--- a/langtools/test/tools/javac/MethodParameters/LocalClassTest.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/MethodParameters/LocalClassTest.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -26,9 +26,9 @@
  * @bug 8006582 8008658
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build Tester
+ * @build MethodParametersTester
  * @compile -parameters LocalClassTest.java
- * @run main Tester LocalClassTest LocalClassTest.out
+ * @run main MethodParametersTester LocalClassTest LocalClassTest.out
  */
 
 class LocalClassTest {
--- a/langtools/test/tools/javac/MethodParameters/MemberClassTest.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/MethodParameters/MemberClassTest.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -26,9 +26,9 @@
  * @bug 8006582 8008658
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build Tester
+ * @build MethodParametersTester
  * @compile -parameters MemberClassTest.java
- * @run main Tester MemberClassTest MemberClassTest.out
+ * @run main MethodParametersTester MemberClassTest MemberClassTest.out
  */
 
 class MemberClassTest {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/MethodParameters/MethodParametersTester.java	Fri Aug 12 17:45:31 2016 -0700
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2013, 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.lang.reflect.Constructor;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Test driver for MethodParameters testing.
+ * <p>
+ * The intended use of this driver is to run it, giving the name of
+ * a single class compiled with -parameters as argument. The driver
+ * will test the specified class, and any nested classes it finds.
+ * <p>
+ * Each class is tested in two way. By refelction, and by directly
+ * checking MethodParameters attributes in the classfile. The checking
+ * is done using two visitor classes {@link ClassFileVisitor} and
+ * {@link ReflectionVisitor}.
+ * <p>
+ * The {@code ReflectionVisitor} test logically belongs with library tests.
+ * we wish to reuse the same test-cases, so both test are committed together,
+ * under langtools. The tests, may be duplicated in the jdk repository.
+ */
+public class MethodParametersTester {
+
+    final static File classesdir = new File(System.getProperty("test.classes", "."));
+
+    private String classname;
+    private File[] files;
+    private File refFile;
+    private int errors;
+    private int warnings;
+    private int diffGolden;
+
+    /**
+     * The visitor classes that does the actual checking are referenced
+     * statically, to force compilations, without having to reference
+     * them in individual test cases.
+     * <p>
+     * This makes it easy to change the set of visitors, without
+     * complicating the design with dynamic discovery and compilation
+     * of visitor classes.
+     */
+    static final Class visitors[] = {
+        ClassFileVisitor.class,
+        ReflectionVisitor.class
+    };
+
+    /**
+     * Test-driver expect a single classname as argument.
+     */
+    public static void main(String... args) throws Exception {
+        if (args.length != 2) {
+            throw new Error("A single class name and a golden file are expected as argument");
+        }
+        String testSrc = System.getProperty("test.src");
+        String testName = args[0];
+        String testGoldenFile = args[1];
+        final String pattern = testName + ".*\\.class";
+        File refFile = new File(testSrc, testGoldenFile);
+        File[] files = classesdir.listFiles(new FileFilter() {
+                public boolean accept(File f) {
+                    return f.getName().matches(pattern);
+                }
+            });
+        if (files.length == 0) {
+            File file = new File(classesdir, testName + ".class");
+            throw new Error(file.getPath() + " not found");
+        }
+
+        new MethodParametersTester(testName, files, refFile).run();
+    }
+
+    public MethodParametersTester(String name, File[] files, File refFile) {
+        this.classname = name;
+        this.files = files;
+        this.refFile = refFile;
+    }
+
+    void run() throws Exception {
+
+        // Test with each visitor
+        for (Class<Visitor> vclass : visitors) {
+            boolean compResult = false;
+            try {
+                String vname = vclass.getName();
+                Constructor c = vclass.getConstructor(MethodParametersTester.class);
+
+                info("\nRun " + vname + " for " + classname + "\n");
+                StringBuilder sb = new StringBuilder();
+                for (File f : files) {
+                    String fname = f.getName();
+                    fname = fname.substring(0, fname.length() - 6);
+                    Visitor v = (Visitor) c.newInstance(this);
+                    try {
+                        v.visitClass(fname, f,  sb);
+                    } catch(Exception e) {
+                        error("Uncaught exception in visitClass()");
+                        e.printStackTrace();
+                    }
+                }
+                String output = sb.toString();
+                info(output);
+                compResult = compareOutput(refFile, output);
+            } catch(ReflectiveOperationException e) {
+                warn("Class " + vclass.getName() + " ignored, not a Visitor");
+                continue;
+            }
+            if (!compResult) {
+                diffGolden++;
+                error("The output from " + vclass.getName() + " did not match golden file.");
+        }
+        }
+
+        if (0 != diffGolden)
+            throw new Exception("Test output is not equal with golden file.");
+
+        if(0 != warnings)
+                System.err.println("Test generated " + warnings + " warnings");
+
+        if(0 != errors)
+            throw new Exception("Tester test failed with " +
+                                errors + " errors");
+    }
+    // Check if test output matches the golden file.
+    boolean compareOutput(File refFile, String sb)
+            throws FileNotFoundException, IOException {
+
+        List<String> refFileList = Files.readAllLines(refFile.toPath(), StandardCharsets.UTF_8);
+        List<String> sbList = Arrays.asList(sb.split("[\r\n]+"));
+        // Check if test output contains unexpected lines or is missing expected lines.
+        List<String> sbOnly = new ArrayList<>(sbList);
+        sbOnly.removeAll(refFileList);
+        for (String line: sbOnly)
+            error("unexpected line found: " + line);
+
+        List<String> refOnly = new ArrayList<>(refFileList);
+        refOnly.removeAll(sbList);
+        for (String line: refOnly)
+            error("expected line not found: " + line);
+
+        return sbOnly.isEmpty() && refOnly.isEmpty();
+    }
+
+    abstract static  class Visitor {
+        MethodParametersTester tester;
+        File classesdir;
+
+        public Visitor(MethodParametersTester tester) {
+            this.tester = tester;
+        }
+
+        abstract void visitClass(final String classname, final File  cfile,
+                final StringBuilder sb) throws Exception;
+
+        public void error(String msg) {
+            tester.error(msg);
+        }
+
+        public void warn(String msg) {
+            tester.warn(msg);
+        }
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    void warn(String msg) {
+        System.err.println("Warning: " + msg);
+        warnings++;
+    }
+
+    void info(String msg) {
+        System.out.println(msg);
+    }
+}
--- a/langtools/test/tools/javac/MethodParameters/ReflectionVisitor.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/MethodParameters/ReflectionVisitor.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -27,9 +27,9 @@
 /**
  * Test MethodParameter attributs by reflection API
  */
-public class ReflectionVisitor extends Tester.Visitor {
+public class ReflectionVisitor extends MethodParametersTester.Visitor {
 
-    public ReflectionVisitor(Tester tester) {
+    public ReflectionVisitor(MethodParametersTester tester) {
         super(tester);
     }
 
--- a/langtools/test/tools/javac/MethodParameters/StaticMethods.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/MethodParameters/StaticMethods.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -26,9 +26,9 @@
  * @bug 8006582
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build Tester
+ * @build MethodParametersTester
  * @compile -parameters StaticMethods.java
- * @run main Tester StaticMethods StaticMethods.out
+ * @run main MethodParametersTester StaticMethods StaticMethods.out
  */
 
 public class StaticMethods {
--- a/langtools/test/tools/javac/MethodParameters/Tester.java	Fri Aug 12 16:03:36 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,202 +0,0 @@
-/*
- * Copyright (c) 2013, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.*;
-import java.lang.reflect.Constructor;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Test driver for MethodParameters testing.
- * <p>
- * The intended use of this driver is to run it, giving the name of
- * a single class compiled with -parameters as argument. The driver
- * will test the specified class, and any nested classes it finds.
- * <p>
- * Each class is tested in two way. By refelction, and by directly
- * checking MethodParameters attributes in the classfile. The checking
- * is done using two visitor classes {@link ClassFileVisitor} and
- * {@link ReflectionVisitor}.
- * <p>
- * The {@code ReflectionVisitor} test logically belongs with library tests.
- * we wish to reuse the same test-cases, so both test are committed together,
- * under langtools. The tests, may be duplicated in the jdk repository.
- */
-public class Tester {
-
-    final static File classesdir = new File(System.getProperty("test.classes", "."));
-
-    private String classname;
-    private File[] files;
-    private File refFile;
-    private int errors;
-    private int warnings;
-    private int diffGolden;
-
-    /**
-     * The visitor classes that does the actual checking are referenced
-     * statically, to force compilations, without having to reference
-     * them in individual test cases.
-     * <p>
-     * This makes it easy to change the set of visitors, without
-     * complicating the design with dynamic discovery and compilation
-     * of visitor classes.
-     */
-    static final Class visitors[] = {
-        ClassFileVisitor.class,
-        ReflectionVisitor.class
-    };
-
-    /**
-     * Test-driver expect a single classname as argument.
-     */
-    public static void main(String... args) throws Exception {
-        if (args.length != 2) {
-            throw new Error("A single class name and a golden file are expected as argument");
-        }
-        String testSrc = System.getProperty("test.src");
-        String testName = args[0];
-        String testGoldenFile = args[1];
-        final String pattern = testName + ".*\\.class";
-        File refFile = new File(testSrc, testGoldenFile);
-        File[] files = classesdir.listFiles(new FileFilter() {
-                public boolean accept(File f) {
-                    return f.getName().matches(pattern);
-                }
-            });
-        if (files.length == 0) {
-            File file = new File(classesdir, testName + ".class");
-            throw new Error(file.getPath() + " not found");
-        }
-
-        new Tester(testName, files, refFile).run();
-    }
-
-    public Tester(String name, File[] files, File refFile) {
-        this.classname = name;
-        this.files = files;
-        this.refFile = refFile;
-    }
-
-    void run() throws Exception {
-
-        // Test with each visitor
-        for (Class<Visitor> vclass : visitors) {
-            boolean compResult = false;
-            try {
-                String vname = vclass.getName();
-                Constructor c = vclass.getConstructor(Tester.class);
-
-                info("\nRun " + vname + " for " + classname + "\n");
-                StringBuilder sb = new StringBuilder();
-                for (File f : files) {
-                    String fname = f.getName();
-                    fname = fname.substring(0, fname.length() - 6);
-                    Visitor v = (Visitor) c.newInstance(this);
-                    try {
-                        v.visitClass(fname, f,  sb);
-                    } catch(Exception e) {
-                        error("Uncaught exception in visitClass()");
-                        e.printStackTrace();
-                    }
-                }
-                String output = sb.toString();
-                info(output);
-                compResult = compareOutput(refFile, output);
-            } catch(ReflectiveOperationException e) {
-                warn("Class " + vclass.getName() + " ignored, not a Visitor");
-                continue;
-            }
-            if (!compResult) {
-                diffGolden++;
-                error("The output from " + vclass.getName() + " did not match golden file.");
-        }
-        }
-
-        if (0 != diffGolden)
-            throw new Exception("Test output is not equal with golden file.");
-
-        if(0 != warnings)
-                System.err.println("Test generated " + warnings + " warnings");
-
-        if(0 != errors)
-            throw new Exception("Tester test failed with " +
-                                errors + " errors");
-    }
-    // Check if test output matches the golden file.
-    boolean compareOutput(File refFile, String sb)
-            throws FileNotFoundException, IOException {
-
-        List<String> refFileList = Files.readAllLines(refFile.toPath(), StandardCharsets.UTF_8);
-        List<String> sbList = Arrays.asList(sb.split("[\r\n]+"));
-        // Check if test output contains unexpected lines or is missing expected lines.
-        List<String> sbOnly = new ArrayList<>(sbList);
-        sbOnly.removeAll(refFileList);
-        for (String line: sbOnly)
-            error("unexpected line found: " + line);
-
-        List<String> refOnly = new ArrayList<>(refFileList);
-        refOnly.removeAll(sbList);
-        for (String line: refOnly)
-            error("expected line not found: " + line);
-
-        return sbOnly.isEmpty() && refOnly.isEmpty();
-    }
-
-    abstract static  class Visitor {
-        Tester tester;
-        File classesdir;
-
-        public Visitor(Tester tester) {
-            this.tester = tester;
-        }
-
-        abstract void visitClass(final String classname, final File  cfile,
-                final StringBuilder sb) throws Exception;
-
-        public void error(String msg) {
-            tester.error(msg);
-        }
-
-        public void warn(String msg) {
-            tester.warn(msg);
-        }
-    }
-
-    void error(String msg) {
-        System.err.println("Error: " + msg);
-        errors++;
-    }
-
-    void warn(String msg) {
-        System.err.println("Warning: " + msg);
-        warnings++;
-    }
-
-    void info(String msg) {
-        System.out.println(msg);
-    }
-}
--- a/langtools/test/tools/javac/MethodParameters/UncommonParamNames.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/MethodParameters/UncommonParamNames.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -26,9 +26,9 @@
  * @bug 8006582
  * @summary javac should generate method parameters correctly.
  * @modules jdk.jdeps/com.sun.tools.classfile
- * @build Tester
+ * @build MethodParametersTester
  * @compile -parameters UncommonParamNames.java
- * @run main Tester UncommonParamNames UncommonParamNames.out
+ * @run main MethodParametersTester UncommonParamNames UncommonParamNames.out
  */
 
 /** Test uncommon parameter names */
--- a/langtools/test/tools/javac/options/modes/AtFilesTest.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/options/modes/AtFilesTest.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -29,13 +29,13 @@
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
- * @build Tester
+ * @build OptionModesTester
  * @run main AtFilesTest
  */
 
 import java.io.IOException;
 
-public class AtFilesTest extends Tester {
+public class AtFilesTest extends OptionModesTester {
     public static void main(String... args) throws Exception {
         AtFilesTest t = new AtFilesTest();
         t.runTests();
--- a/langtools/test/tools/javac/options/modes/DocLintTest.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/options/modes/DocLintTest.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -29,14 +29,14 @@
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
- * @build Tester
+ * @build OptionModesTester
  * @run main DocLintTest
  */
 
 import com.sun.tools.javac.main.Main;
 import java.io.IOException;
 
-public class DocLintTest extends Tester {
+public class DocLintTest extends OptionModesTester {
     public static void main(String... args) throws Exception {
         DocLintTest t = new DocLintTest();
         t.runTests();
--- a/langtools/test/tools/javac/options/modes/FSInfoTest.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/options/modes/FSInfoTest.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -29,7 +29,7 @@
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
- * @build Tester
+ * @build OptionModesTester
  * @run main FSInfoTest
  */
 
@@ -37,7 +37,7 @@
 import com.sun.tools.javac.file.FSInfo;
 import java.io.IOException;
 
-public class FSInfoTest extends Tester {
+public class FSInfoTest extends OptionModesTester {
     public static void main(String... args) throws Exception {
         FSInfoTest t = new FSInfoTest();
         t.writeFile("C.java", "class C { }");
--- a/langtools/test/tools/javac/options/modes/InfoOptsTest.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/options/modes/InfoOptsTest.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -29,13 +29,13 @@
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
- * @build Tester
+ * @build OptionModesTester
  * @run main InfoOptsTest
  */
 
 import java.io.IOException;
 
-public class InfoOptsTest extends Tester {
+public class InfoOptsTest extends OptionModesTester {
     public static void main(String... args) throws Exception {
         InfoOptsTest t = new InfoOptsTest();
         t.runTests();
--- a/langtools/test/tools/javac/options/modes/NoOperandsTest.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/options/modes/NoOperandsTest.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -29,14 +29,14 @@
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
- * @build Tester
+ * @build OptionModesTester
  * @run main NoOperandsTest
  */
 
 import com.sun.tools.javac.main.Main;
 import java.io.IOException;
 
-public class NoOperandsTest extends Tester {
+public class NoOperandsTest extends OptionModesTester {
     public static void main(String... args) throws Exception {
         NoOperandsTest t = new NoOperandsTest();
         t.runTests();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/options/modes/OptionModesTester.java	Fri Aug 12 17:45:31 2016 -0700
@@ -0,0 +1,376 @@
+/*
+ * Copyright (c) 2014, 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.util.Context;
+import java.io.ByteArrayOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.UncheckedIOException;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.EnumMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+public class OptionModesTester {
+
+    /** Marker annotation for test methods to be invoked by runTests. */
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface Test { }
+
+    /**
+     * Run all methods annotated with @Test, and throw an exception if any
+     * errors are reported..
+     * Typically called on a tester object in main()
+     * @throws Exception if any errors occurred
+     */
+    void runTests() throws Exception {
+        for (Method m: getClass().getDeclaredMethods()) {
+            Annotation a = m.getAnnotation(Test.class);
+            if (a != null) {
+                try {
+                    out.println("Running test " + m.getName());
+                    m.invoke(this);
+                } catch (InvocationTargetException e) {
+                    Throwable cause = e.getCause();
+                    throw (cause instanceof Exception) ? ((Exception) cause) : e;
+                }
+                out.println();
+            }
+        }
+        if (errors > 0)
+            throw new Exception(errors + " errors occurred");
+    }
+
+    TestResult runMain(String[] opts, String[] files) {
+        out.println("Main " + Arrays.toString(opts) + " " + Arrays.toString(files));
+        return run(new TestResult(opts), (tr, c, pw) -> {
+            com.sun.tools.javac.main.Main compiler =
+                new com.sun.tools.javac.main.Main("javac", pw);
+            int rc = compiler.compile(join(opts, files), c).exitCode;
+            tr.setResult(rc);
+        });
+    }
+
+    TestResult runCall(String[] opts, String[] files) {
+        out.println("Call " + Arrays.toString(opts) + " " + Arrays.toString(files));
+        return run(new TestResult(opts), (tr, c, pw) -> {
+            boolean ok = JavacTool.create()
+                    .getTask(pw, null, null, Arrays.asList(opts), null, getFiles(files), c)
+                    .call();
+            tr.setResult(ok);
+        });
+    }
+
+    TestResult runParse(String[] opts, String[] files) {
+        out.println("Parse " + Arrays.toString(opts) + " " + Arrays.toString(files));
+        return run(new TestResult(opts), (tr, c, pw) -> {
+            JavacTool.create()
+                    .getTask(pw, null, null, Arrays.asList(opts), null, getFiles(files), c)
+                    .parse();
+            tr.setResult(true);
+        });
+    }
+
+    TestResult runAnalyze(String[] opts, String[] files) {
+        out.println("Analyze " + Arrays.toString(opts) + " " + Arrays.toString(files));
+        return run(new TestResult(opts), (tr, c, pw) -> {
+            JavacTool.create()
+                    .getTask(pw, null, null, Arrays.asList(opts), null, getFiles(files), c)
+                    .analyze();
+            tr.setResult(true);
+        });
+    }
+
+    interface Runnable {
+        void run(TestResult tr, Context c, PrintWriter pw) throws IOException;
+    }
+
+    TestResult run(TestResult tr, Runnable r) {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        StreamOutput sysOut = new StreamOutput(System.out, System::setOut);
+        StreamOutput sysErr = new StreamOutput(System.err, System::setErr);
+        Context context = new Context();
+        JavacFileManager.preRegister(context);
+        try {
+            r.run(tr, context, pw);
+        } catch (IllegalArgumentException | IllegalStateException | IOException e) {
+            tr.setThrown(e);
+        } finally {
+            try {
+                ((JavacFileManager) context.get(JavaFileManager.class)).close();
+            } catch (IOException e) {
+                throw new UncheckedIOException(e);
+            }
+            tr.setLogs(sw.toString(), sysOut.close(), sysErr.close());
+        }
+        tr.setContext(context);
+        tr.show();
+        return tr;
+    }
+
+    enum Log { DIRECT, STDOUT, STDERR };
+
+    class TestResult {
+        final List<String> args;
+        Throwable thrown;
+        List<Throwable> suppressed = new ArrayList<>();
+        Object rc; // Number or Boolean
+        Map<Log, String> logs;
+        Context context;
+
+        TestResult(String... args) {
+            this.args = Arrays.asList(args);
+        }
+
+        TestResult(List<String> args, Iterable<? extends JavaFileObject> files) {
+            this.args = new ArrayList<>();
+            this.args.addAll(args);
+            for (JavaFileObject f: files)
+                this.args.add(f.getName());
+        }
+
+        void setResult(int rc) {
+            this.rc = rc;
+        }
+
+        void setResult(boolean ok) {
+            this.rc = ok ? 0 : 1;
+        }
+
+        void setSuppressed(Throwable thrown) {
+            this.suppressed.add(thrown);
+        }
+
+        void setThrown(Throwable thrown) {
+            this.thrown = thrown;
+        }
+
+        void setLogs(String direct, String stdOut, String stdErr) {
+            logs = new EnumMap<>(Log.class);
+            logs.put(Log.DIRECT, direct);
+            logs.put(Log.STDOUT, stdOut);
+            logs.put(Log.STDERR, stdErr);
+        }
+
+        void setContext(Context context) {
+            this.context = context;
+        }
+
+        final void show() {
+            String NL = System.getProperty("line.separator");
+            boolean needSep = false;
+            if (rc != null) {
+                out.print("rc:" + rc);
+                needSep = true;
+            }
+            if (thrown != null) {
+                if (needSep) out.print("; ");
+                out.print("thrown:" + thrown);
+                needSep = true;
+            }
+            if (!suppressed.isEmpty()) {
+                if (needSep) out.print("; ");
+                out.print("suppressed:" + suppressed);
+                needSep = true;
+            }
+            if (needSep)
+                out.println();
+            logs.forEach((k, v) -> {
+                if (!v.isEmpty()) {
+                    out.println("javac/" + k + ":");
+                    if (v.endsWith(NL))
+                        out.print(v);
+                    else
+                        out.println(v);
+                }
+
+            });
+        }
+
+        TestResult checkOK() {
+            if (thrown != null) {
+                error("unexpected exception thrown: " + thrown);
+            } else if (rc == null) {
+                error("no result set");
+            } else if (rc != (Integer) 0 && rc != (Boolean) true) {
+                error("compilation failed unexpectedly; rc=" + rc);
+            }
+            return this;
+        }
+
+        TestResult checkResult(int expect) {
+            if (thrown != null) {
+                error("unexpected exception thrown: " + thrown);
+            } else if (rc != (Integer) expect) {
+                error("unexpected result: " + rc +", expected:" + expect);
+            }
+            return this;
+        }
+
+        TestResult checkResult(boolean expect) {
+            if (thrown != null) {
+                error("unexpected exception thrown: " + thrown);
+            } else if (rc != (Integer) (expect ? 0 : 1)) {
+                error("unexpected result: " + rc +", expected:" + expect);
+            }
+            return this;
+        }
+
+        TestResult checkLog(String... expects) {
+            return checkLog(Log.DIRECT, expects);
+        }
+
+        TestResult checkLog(Log l, String... expects) {
+            for (String e: expects) {
+                if (!logs.get(l).contains(e))
+                    error("expected string not found: " + e);
+            }
+            return this;
+        }
+
+        TestResult checkIllegalArgumentException() {
+            return checkThrown(IllegalArgumentException.class);
+        }
+
+        TestResult checkIllegalStateException() {
+            return checkThrown(IllegalStateException.class);
+        }
+
+        TestResult checkThrown(Class<? extends Throwable> t) {
+            if (thrown == null)
+                error("expected exception not thrown: " + t);
+            else if (!t.isAssignableFrom(thrown.getClass()))
+                error("unexpected exception thrown: " + thrown + ";  expected: " + t);
+            return this;
+        }
+
+        TestResult checkClass(String name) {
+            Path p = getOutDir().resolve(name.replace(".", "/") + ".class");
+            if (!Files.exists(p))
+                error("expected class not found: " + name + " (" + p + ")");
+            return this;
+        }
+
+        Path getOutDir() {
+            Iterator<String> iter = args.iterator();
+            while (iter.hasNext()) {
+                if (iter.next().equals("-d")) {
+                    return Paths.get(iter.next());
+                }
+            }
+            return null;
+        }
+    }
+
+    /**
+     * Utility class to simplify the handling of temporarily setting a
+     * new stream for System.out or System.err.
+     */
+    private static class StreamOutput {
+        // functional interface to set a stream.
+        private interface Initializer {
+            void set(PrintStream s);
+        }
+
+        private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        private final PrintStream ps = new PrintStream(baos);
+        private final PrintStream prev;
+        private final Initializer init;
+
+        StreamOutput(PrintStream s, Initializer init) {
+            prev = s;
+            init.set(ps);
+            this.init = init;
+        }
+
+        String close() {
+            init.set(prev);
+            ps.close();
+            return baos.toString();
+        }
+    }
+
+    List<JavaFileObject> getFiles(String... paths) {
+        List<JavaFileObject> files = new ArrayList<>();
+        for (JavaFileObject f : fm.getJavaFileObjects(paths))
+            files.add(f);
+        return files;
+    }
+
+    String toString(List<JavaFileObject> files) {
+        return files.stream().map(f -> f.getName()).collect(Collectors.toList()).toString();
+    }
+
+    void mkdirs(String path) throws IOException {
+        Files.createDirectories(Paths.get(path));
+    }
+
+    void writeFile(String path, String body) throws IOException {
+        Path p = Paths.get(path);
+        if (p.getParent() != null)
+            Files.createDirectories(p.getParent());
+        try (FileWriter w = new FileWriter(path)) {
+            w.write(body);
+        }
+    }
+
+    String[] join(String[] a, String[] b) {
+        String[] result = new String[a.length + b.length];
+        System.arraycopy(a, 0, result, 0, a.length);
+        System.arraycopy(b, 0, result, a.length, b.length);
+        return result;
+    }
+
+    void error(String message) {
+        out.print(">>>>> ");
+        out.println(message);
+        errors++;
+    }
+
+    StandardJavaFileManager fm =
+            ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null);
+    PrintStream out = System.err;
+    int errors;
+
+}
--- a/langtools/test/tools/javac/options/modes/OutputDirTest.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/options/modes/OutputDirTest.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -29,14 +29,14 @@
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
- * @build Tester
+ * @build OptionModesTester
  * @run main OutputDirTest
  */
 
 import com.sun.tools.javac.main.Main;
 import java.io.IOException;
 
-public class OutputDirTest extends Tester {
+public class OutputDirTest extends OptionModesTester {
     public static void main(String... args) throws Exception {
         OutputDirTest t = new OutputDirTest();
         t.writeFile("src/C.java", "class C { }");
--- a/langtools/test/tools/javac/options/modes/ProfileBootClassPathTest.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/options/modes/ProfileBootClassPathTest.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -29,7 +29,7 @@
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
- * @build Tester
+ * @build OptionModesTester
  * @run main ProfileBootClassPathTest
  */
 
@@ -37,13 +37,13 @@
 import java.io.File;
 import java.io.IOException;
 
-public class ProfileBootClassPathTest extends Tester {
+public class ProfileBootClassPathTest extends OptionModesTester {
     public static void main(String... args) throws Exception {
         ProfileBootClassPathTest t = new ProfileBootClassPathTest();
         t.runTests();
     }
 
-    @Tester.Test
+    @OptionModesTester.Test
     void testProfileBootClassPath() throws IOException {
         writeFile("C.java", "class C { }");
 
--- a/langtools/test/tools/javac/options/modes/ProfileTargetTest.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/options/modes/ProfileTargetTest.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -29,14 +29,14 @@
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
- * @build Tester
+ * @build OptionModesTester
  * @run main ProfileTargetTest
  */
 
 import com.sun.tools.javac.main.Main;
 import java.io.IOException;
 
-public class ProfileTargetTest extends Tester {
+public class ProfileTargetTest extends OptionModesTester {
     public static void main(String... args) throws Exception {
         ProfileTargetTest t = new ProfileTargetTest();
         t.runTests();
--- a/langtools/test/tools/javac/options/modes/SourceTargetTest.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/options/modes/SourceTargetTest.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -29,14 +29,14 @@
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
- * @build Tester
+ * @build OptionModesTester
  * @run main SourceTargetTest
  */
 
 import com.sun.tools.javac.main.Main;
 import java.io.IOException;
 
-public class SourceTargetTest extends Tester {
+public class SourceTargetTest extends OptionModesTester {
     public static void main(String... args) throws Exception {
         SourceTargetTest t = new SourceTargetTest();
         t.runTests();
--- a/langtools/test/tools/javac/options/modes/StdOutTest.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javac/options/modes/StdOutTest.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -29,7 +29,7 @@
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
- * @build Tester
+ * @build OptionModesTester
  * @run main StdOutTest
  */
 
@@ -38,7 +38,7 @@
 import java.nio.file.Files;
 import java.nio.file.Paths;
 
-public class StdOutTest extends Tester {
+public class StdOutTest extends OptionModesTester {
     public static void main(String... args) throws Exception {
         StdOutTest t = new StdOutTest();
         t.writeFile("src/Bad.java", "class Bad");
--- a/langtools/test/tools/javac/options/modes/Tester.java	Fri Aug 12 16:03:36 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,376 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import com.sun.tools.javac.api.JavacTool;
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.util.Context;
-import java.io.ByteArrayOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.UncheckedIOException;
-import java.lang.annotation.Annotation;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EnumMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-
-public class Tester {
-
-    /** Marker annotation for test methods to be invoked by runTests. */
-    @Retention(RetentionPolicy.RUNTIME)
-    @interface Test { }
-
-    /**
-     * Run all methods annotated with @Test, and throw an exception if any
-     * errors are reported..
-     * Typically called on a tester object in main()
-     * @throws Exception if any errors occurred
-     */
-    void runTests() throws Exception {
-        for (Method m: getClass().getDeclaredMethods()) {
-            Annotation a = m.getAnnotation(Test.class);
-            if (a != null) {
-                try {
-                    out.println("Running test " + m.getName());
-                    m.invoke(this);
-                } catch (InvocationTargetException e) {
-                    Throwable cause = e.getCause();
-                    throw (cause instanceof Exception) ? ((Exception) cause) : e;
-                }
-                out.println();
-            }
-        }
-        if (errors > 0)
-            throw new Exception(errors + " errors occurred");
-    }
-
-    TestResult runMain(String[] opts, String[] files) {
-        out.println("Main " + Arrays.toString(opts) + " " + Arrays.toString(files));
-        return run(new TestResult(opts), (tr, c, pw) -> {
-            com.sun.tools.javac.main.Main compiler =
-                new com.sun.tools.javac.main.Main("javac", pw);
-            int rc = compiler.compile(join(opts, files), c).exitCode;
-            tr.setResult(rc);
-        });
-    }
-
-    TestResult runCall(String[] opts, String[] files) {
-        out.println("Call " + Arrays.toString(opts) + " " + Arrays.toString(files));
-        return run(new TestResult(opts), (tr, c, pw) -> {
-            boolean ok = JavacTool.create()
-                    .getTask(pw, null, null, Arrays.asList(opts), null, getFiles(files), c)
-                    .call();
-            tr.setResult(ok);
-        });
-    }
-
-    TestResult runParse(String[] opts, String[] files) {
-        out.println("Parse " + Arrays.toString(opts) + " " + Arrays.toString(files));
-        return run(new TestResult(opts), (tr, c, pw) -> {
-            JavacTool.create()
-                    .getTask(pw, null, null, Arrays.asList(opts), null, getFiles(files), c)
-                    .parse();
-            tr.setResult(true);
-        });
-    }
-
-    TestResult runAnalyze(String[] opts, String[] files) {
-        out.println("Analyze " + Arrays.toString(opts) + " " + Arrays.toString(files));
-        return run(new TestResult(opts), (tr, c, pw) -> {
-            JavacTool.create()
-                    .getTask(pw, null, null, Arrays.asList(opts), null, getFiles(files), c)
-                    .analyze();
-            tr.setResult(true);
-        });
-    }
-
-    interface Runnable {
-        void run(TestResult tr, Context c, PrintWriter pw) throws IOException;
-    }
-
-    TestResult run(TestResult tr, Runnable r) {
-        StringWriter sw = new StringWriter();
-        PrintWriter pw = new PrintWriter(sw);
-        StreamOutput sysOut = new StreamOutput(System.out, System::setOut);
-        StreamOutput sysErr = new StreamOutput(System.err, System::setErr);
-        Context context = new Context();
-        JavacFileManager.preRegister(context);
-        try {
-            r.run(tr, context, pw);
-        } catch (IllegalArgumentException | IllegalStateException | IOException e) {
-            tr.setThrown(e);
-        } finally {
-            try {
-                ((JavacFileManager) context.get(JavaFileManager.class)).close();
-            } catch (IOException e) {
-                throw new UncheckedIOException(e);
-            }
-            tr.setLogs(sw.toString(), sysOut.close(), sysErr.close());
-        }
-        tr.setContext(context);
-        tr.show();
-        return tr;
-    }
-
-    enum Log { DIRECT, STDOUT, STDERR };
-
-    class TestResult {
-        final List<String> args;
-        Throwable thrown;
-        List<Throwable> suppressed = new ArrayList<>();
-        Object rc; // Number or Boolean
-        Map<Log, String> logs;
-        Context context;
-
-        TestResult(String... args) {
-            this.args = Arrays.asList(args);
-        }
-
-        TestResult(List<String> args, Iterable<? extends JavaFileObject> files) {
-            this.args = new ArrayList<>();
-            this.args.addAll(args);
-            for (JavaFileObject f: files)
-                this.args.add(f.getName());
-        }
-
-        void setResult(int rc) {
-            this.rc = rc;
-        }
-
-        void setResult(boolean ok) {
-            this.rc = ok ? 0 : 1;
-        }
-
-        void setSuppressed(Throwable thrown) {
-            this.suppressed.add(thrown);
-        }
-
-        void setThrown(Throwable thrown) {
-            this.thrown = thrown;
-        }
-
-        void setLogs(String direct, String stdOut, String stdErr) {
-            logs = new EnumMap<>(Log.class);
-            logs.put(Log.DIRECT, direct);
-            logs.put(Log.STDOUT, stdOut);
-            logs.put(Log.STDERR, stdErr);
-        }
-
-        void setContext(Context context) {
-            this.context = context;
-        }
-
-        final void show() {
-            String NL = System.getProperty("line.separator");
-            boolean needSep = false;
-            if (rc != null) {
-                out.print("rc:" + rc);
-                needSep = true;
-            }
-            if (thrown != null) {
-                if (needSep) out.print("; ");
-                out.print("thrown:" + thrown);
-                needSep = true;
-            }
-            if (!suppressed.isEmpty()) {
-                if (needSep) out.print("; ");
-                out.print("suppressed:" + suppressed);
-                needSep = true;
-            }
-            if (needSep)
-                out.println();
-            logs.forEach((k, v) -> {
-                if (!v.isEmpty()) {
-                    out.println("javac/" + k + ":");
-                    if (v.endsWith(NL))
-                        out.print(v);
-                    else
-                        out.println(v);
-                }
-
-            });
-        }
-
-        TestResult checkOK() {
-            if (thrown != null) {
-                error("unexpected exception thrown: " + thrown);
-            } else if (rc == null) {
-                error("no result set");
-            } else if (rc != (Integer) 0 && rc != (Boolean) true) {
-                error("compilation failed unexpectedly; rc=" + rc);
-            }
-            return this;
-        }
-
-        TestResult checkResult(int expect) {
-            if (thrown != null) {
-                error("unexpected exception thrown: " + thrown);
-            } else if (rc != (Integer) expect) {
-                error("unexpected result: " + rc +", expected:" + expect);
-            }
-            return this;
-        }
-
-        TestResult checkResult(boolean expect) {
-            if (thrown != null) {
-                error("unexpected exception thrown: " + thrown);
-            } else if (rc != (Integer) (expect ? 0 : 1)) {
-                error("unexpected result: " + rc +", expected:" + expect);
-            }
-            return this;
-        }
-
-        TestResult checkLog(String... expects) {
-            return checkLog(Log.DIRECT, expects);
-        }
-
-        TestResult checkLog(Log l, String... expects) {
-            for (String e: expects) {
-                if (!logs.get(l).contains(e))
-                    error("expected string not found: " + e);
-            }
-            return this;
-        }
-
-        TestResult checkIllegalArgumentException() {
-            return checkThrown(IllegalArgumentException.class);
-        }
-
-        TestResult checkIllegalStateException() {
-            return checkThrown(IllegalStateException.class);
-        }
-
-        TestResult checkThrown(Class<? extends Throwable> t) {
-            if (thrown == null)
-                error("expected exception not thrown: " + t);
-            else if (!t.isAssignableFrom(thrown.getClass()))
-                error("unexpected exception thrown: " + thrown + ";  expected: " + t);
-            return this;
-        }
-
-        TestResult checkClass(String name) {
-            Path p = getOutDir().resolve(name.replace(".", "/") + ".class");
-            if (!Files.exists(p))
-                error("expected class not found: " + name + " (" + p + ")");
-            return this;
-        }
-
-        Path getOutDir() {
-            Iterator<String> iter = args.iterator();
-            while (iter.hasNext()) {
-                if (iter.next().equals("-d")) {
-                    return Paths.get(iter.next());
-                }
-            }
-            return null;
-        }
-    }
-
-    /**
-     * Utility class to simplify the handling of temporarily setting a
-     * new stream for System.out or System.err.
-     */
-    private static class StreamOutput {
-        // functional interface to set a stream.
-        private interface Initializer {
-            void set(PrintStream s);
-        }
-
-        private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        private final PrintStream ps = new PrintStream(baos);
-        private final PrintStream prev;
-        private final Initializer init;
-
-        StreamOutput(PrintStream s, Initializer init) {
-            prev = s;
-            init.set(ps);
-            this.init = init;
-        }
-
-        String close() {
-            init.set(prev);
-            ps.close();
-            return baos.toString();
-        }
-    }
-
-    List<JavaFileObject> getFiles(String... paths) {
-        List<JavaFileObject> files = new ArrayList<>();
-        for (JavaFileObject f : fm.getJavaFileObjects(paths))
-            files.add(f);
-        return files;
-    }
-
-    String toString(List<JavaFileObject> files) {
-        return files.stream().map(f -> f.getName()).collect(Collectors.toList()).toString();
-    }
-
-    void mkdirs(String path) throws IOException {
-        Files.createDirectories(Paths.get(path));
-    }
-
-    void writeFile(String path, String body) throws IOException {
-        Path p = Paths.get(path);
-        if (p.getParent() != null)
-            Files.createDirectories(p.getParent());
-        try (FileWriter w = new FileWriter(path)) {
-            w.write(body);
-        }
-    }
-
-    String[] join(String[] a, String[] b) {
-        String[] result = new String[a.length + b.length];
-        System.arraycopy(a, 0, result, 0, a.length);
-        System.arraycopy(b, 0, result, a.length, b.length);
-        return result;
-    }
-
-    void error(String message) {
-        out.print(">>>>> ");
-        out.println(message);
-        errors++;
-    }
-
-    StandardJavaFileManager fm =
-            ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null);
-    PrintStream out = System.err;
-    int errors;
-
-}
--- a/langtools/test/tools/javadoc/annotations/annotateMethodsFields/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/annotations/annotateMethodsFields/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -29,16 +29,16 @@
  *          Test an annotation type with a type nested within.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
 import java.io.IOException;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/annotations/annotatePackage/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/annotations/annotatePackage/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, 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
@@ -27,16 +27,16 @@
  * @summary Test package annotations and package-info.java package comments.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
 import java.io.*;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1", "pkg2");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1", "pkg2");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/annotations/annotateParams/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/annotations/annotateParams/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, 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
@@ -27,16 +27,16 @@
  * @summary Test parameter annotations.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
 import java.io.IOException;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/annotations/badVals/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/annotations/badVals/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, 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
@@ -32,9 +32,9 @@
 import java.io.IOException;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/annotations/defaults/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/annotations/defaults/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -28,7 +28,7 @@
  *          annotations that use them.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
@@ -36,9 +36,9 @@
 import com.sun.javadoc.*;
 import com.sun.javadoc.AnnotationDesc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/annotations/elementTypes/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/annotations/elementTypes/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -28,7 +28,7 @@
  *          types.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
@@ -37,9 +37,9 @@
 import com.sun.javadoc.*;
 import com.sun.javadoc.AnnotationDesc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/annotations/missing/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/annotations/missing/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -34,9 +34,9 @@
 import com.sun.javadoc.ClassDoc;
 import com.sun.javadoc.AnnotationDesc;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "somepackage");
+    private static final OldToolTester tester = new OldToolTester("Main", "somepackage");
 
     public static void main(String... args) throws Exception {
         tester.run();
--- a/langtools/test/tools/javadoc/annotations/shortcuts/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/annotations/shortcuts/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -27,16 +27,16 @@
  * @summary Verify that "shortcuts" are used when printing annotations.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
 import java.io.IOException;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/enum/docComments/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/enum/docComments/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -27,17 +27,17 @@
  * @summary Verify the comments in an enum type.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
 import java.io.IOException;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester =
-            new Tester("Main", "-package", "pkg1");
+    private static final OldToolTester tester =
+            new OldToolTester("Main", "-package", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/enum/enumType/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/enum/enumType/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -27,16 +27,16 @@
  * @summary Verify the contents of an enum type.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
 import java.io.IOException;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/generics/genericClass/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/generics/genericClass/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -27,16 +27,16 @@
  * @summary Verify the contents of the ClassDoc of a generic class.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
 import java.io.IOException;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/generics/genericInnerAndOuter/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/generics/genericInnerAndOuter/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -28,7 +28,7 @@
  *          a generic class with a generic inner class.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
@@ -36,9 +36,9 @@
 import java.util.Arrays;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/generics/genericInterface/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/generics/genericInterface/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -27,16 +27,16 @@
  * @summary Verify the contents of the ClassDoc of a generic interface.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
 import java.io.IOException;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/generics/genericMethod/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/generics/genericMethod/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -27,16 +27,16 @@
  * @summary Verify the reading of generic methods and constructors.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
 import java.io.IOException;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/generics/genericSuper/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/generics/genericSuper/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -27,7 +27,7 @@
  * @summary Verify the contents of the ClassDoc of a generic class.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
@@ -35,10 +35,10 @@
 import java.util.Arrays;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester =
-            new Tester("Main", "pkg1", "-package");
+    private static final OldToolTester tester =
+            new OldToolTester("Main", "pkg1", "-package");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/generics/supertypes/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/generics/supertypes/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -27,7 +27,7 @@
  * @summary Check supertypes and superinterfaces of parameterized types.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
@@ -36,9 +36,9 @@
 import java.util.Arrays;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/generics/throwsGeneric/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/generics/throwsGeneric/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -27,16 +27,16 @@
  * @summary Verify the reading of generic methods and constructors.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
 import java.io.IOException;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/generics/tparamCycle/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/generics/tparamCycle/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -27,16 +27,16 @@
  * @summary Check a type parameter whose bound cycles back on itself.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
 import java.io.IOException;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/generics/tparamTagOnMethod/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/generics/tparamTagOnMethod/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -27,16 +27,16 @@
  * @summary Verify the reading of type parameter tags on methods.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
 import java.io.IOException;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/generics/tparamTagOnType/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/generics/tparamTagOnType/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -27,16 +27,16 @@
  * @summary Verify the reading of a type parameter tag on an interface.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
 import java.io.IOException;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- a/langtools/test/tools/javadoc/generics/wildcards/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/generics/wildcards/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -27,16 +27,16 @@
  * @summary Verify the contents of the ClassDoc of a generic class.
  * @library ../../lib
  * @modules jdk.javadoc
- * @compile  ../../lib/Tester.java Main.java
+ * @compile  ../../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
 import java.io.IOException;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester = new Tester("Main", "pkg1");
+    private static final OldToolTester tester = new OldToolTester("Main", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javadoc/lib/OldToolTester.java	Fri Aug 12 17:45:31 2016 -0700
@@ -0,0 +1,338 @@
+/*
+ * Copyright (c) 2003, 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * A utility used to invoke and test the javadoc tool.
+ *
+ * @author Scott Seligman
+ */
+
+
+import java.io.*;
+import java.util.*;
+import com.sun.javadoc.*;
+
+
+public class OldToolTester {
+
+    protected final String TEST_SRC = System.getProperty("test.src", ".");
+    protected final String TEST_CLASSES = System.getProperty("test.classes",
+                                                             ".");
+    private final String DEFAULT_ARGS[] = {
+        "-sourcepath", TEST_SRC,
+    };
+
+    private final File outputFile = new File(TEST_CLASSES, "testrun.out");
+    private final File expectedOutputFile = new File(TEST_SRC, "expected.out");
+//  private final File bootstrapMarkerFile = new File("bootstrap");
+
+    // True if we should "set expectations" by writing the expected output file
+    // rather than reading it and comparing.
+//  private final boolean bootstrap = bootstrapMarkerFile.isFile();
+
+    private String docletName;
+    private String[] args;
+    private Writer out = null;
+
+
+    /*
+     * Individual tests can extend this to create generics-aware doclets.
+     */
+    public static abstract class Doclet extends com.sun.javadoc.Doclet {
+        public static LanguageVersion languageVersion() {
+            return LanguageVersion.JAVA_1_5;
+        }
+    }
+
+
+    public OldToolTester(String docletName) {
+        this(docletName, new String[0]);
+    }
+
+    public OldToolTester(String docletName, String... additionalArgs) {
+        this.docletName = docletName;
+
+        int len = DEFAULT_ARGS.length + additionalArgs.length;
+        args = new String[len];
+        System.arraycopy(DEFAULT_ARGS, 0, args, 0, DEFAULT_ARGS.length);
+        System.arraycopy(additionalArgs, 0, args, DEFAULT_ARGS.length,
+                         additionalArgs.length);
+
+        try {
+            out = new BufferedWriter(new FileWriter(outputFile));
+        } catch (IOException e) {
+            throw new Error("Could not open output file " + outputFile);
+        }
+    }
+
+    public void run() throws IOException {
+        try {
+            if (com.sun.tools.javadoc.Main.execute("javadoc",
+                                                   docletName,
+                                                   getClass().getClassLoader(),
+                                                   args) != 0) {
+                throw new Error("Javadoc errors encountered.");
+            }
+            System.out.println("--> Output written to " + outputFile);
+        } finally {
+            out.close();
+        }
+    }
+
+    /*
+     * Compare output of test run to expected output.
+     * Throw an Error if they don't match.
+     */
+    public void verify() throws IOException {
+        BufferedReader thisRun =
+            new BufferedReader(new FileReader(outputFile));
+        BufferedReader expected =
+            new BufferedReader(new FileReader(expectedOutputFile));
+
+        for (int lineNum = 1; true; lineNum++) {
+            String line1 = thisRun.readLine();
+            String line2 = expected.readLine();
+            if (line1 == null && line2 == null) {
+                return;         // EOF with all lines matching
+            }
+            if (line1 == null || !line1.equals(line2)) {
+                throw new Error(outputFile + ":" + lineNum +
+                                ": output doesn't match");
+            }
+        }
+    }
+
+
+    public void println(Object o) throws IOException {
+        prln(0, o);
+    }
+
+    public void println() throws IOException {
+        prln();
+    }
+
+    public void printPackage(PackageDoc p) throws IOException {
+        prPackage(0, p);
+    }
+
+    public void printClass(ClassDoc cd) throws IOException {
+        if (cd.isAnnotationType())
+            printAnnotationType((AnnotationTypeDoc)cd);
+        else
+            prClass(0, cd);
+    }
+
+    public void printAnnotationType(AnnotationTypeDoc at) throws IOException {
+        prAnnotationType(0, at);
+    }
+
+    public void printField(FieldDoc f) throws IOException {
+        prField(0, f);
+    }
+
+    public void printParameter(Parameter p) throws IOException {
+        prParameter(0, p);
+    }
+
+    public void printMethod(MethodDoc m) throws IOException {
+        prln(0, "method " + m);
+        prMethod(0, m);
+    }
+
+    public void printAnnotationTypeElement(AnnotationTypeElementDoc e)
+                                                        throws IOException {
+        prln(0, "element " + e);
+        prMethod(0, e);
+    }
+
+    public void printConstructor(ConstructorDoc c) throws IOException {
+        prln(0, "constructor " + c);
+        prExecutable(0, c);
+    }
+
+
+    private void prPackage(int off, PackageDoc p) throws IOException {
+        prln(off, "package " + p);
+        prAnnotations(off + 2, p.annotations());
+    }
+
+    private void prClass(int off, ClassDoc cd) throws IOException {
+        prln(off,
+             (cd.isInterface() ? "interface" : cd.isEnum() ? "enum" : "class")
+             + " " + cd);
+        prln(off + 2, "name: " + cd.simpleTypeName() + " / " +
+             cd.typeName() + " / " + cd.qualifiedTypeName());
+        prAnnotations(off + 2, cd.annotations());
+        prLabel(off + 2, "type parameters");
+        for (Type t : cd.typeParameters())
+            prln(off + 4, t);
+        prParamTags(off + 2, cd.typeParamTags());
+        prLabel(off + 2, "nested in");
+        prln(off + 4, cd.containingClass());
+        prLabel(off + 2, "superclass");
+        prln(off + 4, cd.superclassType());
+        prLabel(off + 2, "interfaces");
+        Type[] ts = cd.interfaceTypes();
+        Arrays.sort(ts);
+        for (Type t : ts)
+            prln(off + 4, t);
+        prLabel(off + 2, "enum constants");
+        for (FieldDoc f : cd.enumConstants())
+            prln(off + 4, f.name());
+        prLabel(off + 2, "fields");
+        for (FieldDoc f : cd.fields())
+            prln(off + 4, f.type() + " " + f.name());
+        prLabel(off + 2, "constructors");
+        for (ConstructorDoc c : cd.constructors())
+            prln(off + 4, c.name() + c.flatSignature());
+        prLabel(off + 2, "methods");
+        for (MethodDoc m : cd.methods())
+            prln(off + 4, typeUseString(m.returnType()) + " " +
+                          m.name() + m.flatSignature());
+    }
+
+    private void prAnnotationType(int off, AnnotationTypeDoc at)
+                                                        throws IOException {
+        prln(off, "@interface " + at);
+        prAnnotations(off + 2, at.annotations());
+        prLabel(off + 2, "elements");
+        for (AnnotationTypeElementDoc e : at.elements()) {
+            String def = (e.defaultValue() == null)
+                                ? ""
+                                : " default " + e.defaultValue();
+            prln(off + 4, typeUseString(e.returnType()) + " " + e.name() +
+                          e.flatSignature() + def);
+        }
+    }
+
+    private void prField(int off, FieldDoc f) throws IOException {
+        prln(off, "field " + typeUseString(f.type()) + " " + f.name());
+        prAnnotations(off + 2, f.annotations());
+    }
+
+    private void prParameter(int off, Parameter p) throws IOException {
+        prln(off, "parameter " + p);
+        prAnnotations(off + 2, p.annotations());
+    }
+
+    private void prMethod(int off, MethodDoc m) throws IOException {
+        prExecutable(off, m);
+        prLabel(off + 2, "returns");
+        prln(off + 4, typeUseString(m.returnType()));
+        prLabel(off + 2, "overridden type");
+        prln(off + 4, m.overriddenType());
+    }
+
+    private void prExecutable(int off, ExecutableMemberDoc m)
+                                                        throws IOException {
+        if (!m.isAnnotationTypeElement()) {
+            prln(off + 2, "signature: " + m.flatSignature());
+            prln(off + 2, "           " + m.signature());
+        }
+        prAnnotations(off + 2, m.annotations());
+        prParamTags(off + 2, m.typeParamTags());
+        prParamTags(off + 2, m.paramTags());
+        prLabel(off + 2, "type parameters");
+        for (Type t : m.typeParameters())
+            prln(off + 4, t);
+        prLabel(off + 2, "throws");
+        Type[] ts = m.thrownExceptionTypes();
+        Arrays.sort(ts);
+        for (Type t : ts)
+            prln(off + 4, t);
+    }
+
+    private void prAnnotations(int off, AnnotationDesc[] as)
+                                                        throws IOException {
+        prLabel(off, "annotations");
+        for (AnnotationDesc a : as)
+            prln(off + 2, a.toString());
+    }
+
+    private void prParamTags(int off, ParamTag tags[]) throws IOException {
+        for (ParamTag tag : tags)
+            prParamTag(off, tag);
+    }
+
+    private void prParamTag(int off, ParamTag tag) throws IOException {
+        String name = tag.parameterName();
+        if (tag.isTypeParameter()) name = "<" + name + ">";
+        prln(off, "@param " + name + " " + tag.parameterComment());
+    }
+
+
+    private String typeUseString(Type t) {
+        return (t instanceof ClassDoc || t instanceof TypeVariable)
+                ? t.typeName()
+                : t.toString();
+    }
+
+
+    // Labels queued for possible printing.  Innermost is first in list.
+    List<Line> labels = new ArrayList<Line>();
+
+    // Print label if its section is nonempty.
+    void prLabel(int off, String s) {
+        while (!labels.isEmpty() && labels.get(0).off >= off)
+            labels.remove(0);
+        labels.add(0, new Line(off, s));
+    }
+
+    // Print queued labels with offsets less than "off".
+    void popLabels(int off) throws IOException {
+        while (!labels.isEmpty()) {
+            Line label = labels.remove(0);
+            if (label.off < off)
+                prln(label.off, label.o + ":");
+        }
+    }
+
+    // Print "o" at given offset.
+    void pr(int off, Object o) throws IOException {
+        popLabels(off);
+        for (int i = 0; i < off; i++)
+            out.write(' ');
+        if (o != null)
+            out.write(o.toString());
+    }
+
+    // Print "o" (if non-null) at given offset, then newline.
+    void prln(int off, Object o) throws IOException {
+        if (o != null) {
+            pr(off, o);
+            prln();
+        }
+    }
+
+    // Print newline.
+    void prln() throws IOException {
+        out.write('\n');        // don't want platform-dependent separator
+    }
+
+
+    static class Line {
+        int off;
+        Object o;
+        Line(int off, Object o) { this.off = off; this.o = o; }
+    }
+}
--- a/langtools/test/tools/javadoc/lib/Tester.java	Fri Aug 12 16:03:36 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,338 +0,0 @@
-/*
- * Copyright (c) 2003, 2008, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * A utility used to invoke and test the javadoc tool.
- *
- * @author Scott Seligman
- */
-
-
-import java.io.*;
-import java.util.*;
-import com.sun.javadoc.*;
-
-
-public class Tester {
-
-    protected final String TEST_SRC = System.getProperty("test.src", ".");
-    protected final String TEST_CLASSES = System.getProperty("test.classes",
-                                                             ".");
-    private final String DEFAULT_ARGS[] = {
-        "-sourcepath", TEST_SRC,
-    };
-
-    private final File outputFile = new File(TEST_CLASSES, "testrun.out");
-    private final File expectedOutputFile = new File(TEST_SRC, "expected.out");
-//  private final File bootstrapMarkerFile = new File("bootstrap");
-
-    // True if we should "set expectations" by writing the expected output file
-    // rather than reading it and comparing.
-//  private final boolean bootstrap = bootstrapMarkerFile.isFile();
-
-    private String docletName;
-    private String[] args;
-    private Writer out = null;
-
-
-    /*
-     * Individual tests can extend this to create generics-aware doclets.
-     */
-    public static abstract class Doclet extends com.sun.javadoc.Doclet {
-        public static LanguageVersion languageVersion() {
-            return LanguageVersion.JAVA_1_5;
-        }
-    }
-
-
-    public Tester(String docletName) {
-        this(docletName, new String[0]);
-    }
-
-    public Tester(String docletName, String... additionalArgs) {
-        this.docletName = docletName;
-
-        int len = DEFAULT_ARGS.length + additionalArgs.length;
-        args = new String[len];
-        System.arraycopy(DEFAULT_ARGS, 0, args, 0, DEFAULT_ARGS.length);
-        System.arraycopy(additionalArgs, 0, args, DEFAULT_ARGS.length,
-                         additionalArgs.length);
-
-        try {
-            out = new BufferedWriter(new FileWriter(outputFile));
-        } catch (IOException e) {
-            throw new Error("Could not open output file " + outputFile);
-        }
-    }
-
-    public void run() throws IOException {
-        try {
-            if (com.sun.tools.javadoc.Main.execute("javadoc",
-                                                   docletName,
-                                                   getClass().getClassLoader(),
-                                                   args) != 0) {
-                throw new Error("Javadoc errors encountered.");
-            }
-            System.out.println("--> Output written to " + outputFile);
-        } finally {
-            out.close();
-        }
-    }
-
-    /*
-     * Compare output of test run to expected output.
-     * Throw an Error if they don't match.
-     */
-    public void verify() throws IOException {
-        BufferedReader thisRun =
-            new BufferedReader(new FileReader(outputFile));
-        BufferedReader expected =
-            new BufferedReader(new FileReader(expectedOutputFile));
-
-        for (int lineNum = 1; true; lineNum++) {
-            String line1 = thisRun.readLine();
-            String line2 = expected.readLine();
-            if (line1 == null && line2 == null) {
-                return;         // EOF with all lines matching
-            }
-            if (line1 == null || !line1.equals(line2)) {
-                throw new Error(outputFile + ":" + lineNum +
-                                ": output doesn't match");
-            }
-        }
-    }
-
-
-    public void println(Object o) throws IOException {
-        prln(0, o);
-    }
-
-    public void println() throws IOException {
-        prln();
-    }
-
-    public void printPackage(PackageDoc p) throws IOException {
-        prPackage(0, p);
-    }
-
-    public void printClass(ClassDoc cd) throws IOException {
-        if (cd.isAnnotationType())
-            printAnnotationType((AnnotationTypeDoc)cd);
-        else
-            prClass(0, cd);
-    }
-
-    public void printAnnotationType(AnnotationTypeDoc at) throws IOException {
-        prAnnotationType(0, at);
-    }
-
-    public void printField(FieldDoc f) throws IOException {
-        prField(0, f);
-    }
-
-    public void printParameter(Parameter p) throws IOException {
-        prParameter(0, p);
-    }
-
-    public void printMethod(MethodDoc m) throws IOException {
-        prln(0, "method " + m);
-        prMethod(0, m);
-    }
-
-    public void printAnnotationTypeElement(AnnotationTypeElementDoc e)
-                                                        throws IOException {
-        prln(0, "element " + e);
-        prMethod(0, e);
-    }
-
-    public void printConstructor(ConstructorDoc c) throws IOException {
-        prln(0, "constructor " + c);
-        prExecutable(0, c);
-    }
-
-
-    private void prPackage(int off, PackageDoc p) throws IOException {
-        prln(off, "package " + p);
-        prAnnotations(off + 2, p.annotations());
-    }
-
-    private void prClass(int off, ClassDoc cd) throws IOException {
-        prln(off,
-             (cd.isInterface() ? "interface" : cd.isEnum() ? "enum" : "class")
-             + " " + cd);
-        prln(off + 2, "name: " + cd.simpleTypeName() + " / " +
-             cd.typeName() + " / " + cd.qualifiedTypeName());
-        prAnnotations(off + 2, cd.annotations());
-        prLabel(off + 2, "type parameters");
-        for (Type t : cd.typeParameters())
-            prln(off + 4, t);
-        prParamTags(off + 2, cd.typeParamTags());
-        prLabel(off + 2, "nested in");
-        prln(off + 4, cd.containingClass());
-        prLabel(off + 2, "superclass");
-        prln(off + 4, cd.superclassType());
-        prLabel(off + 2, "interfaces");
-        Type[] ts = cd.interfaceTypes();
-        Arrays.sort(ts);
-        for (Type t : ts)
-            prln(off + 4, t);
-        prLabel(off + 2, "enum constants");
-        for (FieldDoc f : cd.enumConstants())
-            prln(off + 4, f.name());
-        prLabel(off + 2, "fields");
-        for (FieldDoc f : cd.fields())
-            prln(off + 4, f.type() + " " + f.name());
-        prLabel(off + 2, "constructors");
-        for (ConstructorDoc c : cd.constructors())
-            prln(off + 4, c.name() + c.flatSignature());
-        prLabel(off + 2, "methods");
-        for (MethodDoc m : cd.methods())
-            prln(off + 4, typeUseString(m.returnType()) + " " +
-                          m.name() + m.flatSignature());
-    }
-
-    private void prAnnotationType(int off, AnnotationTypeDoc at)
-                                                        throws IOException {
-        prln(off, "@interface " + at);
-        prAnnotations(off + 2, at.annotations());
-        prLabel(off + 2, "elements");
-        for (AnnotationTypeElementDoc e : at.elements()) {
-            String def = (e.defaultValue() == null)
-                                ? ""
-                                : " default " + e.defaultValue();
-            prln(off + 4, typeUseString(e.returnType()) + " " + e.name() +
-                          e.flatSignature() + def);
-        }
-    }
-
-    private void prField(int off, FieldDoc f) throws IOException {
-        prln(off, "field " + typeUseString(f.type()) + " " + f.name());
-        prAnnotations(off + 2, f.annotations());
-    }
-
-    private void prParameter(int off, Parameter p) throws IOException {
-        prln(off, "parameter " + p);
-        prAnnotations(off + 2, p.annotations());
-    }
-
-    private void prMethod(int off, MethodDoc m) throws IOException {
-        prExecutable(off, m);
-        prLabel(off + 2, "returns");
-        prln(off + 4, typeUseString(m.returnType()));
-        prLabel(off + 2, "overridden type");
-        prln(off + 4, m.overriddenType());
-    }
-
-    private void prExecutable(int off, ExecutableMemberDoc m)
-                                                        throws IOException {
-        if (!m.isAnnotationTypeElement()) {
-            prln(off + 2, "signature: " + m.flatSignature());
-            prln(off + 2, "           " + m.signature());
-        }
-        prAnnotations(off + 2, m.annotations());
-        prParamTags(off + 2, m.typeParamTags());
-        prParamTags(off + 2, m.paramTags());
-        prLabel(off + 2, "type parameters");
-        for (Type t : m.typeParameters())
-            prln(off + 4, t);
-        prLabel(off + 2, "throws");
-        Type[] ts = m.thrownExceptionTypes();
-        Arrays.sort(ts);
-        for (Type t : ts)
-            prln(off + 4, t);
-    }
-
-    private void prAnnotations(int off, AnnotationDesc[] as)
-                                                        throws IOException {
-        prLabel(off, "annotations");
-        for (AnnotationDesc a : as)
-            prln(off + 2, a.toString());
-    }
-
-    private void prParamTags(int off, ParamTag tags[]) throws IOException {
-        for (ParamTag tag : tags)
-            prParamTag(off, tag);
-    }
-
-    private void prParamTag(int off, ParamTag tag) throws IOException {
-        String name = tag.parameterName();
-        if (tag.isTypeParameter()) name = "<" + name + ">";
-        prln(off, "@param " + name + " " + tag.parameterComment());
-    }
-
-
-    private String typeUseString(Type t) {
-        return (t instanceof ClassDoc || t instanceof TypeVariable)
-                ? t.typeName()
-                : t.toString();
-    }
-
-
-    // Labels queued for possible printing.  Innermost is first in list.
-    List<Line> labels = new ArrayList<Line>();
-
-    // Print label if its section is nonempty.
-    void prLabel(int off, String s) {
-        while (!labels.isEmpty() && labels.get(0).off >= off)
-            labels.remove(0);
-        labels.add(0, new Line(off, s));
-    }
-
-    // Print queued labels with offsets less than "off".
-    void popLabels(int off) throws IOException {
-        while (!labels.isEmpty()) {
-            Line label = labels.remove(0);
-            if (label.off < off)
-                prln(label.off, label.o + ":");
-        }
-    }
-
-    // Print "o" at given offset.
-    void pr(int off, Object o) throws IOException {
-        popLabels(off);
-        for (int i = 0; i < off; i++)
-            out.write(' ');
-        if (o != null)
-            out.write(o.toString());
-    }
-
-    // Print "o" (if non-null) at given offset, then newline.
-    void prln(int off, Object o) throws IOException {
-        if (o != null) {
-            pr(off, o);
-            prln();
-        }
-    }
-
-    // Print newline.
-    void prln() throws IOException {
-        out.write('\n');        // don't want platform-dependent separator
-    }
-
-
-    static class Line {
-        int off;
-        Object o;
-        Line(int off, Object o) { this.off = off; this.o = o; }
-    }
-}
--- a/langtools/test/tools/javadoc/varArgs/Main.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javadoc/varArgs/Main.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -28,17 +28,17 @@
  *          Verify that see/link tags can use "..." notation.
  * @library ../lib
  * @modules jdk.javadoc
- * @compile  ../lib/Tester.java Main.java
+ * @compile  ../lib/OldToolTester.java Main.java
  * @run main Main
  */
 
 import java.io.IOException;
 import com.sun.javadoc.*;
 
-public class Main extends Tester.Doclet {
+public class Main extends OldToolTester.Doclet {
 
-    private static final Tester tester =
-            new Tester("Main", "-Xwerror", "pkg1");
+    private static final OldToolTester tester =
+            new OldToolTester("Main", "-Xwerror", "pkg1");
 
     public static void main(String[] args) throws IOException {
         tester.run();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javap/output/JavapTester.java	Fri Aug 12 17:45:31 2016 -0700
@@ -0,0 +1,389 @@
+/*
+ * Copyright (c) 2013, 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.util.*;
+import java.lang.annotation.*;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * {@code JavapTester} is an abstract test-driver that provides the logic
+ * to execute test-cases, grouped by test classes.
+ * A test class is a main class extending this class, that instantiate
+ * itself, and calls the {@link run} method, passing any command line
+ * arguments.
+ * <p>
+ * The {@code run} method, expects arguments to identify test-case classes.
+ * A test-case class is a class extending the test class, and annotated
+ * with {@code TestCase}.
+ * <p>
+ * If no test-cases are specified, the test class directory is searched for
+ * co-located test-case classes (i.e. any class extending the test class,
+ * annotated with  {@code TestCase}).
+ * <p>
+ * Besides serving to group test-cases, extending the driver allow
+ * setting up a test-case template, and possibly overwrite default
+ * test-driver behaviour.
+ */
+public abstract class JavapTester {
+
+    private static boolean debug = false;
+    private static final PrintStream out = System.err;
+    private static final PrintStream err = System.err;
+
+
+    protected void run(String... args) throws Exception {
+
+        final File classesdir = new File(System.getProperty("test.classes", "."));
+
+        String[] classNames = args;
+
+        // If no test-cases are specified, we regard all co-located classes
+        // as potential test-cases.
+        if (args.length == 0) {
+            final String pattern =  ".*\\.class";
+            final File classFiles[] = classesdir.listFiles(new FileFilter() {
+                    public boolean accept(File f) {
+                        return f.getName().matches(pattern);
+                    }
+                });
+            ArrayList<String> names = new ArrayList<String>(classFiles.length);
+            for (File f : classFiles) {
+                String fname = f.getName();
+                names.add(fname.substring(0, fname.length() -6));
+            }
+            classNames = names.toArray(new String[names.size()]);
+        } else {
+            debug = true;
+        }
+        // Test-cases must extend the driver type, and be marked
+        // @TestCase. Other arguments (classes) are ignored.
+        // Test-cases are instantiated, and thereby executed.
+        for (String clname : classNames) {
+            try {
+                final Class tclass = Class.forName(clname);
+                if  (!getClass().isAssignableFrom(tclass)) continue;
+                TestCase anno = (TestCase) tclass.getAnnotation(TestCase.class);
+                if (anno == null) continue;
+                if (!debug) {
+                    ignore i = (ignore) tclass.getAnnotation(ignore.class);
+                    if (i != null) {
+                        out.println("Ignore: " + clname);
+                        ignored++;
+                        continue;
+                    }
+                }
+                out.println("TestCase: " + clname);
+                cases++;
+                JavapTester tc = (JavapTester) tclass.getConstructor().newInstance();
+                if (tc.errors > 0) {
+                    error("" + tc.errors + " test points failed in " + clname);
+                    errors += tc.errors - 1;
+                    fcases++;
+                }
+            } catch(ReflectiveOperationException roe) {
+                error("Warning: " + clname + " - ReflectiveOperationException");
+                roe.printStackTrace(err);
+            } catch(Exception unknown) {
+                error("Warning: " + clname + " - uncaught exception");
+                unknown.printStackTrace(err);
+            }
+        }
+
+        String imsg = ignored > 0 ? " (" +  ignored + " ignored)" : "";
+        if (errors > 0)
+            throw new Error(errors + " error, in " + fcases + " of " + cases + " test-cases" + imsg);
+        else
+            err.println("" + cases + " test-cases executed" + imsg + ", no errors");
+    }
+
+
+    /**
+     * Test-cases must be marked with the {@code TestCase} annotation,
+     * as well as extend {@code JavapTester} (or an driver extension
+     * specified as the first argument to the {@code main()} method.
+     */
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface TestCase { }
+
+    /**
+     * Individual test-cases failing due to product bugs, may temporarily
+     * be excluded by marking them like this, (where "at-" is replaced by "@")
+     * at-ignore // 1234567: bug synopsis
+     */
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface ignore { }
+
+    /**
+     * Test-cases are classes extending {@code JavapTester}, and
+     * calling {@link setSrc}, followed by one or more invocations
+     * of {@link verify} in the body of the constructor.
+     * <p>
+     * Sets a default test-case template, which is empty except
+     * for a key of {@code "TESTCASE"}.
+     * Subclasses will typically call {@code setSrc(TestSource)}
+     * to setup a useful test-case template.
+     */
+    public JavapTester() {
+        this.testCase = this.getClass().getName();
+        src = new TestSource("TESTCASE");
+    }
+
+    /**
+     * Set the top-level source template.
+     */
+    protected JavapTester setSrc(TestSource src) {
+        this.src = src;
+        return this;
+    }
+
+    /**
+     * Convenience method for calling {@code innerSrc("TESTCASE", ...)}.
+     */
+    protected JavapTester setSrc(String... lines) {
+        return innerSrc("TESTCASE", lines);
+    }
+
+    /**
+     * Convenience method for calling {@code innerSrc(key, new TestSource(...))}.
+     */
+    protected JavapTester innerSrc(String key, String... lines) {
+        return innerSrc(key, new TestSource(lines));
+    }
+
+    /**
+     * Specialize the testcase template, setting replacement content
+     * for the specified key.
+     */
+    protected JavapTester innerSrc(String key, TestSource content) {
+        if (src == null) {
+            src = new TestSource(key);
+        }
+        src.setInner(key, content);
+        return this;
+    }
+
+    /**
+     * On the first invocation, call {@code execute()} to compile
+     * the test-case source and process the resulting class(se)
+     * into verifiable output.
+     * <p>
+     * Verify that the output matches each of the regular expressions
+     * given as argument.
+     * <p>
+     * Any failure to match constitutes a test failure, but doesn't
+     * abort the test-case.
+     * <p>
+     * Any exception (e.g. bad regular expression syntax) results in
+     * a test failure, and aborts the test-case.
+     */
+    protected void verify(String... expect) {
+        if (!didExecute) {
+            try {
+                execute();
+            } catch(Exception ue) {
+                throw new Error(ue);
+            } finally {
+                didExecute = true;
+            }
+        }
+        if (output == null) {
+            error("output is null");
+            return;
+        }
+        for (String e: expect) {
+            // Escape regular expressions (to allow input to be literals).
+            // Notice, characters to be escaped are themselves identified
+            // using regular expressions
+            String rc[] = { "(", ")", "[", "]", "{", "}", "$" };
+            for (String c : rc) {
+                e = e.replace(c, "\\" + c);
+            }
+            // DEBUG: Uncomment this to test modulo constant pool index.
+            // e = e.replaceAll("#[0-9]{2}", "#[0-9]{2}");
+            if (!output.matches("(?s).*" + e + ".*")) {
+                if (!didPrint) {
+                    out.println(output);
+                    didPrint = true;
+                }
+                error("not matched: '" + e + "'");
+            } else if(debug) {
+                out.println("matched: '" + e + "'");
+            }
+        }
+    }
+
+    /**
+     * Calls {@code writeTestFile()} to write out the test-case source
+     * content to a file, then call {@code compileTestFile()} to
+     * compile it, and finally run the {@link process} method to produce
+     * verifiable output. The default {@code process} method runs javap.
+     * <p>
+     * If an exception occurs, it results in a test failure, and
+     * aborts the test-case.
+     */
+    protected void execute() throws IOException {
+        err.println("TestCase: " + testCase);
+        writeTestFile();
+        compileTestFile();
+        process();
+    }
+
+    /**
+     * Generate java source from test-case.
+     * TBD: change to use javaFileObject, possibly make
+     * this class extend JavaFileObject.
+     */
+    protected void writeTestFile() throws IOException {
+        javaFile = new File("Test.java");
+        FileWriter fw = new FileWriter(javaFile);
+        BufferedWriter bw = new BufferedWriter(fw);
+        PrintWriter pw = new PrintWriter(bw);
+        for (String line : src) {
+            pw.println(line);
+            if (debug) out.println(line);
+        }
+        pw.close();
+    }
+
+    /**
+     * Compile the Java source code.
+     */
+    protected void compileTestFile() {
+        String path = javaFile.getPath();
+        String params[] =  {"-g", path };
+        int rc = com.sun.tools.javac.Main.compile(params);
+        if (rc != 0)
+            throw new Error("compilation failed. rc=" + rc);
+        classFile = new File(path.substring(0, path.length() - 5) + ".class");
+    }
+
+
+    /**
+     * Process class file to generate output for verification.
+     * The default implementation simply runs javap. This might be
+     * overwritten to generate output in a different manner.
+     */
+    protected void process() {
+        String testClasses = "."; //System.getProperty("test.classes", ".");
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        String[] args = { "-v", "-classpath", testClasses, "Test" };
+        int rc = com.sun.tools.javap.Main.run(args, pw);
+        if (rc != 0)
+            throw new Error("javap failed. rc=" + rc);
+        pw.close();
+        output = sw.toString();
+        if (debug) {
+            out.println(output);
+            didPrint = true;
+        }
+
+    }
+
+
+    private String testCase;
+    private TestSource src;
+    private File javaFile = null;
+    private File classFile = null;
+    private String output = null;
+    private boolean didExecute = false;
+    private boolean didPrint = false;
+
+
+    protected void error(String msg) {
+        err.println("Error: " + msg);
+        errors++;
+    }
+
+    private int cases;
+    private int fcases;
+    private int errors;
+    private int ignored;
+
+    /**
+     * The TestSource class provides a simple container for
+     * test cases. It contains an array of source code lines,
+     * where zero or more lines may be markers for nested lines.
+     * This allows representing templates, with specialization.
+     * <P>
+     * This may be generalized to support more advance combo
+     * tests, but presently it's only used with a static template,
+     * and one level of specialization.
+     */
+    public class TestSource implements Iterable<String> {
+
+        private String[] lines;
+        private Hashtable<String, TestSource> innerSrc;
+
+        public TestSource(String... lines) {
+            this.lines = lines;
+            innerSrc = new Hashtable<String, TestSource>();
+        }
+
+        public void setInner(String key, TestSource inner) {
+            innerSrc.put(key, inner);
+        }
+
+        public void setInner(String key, String... lines) {
+            innerSrc.put(key, new TestSource(lines));
+        }
+
+        public Iterator<String> iterator() {
+            return new LineIterator();
+        }
+
+        private class LineIterator implements Iterator<String> {
+
+            int nextLine = 0;
+            Iterator<String> innerIt = null;
+
+            public  boolean hasNext() {
+                return nextLine < lines.length;
+            }
+
+            public String next() {
+                if (!hasNext()) throw new NoSuchElementException();
+                String str = lines[nextLine];
+                TestSource inner = innerSrc.get(str);
+                if (inner == null) {
+                    nextLine++;
+                    return str;
+                }
+                if (innerIt == null) {
+                    innerIt = inner.iterator();
+                }
+                if (innerIt.hasNext()) {
+                    return innerIt.next();
+                }
+                innerIt = null;
+                nextLine++;
+                return next();
+            }
+
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+        }
+    }
+}
--- a/langtools/test/tools/javap/output/RepeatingTypeAnnotations.java	Fri Aug 12 16:03:36 2016 -0700
+++ b/langtools/test/tools/javap/output/RepeatingTypeAnnotations.java	Fri Aug 12 17:45:31 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -46,13 +46,13 @@
  * produced to help debugging. Test annotated with {@code ignore}
  * can be executed explicitly.
  */
-public class RepeatingTypeAnnotations extends Tester {
+public class RepeatingTypeAnnotations extends JavapTester {
 
     /**
      * Main method instantiates test and run test-cases.
      */
     public static void main(String... args) throws Exception {
-        Tester tester = new RepeatingTypeAnnotations();
+        JavapTester tester = new RepeatingTypeAnnotations();
         tester.run(args);
     }
 
--- a/langtools/test/tools/javap/output/Tester.java	Fri Aug 12 16:03:36 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,389 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.*;
-import java.util.*;
-import java.lang.annotation.*;
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * {@code Tester} is an abstract test-driver that provides the logic
- * to execute test-cases, grouped by test classes.
- * A test class is a main class extending this class, that instantiate
- * itself, and calls the {@link run} method, passing any command line
- * arguments.
- * <p>
- * The {@code run} method, expects arguments to identify test-case classes.
- * A test-case class is a class extending the test class, and annotated
- * with {@code TestCase}.
- * <p>
- * If no test-cases are specified, the test class directory is searched for
- * co-located test-case classes (i.e. any class extending the test class,
- * annotated with  {@code TestCase}).
- * <p>
- * Besides serving to group test-cases, extending the driver allow
- * setting up a test-case template, and possibly overwrite default
- * test-driver behaviour.
- */
-public abstract class Tester {
-
-    private static boolean debug = false;
-    private static final PrintStream out = System.err;
-    private static final PrintStream err = System.err;
-
-
-    protected void run(String... args) throws Exception {
-
-        final File classesdir = new File(System.getProperty("test.classes", "."));
-
-        String[] classNames = args;
-
-        // If no test-cases are specified, we regard all co-located classes
-        // as potential test-cases.
-        if (args.length == 0) {
-            final String pattern =  ".*\\.class";
-            final File classFiles[] = classesdir.listFiles(new FileFilter() {
-                    public boolean accept(File f) {
-                        return f.getName().matches(pattern);
-                    }
-                });
-            ArrayList<String> names = new ArrayList<String>(classFiles.length);
-            for (File f : classFiles) {
-                String fname = f.getName();
-                names.add(fname.substring(0, fname.length() -6));
-            }
-            classNames = names.toArray(new String[names.size()]);
-        } else {
-            debug = true;
-        }
-        // Test-cases must extend the driver type, and be marked
-        // @TestCase. Other arguments (classes) are ignored.
-        // Test-cases are instantiated, and thereby executed.
-        for (String clname : classNames) {
-            try {
-                final Class tclass = Class.forName(clname);
-                if  (!getClass().isAssignableFrom(tclass)) continue;
-                TestCase anno = (TestCase) tclass.getAnnotation(TestCase.class);
-                if (anno == null) continue;
-                if (!debug) {
-                    ignore i = (ignore) tclass.getAnnotation(ignore.class);
-                    if (i != null) {
-                        out.println("Ignore: " + clname);
-                        ignored++;
-                        continue;
-                    }
-                }
-                out.println("TestCase: " + clname);
-                cases++;
-                Tester tc = (Tester) tclass.getConstructor().newInstance();
-                if (tc.errors > 0) {
-                    error("" + tc.errors + " test points failed in " + clname);
-                    errors += tc.errors - 1;
-                    fcases++;
-                }
-            } catch(ReflectiveOperationException roe) {
-                error("Warning: " + clname + " - ReflectiveOperationException");
-                roe.printStackTrace(err);
-            } catch(Exception unknown) {
-                error("Warning: " + clname + " - uncaught exception");
-                unknown.printStackTrace(err);
-            }
-        }
-
-        String imsg = ignored > 0 ? " (" +  ignored + " ignored)" : "";
-        if (errors > 0)
-            throw new Error(errors + " error, in " + fcases + " of " + cases + " test-cases" + imsg);
-        else
-            err.println("" + cases + " test-cases executed" + imsg + ", no errors");
-    }
-
-
-    /**
-     * Test-cases must be marked with the {@code TestCase} annotation,
-     * as well as extend {@code Tester} (or an driver extension
-     * specified as the first argument to the {@code main()} method.
-     */
-    @Retention(RetentionPolicy.RUNTIME)
-    @interface TestCase { }
-
-    /**
-     * Individual test-cases failing due to product bugs, may temporarily
-     * be excluded by marking them like this, (where "at-" is replaced by "@")
-     * at-ignore // 1234567: bug synopsis
-     */
-    @Retention(RetentionPolicy.RUNTIME)
-    @interface ignore { }
-
-    /**
-     * Test-cases are classes extending {@code Tester}, and
-     * calling {@link setSrc}, followed by one or more invocations
-     * of {@link verify} in the body of the constructor.
-     * <p>
-     * Sets a default test-case template, which is empty except
-     * for a key of {@code "TESTCASE"}.
-     * Subclasses will typically call {@code setSrc(TestSource)}
-     * to setup a useful test-case template.
-     */
-    public Tester() {
-        this.testCase = this.getClass().getName();
-        src = new TestSource("TESTCASE");
-    }
-
-    /**
-     * Set the top-level source template.
-     */
-    protected Tester setSrc(TestSource src) {
-        this.src = src;
-        return this;
-    }
-
-    /**
-     * Convenience method for calling {@code innerSrc("TESTCASE", ...)}.
-     */
-    protected Tester setSrc(String... lines) {
-        return innerSrc("TESTCASE", lines);
-    }
-
-    /**
-     * Convenience method for calling {@code innerSrc(key, new TestSource(...))}.
-     */
-    protected Tester innerSrc(String key, String... lines) {
-        return innerSrc(key, new TestSource(lines));
-    }
-
-    /**
-     * Specialize the testcase template, setting replacement content
-     * for the specified key.
-     */
-    protected Tester innerSrc(String key, TestSource content) {
-        if (src == null) {
-            src = new TestSource(key);
-        }
-        src.setInner(key, content);
-        return this;
-    }
-
-    /**
-     * On the first invocation, call {@code execute()} to compile
-     * the test-case source and process the resulting class(se)
-     * into verifiable output.
-     * <p>
-     * Verify that the output matches each of the regular expressions
-     * given as argument.
-     * <p>
-     * Any failure to match constitutes a test failure, but doesn't
-     * abort the test-case.
-     * <p>
-     * Any exception (e.g. bad regular expression syntax) results in
-     * a test failure, and aborts the test-case.
-     */
-    protected void verify(String... expect) {
-        if (!didExecute) {
-            try {
-                execute();
-            } catch(Exception ue) {
-                throw new Error(ue);
-            } finally {
-                didExecute = true;
-            }
-        }
-        if (output == null) {
-            error("output is null");
-            return;
-        }
-        for (String e: expect) {
-            // Escape regular expressions (to allow input to be literals).
-            // Notice, characters to be escaped are themselves identified
-            // using regular expressions
-            String rc[] = { "(", ")", "[", "]", "{", "}", "$" };
-            for (String c : rc) {
-                e = e.replace(c, "\\" + c);
-            }
-            // DEBUG: Uncomment this to test modulo constant pool index.
-            // e = e.replaceAll("#[0-9]{2}", "#[0-9]{2}");
-            if (!output.matches("(?s).*" + e + ".*")) {
-                if (!didPrint) {
-                    out.println(output);
-                    didPrint = true;
-                }
-                error("not matched: '" + e + "'");
-            } else if(debug) {
-                out.println("matched: '" + e + "'");
-            }
-        }
-    }
-
-    /**
-     * Calls {@code writeTestFile()} to write out the test-case source
-     * content to a file, then call {@code compileTestFile()} to
-     * compile it, and finally run the {@link process} method to produce
-     * verifiable output. The default {@code process} method runs javap.
-     * <p>
-     * If an exception occurs, it results in a test failure, and
-     * aborts the test-case.
-     */
-    protected void execute() throws IOException {
-        err.println("TestCase: " + testCase);
-        writeTestFile();
-        compileTestFile();
-        process();
-    }
-
-    /**
-     * Generate java source from test-case.
-     * TBD: change to use javaFileObject, possibly make
-     * this class extend JavaFileObject.
-     */
-    protected void writeTestFile() throws IOException {
-        javaFile = new File("Test.java");
-        FileWriter fw = new FileWriter(javaFile);
-        BufferedWriter bw = new BufferedWriter(fw);
-        PrintWriter pw = new PrintWriter(bw);
-        for (String line : src) {
-            pw.println(line);
-            if (debug) out.println(line);
-        }
-        pw.close();
-    }
-
-    /**
-     * Compile the Java source code.
-     */
-    protected void compileTestFile() {
-        String path = javaFile.getPath();
-        String params[] =  {"-g", path };
-        int rc = com.sun.tools.javac.Main.compile(params);
-        if (rc != 0)
-            throw new Error("compilation failed. rc=" + rc);
-        classFile = new File(path.substring(0, path.length() - 5) + ".class");
-    }
-
-
-    /**
-     * Process class file to generate output for verification.
-     * The default implementation simply runs javap. This might be
-     * overwritten to generate output in a different manner.
-     */
-    protected void process() {
-        String testClasses = "."; //System.getProperty("test.classes", ".");
-        StringWriter sw = new StringWriter();
-        PrintWriter pw = new PrintWriter(sw);
-        String[] args = { "-v", "-classpath", testClasses, "Test" };
-        int rc = com.sun.tools.javap.Main.run(args, pw);
-        if (rc != 0)
-            throw new Error("javap failed. rc=" + rc);
-        pw.close();
-        output = sw.toString();
-        if (debug) {
-            out.println(output);
-            didPrint = true;
-        }
-
-    }
-
-
-    private String testCase;
-    private TestSource src;
-    private File javaFile = null;
-    private File classFile = null;
-    private String output = null;
-    private boolean didExecute = false;
-    private boolean didPrint = false;
-
-
-    protected void error(String msg) {
-        err.println("Error: " + msg);
-        errors++;
-    }
-
-    private int cases;
-    private int fcases;
-    private int errors;
-    private int ignored;
-
-    /**
-     * The TestSource class provides a simple container for
-     * test cases. It contains an array of source code lines,
-     * where zero or more lines may be markers for nested lines.
-     * This allows representing templates, with specialization.
-     * <P>
-     * This may be generalized to support more advance combo
-     * tests, but presently it's only used with a static template,
-     * and one level of specialization.
-     */
-    public class TestSource implements Iterable<String> {
-
-        private String[] lines;
-        private Hashtable<String, TestSource> innerSrc;
-
-        public TestSource(String... lines) {
-            this.lines = lines;
-            innerSrc = new Hashtable<String, TestSource>();
-        }
-
-        public void setInner(String key, TestSource inner) {
-            innerSrc.put(key, inner);
-        }
-
-        public void setInner(String key, String... lines) {
-            innerSrc.put(key, new TestSource(lines));
-        }
-
-        public Iterator<String> iterator() {
-            return new LineIterator();
-        }
-
-        private class LineIterator implements Iterator<String> {
-
-            int nextLine = 0;
-            Iterator<String> innerIt = null;
-
-            public  boolean hasNext() {
-                return nextLine < lines.length;
-            }
-
-            public String next() {
-                if (!hasNext()) throw new NoSuchElementException();
-                String str = lines[nextLine];
-                TestSource inner = innerSrc.get(str);
-                if (inner == null) {
-                    nextLine++;
-                    return str;
-                }
-                if (innerIt == null) {
-                    innerIt = inner.iterator();
-                }
-                if (innerIt.hasNext()) {
-                    return innerIt.next();
-                }
-                innerIt = null;
-                nextLine++;
-                return next();
-            }
-
-            public void remove() {
-                throw new UnsupportedOperationException();
-            }
-        }
-    }
-}