8152897: refactor ToolBox to allow reduced documented dependencies
authorjjg
Thu, 31 Mar 2016 15:20:50 -0700
changeset 36778 e04318f39f92
parent 36777 28d33fb9097f
child 36779 9a030c4d2591
8152897: refactor ToolBox to allow reduced documented dependencies Reviewed-by: vromero
langtools/test/jdk/jshell/ClassPathTest.java
langtools/test/jdk/jshell/CommandCompletionTest.java
langtools/test/jdk/jshell/Compiler.java
langtools/test/jdk/jshell/CompletionSuggestionTest.java
langtools/test/jdk/jshell/ComputeFQNsTest.java
langtools/test/jdk/jshell/ErrorTranslationTest.java
langtools/test/jdk/jshell/ImportTest.java
langtools/test/jdk/jshell/InferTypeTest.java
langtools/test/jdk/jshell/StartOptionTest.java
langtools/test/jdk/jshell/ToolBasicTest.java
langtools/test/jdk/jshell/ToolFormatTest.java
langtools/test/jdk/jshell/ToolReloadTest.java
langtools/test/tools/doclint/tool/PathsTest.java
langtools/test/tools/javac/4846262/CheckEBCDICLocaleTest.java
langtools/test/tools/javac/6302184/HiddenOptionsShouldUseGivenEncodingTest.java
langtools/test/tools/javac/6508981/TestInferBinaryName.java
langtools/test/tools/javac/AnonymousSubclassTest.java
langtools/test/tools/javac/ClassPathTest/ClassPathTest.java
langtools/test/tools/javac/ConstFoldTest.java
langtools/test/tools/javac/ExtDirs/ExtDirTest.java
langtools/test/tools/javac/IncorrectInheritance/IncorrectInheritanceTest.java
langtools/test/tools/javac/MissingInclude/MissingIncludeTest.java
langtools/test/tools/javac/Paths/AbsolutePathTest.java
langtools/test/tools/javac/ProtectedInnerClass/ProtectedInnerClassesTest.java
langtools/test/tools/javac/T5090006/AssertionFailureTest.java
langtools/test/tools/javac/T6558476.java
langtools/test/tools/javac/T6725036.java
langtools/test/tools/javac/T6970173/DebugPointerAtBadPositionTest.java
langtools/test/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java
langtools/test/tools/javac/T8009640/CheckRejectProfileBCPOptionsIfUsedTogetherTest.java
langtools/test/tools/javac/T8010659/CompilerCrashWhenMixingBinariesAndSourcesTest.java
langtools/test/tools/javac/T8013394/CompileErrorWithIteratorTest.java
langtools/test/tools/javac/T8019486/WrongLNTForLambdaTest.java
langtools/test/tools/javac/T8022162/IncorrectSignatureDeterminationForInnerClassesTest.java
langtools/test/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java
langtools/test/tools/javac/T8024437/ExceptionInferenceFromClassFileTest.java
langtools/test/tools/javac/annotations/typeAnnotations/classfile/NestedLambdasCastedTest.java
langtools/test/tools/javac/api/ToolProvider/HelloWorldTest.java
langtools/test/tools/javac/api/ToolProvider/ToolProviderTest1.java
langtools/test/tools/javac/api/ToolProvider/ToolProviderTest2.java
langtools/test/tools/javac/boxing/IncrementBoxedAndAccess.java
langtools/test/tools/javac/classfiles/InnerClasses/T8068517.java
langtools/test/tools/javac/classfiles/attributes/AnnotationDefault/AnnotationDefaultTest.java
langtools/test/tools/javac/classfiles/attributes/EnclosingMethod/EnclosingMethodTest.java
langtools/test/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTest.java
langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java
langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java
langtools/test/tools/javac/classfiles/attributes/Module/ModuleFlagTest.java
langtools/test/tools/javac/classfiles/attributes/Module/ModuleTest.java
langtools/test/tools/javac/classfiles/attributes/Module/ModuleTestBase.java
langtools/test/tools/javac/classfiles/attributes/Signature/ConstructorTest.java
langtools/test/tools/javac/classfiles/attributes/Signature/EnumTest.java
langtools/test/tools/javac/classfiles/attributes/Signature/ExceptionTest.java
langtools/test/tools/javac/classfiles/attributes/Signature/FieldTest.java
langtools/test/tools/javac/classfiles/attributes/Signature/InnerClassTest.java
langtools/test/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java
langtools/test/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java
langtools/test/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java
langtools/test/tools/javac/classfiles/attributes/SourceFile/AnonymousClassTest.java
langtools/test/tools/javac/classfiles/attributes/SourceFile/InnerClassTest.java
langtools/test/tools/javac/classfiles/attributes/SourceFile/LocalClassTest.java
langtools/test/tools/javac/classfiles/attributes/SourceFile/MixTest.java
langtools/test/tools/javac/classfiles/attributes/SourceFile/ModuleInfoTest.java
langtools/test/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java
langtools/test/tools/javac/classfiles/attributes/SourceFile/SourceFileTestBase.java
langtools/test/tools/javac/classfiles/attributes/SourceFile/SyntheticClassTest.java
langtools/test/tools/javac/classfiles/attributes/SourceFile/TopLevelClassesOneFileTest.java
langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java
langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java
langtools/test/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java
langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java
langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java
langtools/test/tools/javac/classfiles/attributes/Synthetic/EnumTest.java
langtools/test/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java
langtools/test/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java
langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForGenericMethodTest.java
langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerAnnotationTest.java
langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerClassTest.java
langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerEnumTest.java
langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerInterfaceTest.java
langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForTopLevelClassTest.java
langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForGenericMethodTest.java
langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForLambdaTest.java
langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTest.java
langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedPackageTest.java
langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerAnnotationTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerClassTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerEnumTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerInterfaceTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerAnnotationTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerClassTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerEnumTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerInterfaceTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInLocalClassTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerAnnotationTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerEnumTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerInterfaceTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumsInInnerClassTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerAnnotationTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerClassTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerEnumTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerInterfaceTest.java
langtools/test/tools/javac/classfiles/attributes/innerclasses/NoInnerClassesTest.java
langtools/test/tools/javac/classfiles/attributes/lib/TestBase.java
langtools/test/tools/javac/completionDeps/DepsAndAnno.java
langtools/test/tools/javac/defaultMethods/AssertionsTest.java
langtools/test/tools/javac/defaultMethodsVisibility/DefaultMethodsNotVisibleForSourceLessThan8Test.java
langtools/test/tools/javac/fatalErrors/NoJavaLangTest.java
langtools/test/tools/javac/file/ExplodedImage.java
langtools/test/tools/javac/importscope/CompletionFailureDuringImport.java
langtools/test/tools/javac/importscope/ImportDependenciesTest.java
langtools/test/tools/javac/importscope/ImportMembersTest.java
langtools/test/tools/javac/importscope/NegativeCyclicDependencyTest.java
langtools/test/tools/javac/innerClassFile/InnerClassFileTest.java
langtools/test/tools/javac/javazip/JavaZipTest.java
langtools/test/tools/javac/lambda/T8129740/SourceToSourceTranslationTest.java
langtools/test/tools/javac/lambda/lambdaNaming/TestNonSerializableLambdaNameStability.java
langtools/test/tools/javac/lambda/lambdaNaming/TestSerializedLambdaNameStability.java
langtools/test/tools/javac/links/LinksTest.java
langtools/test/tools/javac/modules/AbstractOrInnerClassServiceImplTest.java
langtools/test/tools/javac/modules/AddLimitMods.java
langtools/test/tools/javac/modules/AddReadsTest.java
langtools/test/tools/javac/modules/AnnotationProcessing.java
langtools/test/tools/javac/modules/AnnotationProcessorsInModulesTest.java
langtools/test/tools/javac/modules/AutomaticModules.java
langtools/test/tools/javac/modules/DoclintOtherModules.java
langtools/test/tools/javac/modules/DuplicateClassTest.java
langtools/test/tools/javac/modules/EdgeCases.java
langtools/test/tools/javac/modules/GraphsTest.java
langtools/test/tools/javac/modules/HelloWorldTest.java
langtools/test/tools/javac/modules/MOptionTest.java
langtools/test/tools/javac/modules/ModuleFinderTest.java
langtools/test/tools/javac/modules/ModuleInfoTest.java
langtools/test/tools/javac/modules/ModulePathTest.java
langtools/test/tools/javac/modules/ModuleSourcePathTest.java
langtools/test/tools/javac/modules/ModuleTestBase.java
langtools/test/tools/javac/modules/ModulesAndClassPathTest.java
langtools/test/tools/javac/modules/MultiModuleModeTest.java
langtools/test/tools/javac/modules/NPECompilingModuleInfoTest.java
langtools/test/tools/javac/modules/NPEEmptyFileTest.java
langtools/test/tools/javac/modules/OutputDirTest.java
langtools/test/tools/javac/modules/PackageConflictTest.java
langtools/test/tools/javac/modules/PackageMultipleModules.java
langtools/test/tools/javac/modules/PluginsInModulesTest.java
langtools/test/tools/javac/modules/ProvidesTest.java
langtools/test/tools/javac/modules/QueryBeforeEnter.java
langtools/test/tools/javac/modules/RepeatedUsesAndProvidesTest.java
langtools/test/tools/javac/modules/ReportNonExistentPackageTest.java
langtools/test/tools/javac/modules/RequiresPublicTest.java
langtools/test/tools/javac/modules/ResolveTest.java
langtools/test/tools/javac/modules/ServiceInStaticClassErrorTest.java
langtools/test/tools/javac/modules/ServiceProvidedButNotExportedOrUsedTest.java
langtools/test/tools/javac/modules/SingleModuleModeTest.java
langtools/test/tools/javac/modules/SubpackageTest.java
langtools/test/tools/javac/modules/UpgradeModulePathTest.java
langtools/test/tools/javac/modules/UsesTest.java
langtools/test/tools/javac/modules/XModuleTest.java
langtools/test/tools/javac/newlines/NewLineTest.java
langtools/test/tools/javac/platform/PlatformProviderTest.java
langtools/test/tools/javac/plugin/showtype/Test.java
langtools/test/tools/javac/processing/rounds/CompleteOnClosed.java
langtools/test/tools/javac/processing/rounds/OverwriteBetweenCompilations.java
langtools/test/tools/javac/stackmap/StackMapTest.java
langtools/test/tools/javac/sym/ElementStructureTest.java
langtools/test/tools/javac/tree/8067914/NukeExtraCast.java
langtools/test/tools/javadoc/CompletionError.java
langtools/test/tools/javah/6257087/T6257087.java
langtools/test/tools/javah/ModuleClass.java
langtools/test/tools/javah/T4942232/MissingParamClassTest.java
langtools/test/tools/javah/constMacroTest/ConstMacroTest.java
langtools/test/tools/javap/4798312/JavapShouldLoadClassesFromRTJarTest.java
langtools/test/tools/javap/4866831/PublicInterfaceTest.java
langtools/test/tools/javap/T6729471.java
langtools/test/tools/javap/stackmap/StackmapTest.java
langtools/test/tools/lib/ToolBox.java
langtools/test/tools/lib/toolbox/AbstractTask.java
langtools/test/tools/lib/toolbox/ExecTask.java
langtools/test/tools/lib/toolbox/JarTask.java
langtools/test/tools/lib/toolbox/JavaTask.java
langtools/test/tools/lib/toolbox/JavacTask.java
langtools/test/tools/lib/toolbox/JavahTask.java
langtools/test/tools/lib/toolbox/JavapTask.java
langtools/test/tools/lib/toolbox/Task.java
langtools/test/tools/lib/toolbox/ToolBox.java
langtools/test/tools/sjavac/ApiExtraction.java
langtools/test/tools/sjavac/ClasspathDependencies.java
langtools/test/tools/sjavac/CompileCircularSources.java
langtools/test/tools/sjavac/CompileExcludingDependency.java
langtools/test/tools/sjavac/CompileWithAtFile.java
langtools/test/tools/sjavac/CompileWithInvisibleSources.java
langtools/test/tools/sjavac/CompileWithOverrideSources.java
langtools/test/tools/sjavac/HiddenFiles.java
langtools/test/tools/sjavac/IncCompInheritance.java
langtools/test/tools/sjavac/IncCompileChangeNative.java
langtools/test/tools/sjavac/IncCompileDropClasses.java
langtools/test/tools/sjavac/IncCompileFullyQualifiedRef.java
langtools/test/tools/sjavac/IncCompileNoChanges.java
langtools/test/tools/sjavac/IncCompileUpdateNative.java
langtools/test/tools/sjavac/IncCompileWithChanges.java
langtools/test/tools/sjavac/IncludeExcludePatterns.java
langtools/test/tools/sjavac/NoState.java
langtools/test/tools/sjavac/OverlappingSrcDst.java
langtools/test/tools/sjavac/PackagePathMismatch.java
langtools/test/tools/sjavac/ParallelCompilations.java
langtools/test/tools/sjavac/PermittedArtifact.java
langtools/test/tools/sjavac/SJavacTester.java
langtools/test/tools/sjavac/StateDir.java
--- a/langtools/test/jdk/jshell/ClassPathTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/jdk/jshell/ClassPathTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,7 +28,8 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib
- * @build KullaTesting TestingInputStream ToolBox Compiler
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
+ * @build KullaTesting TestingInputStream Compiler
  * @run testng ClassPathTest
  */
 
--- a/langtools/test/jdk/jshell/CommandCompletionTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/jdk/jshell/CommandCompletionTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -30,7 +30,8 @@
  *          jdk.jdeps/com.sun.tools.javap
  *          jdk.jshell/jdk.internal.jshell.tool
  * @library /tools/lib
- * @build ReplToolTesting TestingInputStream Compiler ToolBox
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
+ * @build ReplToolTesting TestingInputStream Compiler
  * @run testng CommandCompletionTest
  */
 
--- a/langtools/test/jdk/jshell/Compiler.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/jdk/jshell/Compiler.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -30,6 +30,10 @@
 import java.util.jar.Attributes;
 import java.util.jar.Manifest;
 
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class Compiler {
 
     private final ToolBox tb = new ToolBox();
@@ -57,7 +61,7 @@
 
     public void compile(Path directory, String...sources) {
         Path classDir = getClassDir();
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-d", classDir.resolve(directory).toString())
                 .sources(sources)
                 .run();
@@ -73,7 +77,7 @@
         Path classDirPath = getClassDir();
         Path baseDir = classDirPath.resolve(directory);
         Path jarPath = baseDir.resolve(jarName);
-        tb.new JarTask(jarPath.toString())
+        new JarTask(tb, jarPath.toString())
                 .manifest(manifest)
                 .baseDir(baseDir.toString())
                 .files(files).run();
--- a/langtools/test/jdk/jshell/CompletionSuggestionTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/jdk/jshell/CompletionSuggestionTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,7 +29,8 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib
- * @build KullaTesting TestingInputStream ToolBox Compiler
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
+ * @build KullaTesting TestingInputStream Compiler
  * @run testng CompletionSuggestionTest
  */
 
--- a/langtools/test/jdk/jshell/ComputeFQNsTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/jdk/jshell/ComputeFQNsTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -26,10 +26,10 @@
  * @bug 8131027
  * @summary Test Get FQNs
  * @library /tools/lib
- * @build KullaTesting TestingInputStream ToolBox Compiler
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
+ * @build KullaTesting TestingInputStream Compiler
  * @run testng ComputeFQNsTest
  */
 
--- a/langtools/test/jdk/jshell/ErrorTranslationTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/jdk/jshell/ErrorTranslationTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,7 +29,7 @@
  *          jdk.jdeps/com.sun.tools.javap
  *          jdk.jshell/jdk.internal.jshell.tool
  * @library /tools/lib
- * @build KullaTesting TestingInputStream ExpectedDiagnostic ToolBox Compiler
+ * @build KullaTesting TestingInputStream ExpectedDiagnostic toolbox.ToolBox Compiler
  * @run testng ErrorTranslationTest
  */
 
--- a/langtools/test/jdk/jshell/ImportTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/jdk/jshell/ImportTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,7 +28,7 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib
- * @build KullaTesting TestingInputStream ToolBox ExpectedDiagnostic
+ * @build KullaTesting TestingInputStream toolbox.Task.ExpectedDiagnostic
  * @run testng ImportTest
  */
 
--- a/langtools/test/jdk/jshell/InferTypeTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/jdk/jshell/InferTypeTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,7 +29,7 @@
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build KullaTesting TestingInputStream ToolBox Compiler
+ * @build KullaTesting TestingInputStream toolbox.ToolBox Compiler
  * @run testng InferTypeTest
  */
 
--- a/langtools/test/jdk/jshell/StartOptionTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/jdk/jshell/StartOptionTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,7 +29,7 @@
  *          jdk.jdeps/com.sun.tools.javap
  *          jdk.jshell/jdk.internal.jshell.tool
  * @library /tools/lib
- * @build Compiler ToolBox
+ * @build Compiler toolbox.ToolBox
  * @run testng StartOptionTest
  */
 
--- a/langtools/test/jdk/jshell/ToolBasicTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/jdk/jshell/ToolBasicTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -24,11 +24,12 @@
 /*
  * @test
  * @bug 8143037 8142447 8144095 8140265 8144906 8146138 8147887 8147886 8148316 8148317
+ * @summary Tests for Basic tests for REPL tool
  * @requires os.family != "solaris"
- * @summary Tests for Basic tests for REPL tool
  * @library /tools/lib
  * @ignore 8139873
- * @build KullaTesting TestingInputStream ToolBox Compiler
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
+ * @build KullaTesting TestingInputStream Compiler
  * @run testng/timeout=600 ToolBasicTest
  */
 
--- a/langtools/test/jdk/jshell/ToolFormatTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/jdk/jshell/ToolFormatTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -30,7 +30,7 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
  *          jdk.jshell/jdk.internal.jshell.tool
- * @build KullaTesting TestingInputStream ToolBox Compiler
+ * @build KullaTesting TestingInputStream toolbox.ToolBox Compiler
  * @run testng ToolFormatTest
  */
 import java.util.ArrayList;
--- a/langtools/test/jdk/jshell/ToolReloadTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/jdk/jshell/ToolReloadTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -31,7 +31,7 @@
  *          jdk.jdeps/com.sun.tools.javap
  *          jdk.jshell/jdk.internal.jshell.tool
  * @library /tools/lib
- * @build KullaTesting TestingInputStream ToolBox Compiler
+ * @build KullaTesting TestingInputStream toolbox.ToolBox Compiler
  * @run testng ToolReloadTest
  */
 
--- a/langtools/test/tools/doclint/tool/PathsTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/doclint/tool/PathsTest.java	Thu Mar 31 15:20:50 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
@@ -28,18 +28,11 @@
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.doclint
  *          jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.compiler/com.sun.tools.javac.util
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JarTask
  * @run main PathsTest
  */
 
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.doclint.DocLint;
-import com.sun.tools.doclint.DocLint.BadArgs;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
@@ -48,6 +41,13 @@
 import java.util.regex.Pattern;
 import javax.tools.StandardLocation;
 import javax.tools.JavaFileManager;
+import javax.tools.ToolProvider;
+
+import com.sun.tools.doclint.DocLint;
+import com.sun.tools.doclint.DocLint.BadArgs;
+
+import toolbox.JarTask;
+import toolbox.ToolBox;
 
 public class PathsTest {
     public static void main(String... args) throws Exception {
@@ -117,9 +117,10 @@
 
     File createJar() throws IOException {
         File f = new File("test.jar");
-        try (JavaFileManager fm = new JavacFileManager(new Context(), false, null)) {
+        try (JavaFileManager fm = ToolProvider.getSystemJavaCompiler()
+                .getStandardFileManager(null, null, null)) {
             ToolBox tb = new ToolBox();
-            tb.new JarTask(f.getPath())
+            new JarTask(tb, f.getPath())
                 .files(fm, StandardLocation.PLATFORM_CLASS_PATH, "java.lang.*")
                 .run();
         }
--- a/langtools/test/tools/javac/4846262/CheckEBCDICLocaleTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/4846262/CheckEBCDICLocaleTest.java	Thu Mar 31 15:20:50 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,10 +27,9 @@
  * @summary check that javac operates correctly in EBCDIC locale
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox
  * @run main CheckEBCDICLocaleTest
  */
 
@@ -45,6 +44,8 @@
 import java.util.Arrays;
 import java.util.List;
 
+import toolbox.ToolBox;
+
 public class CheckEBCDICLocaleTest {
 
     private static final String TestSrc =
--- a/langtools/test/tools/javac/6302184/HiddenOptionsShouldUseGivenEncodingTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/6302184/HiddenOptionsShouldUseGivenEncodingTest.java	Thu Mar 31 15:20:50 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
@@ -28,10 +28,8 @@
  * encoding, if available
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox
  * @run compile -encoding iso-8859-1 -XD-printsource T6302184.java
  * @run main HiddenOptionsShouldUseGivenEncodingTest
  */
@@ -40,6 +38,8 @@
 import java.nio.file.Paths;
 import java.util.List;
 
+import toolbox.ToolBox;
+
 // Original test: test/tools/javac/6302184/T6302184.sh
 public class HiddenOptionsShouldUseGivenEncodingTest {
 
--- a/langtools/test/tools/javac/6508981/TestInferBinaryName.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/6508981/TestInferBinaryName.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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,11 +28,8 @@
  * (This test is specifically to test the new impl of inferBinaryName)
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.compiler/com.sun.tools.javac.util
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox p.A
+ * @build toolbox.ToolBox toolbox.JarTask p.A
  * @run main TestInferBinaryName
  */
 
@@ -40,13 +37,11 @@
 import java.util.*;
 import javax.tools.*;
 
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.Options;
-
 import static javax.tools.JavaFileObject.Kind.*;
 import static javax.tools.StandardLocation.*;
 
+import toolbox.JarTask;
+import toolbox.ToolBox;
 
 /**
  * Verify the various implementations of inferBinaryName, but configuring
@@ -70,9 +65,10 @@
 
     File createJar() throws IOException {
         File f = new File("test.jar");
-        try (JavaFileManager fm = new JavacFileManager(new Context(), false, null)) {
+        try (JavaFileManager fm = ToolProvider.getSystemJavaCompiler()
+                .getStandardFileManager(null, null, null)) {
             ToolBox tb = new ToolBox();
-            tb.new JarTask(f.getPath())
+            new JarTask(tb, f.getPath())
                 .files(fm, StandardLocation.PLATFORM_CLASS_PATH, "java.lang.*")
                 .run();
         }
@@ -124,9 +120,8 @@
 
     JavaFileManager getFileManager(List<File> path)
             throws IOException {
-        Context ctx = new Context();
-
-        JavacFileManager fm = new JavacFileManager(ctx, false, null);
+        StandardJavaFileManager fm = ToolProvider.getSystemJavaCompiler()
+                .getStandardFileManager(null, null, null);
         fm.setLocation(CLASS_PATH, path);
         return fm;
     }
--- a/langtools/test/tools/javac/AnonymousSubclassTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/AnonymousSubclassTest.java	Thu Mar 31 15:20:50 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
@@ -27,13 +27,15 @@
  * @summary javac wrongly allows a subclass of an anonymous class
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main AnonymousSubclassTest
  */
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class AnonymousSubclassTest {
     public static void main(String... args) throws Exception {
         new AnonymousSubclassTest().run();
@@ -68,19 +70,19 @@
         "}";
 
     void compOk(String code) throws Exception {
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .sources(code)
                 .run();
     }
 
     void compFail(String code) throws Exception {
-        String errs = tb.new JavacTask()
+        String errs = new JavacTask(tb)
                 .sources(code)
                 .classpath(".")
                 .options("-XDrawDiagnostics")
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!errs.contains("cant.inherit.from.anon")) {
             throw new Exception("test failed");
--- a/langtools/test/tools/javac/ClassPathTest/ClassPathTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/ClassPathTest/ClassPathTest.java	Thu Mar 31 15:20:50 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,15 +27,17 @@
  * @summary Test -classpath option and classpath defaults.
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main ClassPathTest
  */
 
 import java.nio.file.Paths;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 // Original test: test/tools/javac/ClassPathTest/ClassPathTest.sh
 public class ClassPathTest {
 
@@ -100,55 +102,55 @@
 //        automatically but this is not happening when called using ProcessBuilder
 
 //        testJavac success ClassPathTest3.java
-        tb.new JavacTask(ToolBox.Mode.EXEC)
+        new JavacTask(tb, Task.Mode.EXEC)
                 .classpath(".")
                 .files("ClassPathTest3.java")
                 .run();
 
 //        testJavac failure ClassPathTest1.java
-        tb.new JavacTask(ToolBox.Mode.EXEC)
+        new JavacTask(tb, Task.Mode.EXEC)
                 .classpath(".")
                 .files("ClassPathTest1.java")
-                .run(ToolBox.Expect.FAIL);
+                .run(Task.Expect.FAIL);
 
 //        testJavac success ClassPathTest2.java
-        tb.new JavacTask(ToolBox.Mode.EXEC)
+        new JavacTask(tb, Task.Mode.EXEC)
                 .envVar("CLASSPATH", "bar")
                 .files("ClassPathTest2.java")
                 .run();
 
 //        testJavac failure ClassPathTest1.java
-        tb.new JavacTask(ToolBox.Mode.EXEC)
+        new JavacTask(tb, Task.Mode.EXEC)
                 .envVar("CLASSPATH", "bar")
                 .files("ClassPathTest1.java")
-                .run(ToolBox.Expect.FAIL);
+                .run(Task.Expect.FAIL);
 
 //        testJavac failure ClassPathTest3.java
-        tb.new JavacTask(ToolBox.Mode.EXEC)
+        new JavacTask(tb, Task.Mode.EXEC)
                 .envVar("CLASSPATH", "bar")
                 .files("ClassPathTest3.java")
-                .run(ToolBox.Expect.FAIL);
+                .run(Task.Expect.FAIL);
 
 //        testJavac success -classpath foo ClassPathTest1.java
-        tb.new JavacTask(ToolBox.Mode.EXEC)
+        new JavacTask(tb, Task.Mode.EXEC)
                 .envVar("CLASSPATH", "bar")
                 .classpath("foo")
                 .files("ClassPathTest1.java")
                 .run();
 
 //        testJavac failure -classpath foo ClassPathTest2.java
-        tb.new JavacTask(ToolBox.Mode.EXEC)
+        new JavacTask(tb, Task.Mode.EXEC)
                 .envVar("CLASSPATH", "bar")
                 .classpath("foo")
                 .files("ClassPathTest2.java")
-                .run(ToolBox.Expect.FAIL);
+                .run(Task.Expect.FAIL);
 
 //        testJavac failure -classpath foo ClassPathTest3.java
-        tb.new JavacTask(ToolBox.Mode.EXEC)
+        new JavacTask(tb, Task.Mode.EXEC)
                 .envVar("CLASSPATH", "bar")
                 .classpath("foo")
                 .files("ClassPathTest3.java")
-                .run(ToolBox.Expect.FAIL);
+                .run(Task.Expect.FAIL);
     }
 
 }
--- a/langtools/test/tools/javac/ConstFoldTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/ConstFoldTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,10 +27,9 @@
  * @summary Constant folding deficiency
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavapTask
  * @run main ConstFoldTest
  */
 
@@ -39,6 +38,10 @@
 import java.nio.file.Paths;
 import java.util.List;
 
+import toolbox.JavapTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class ConstFoldTest {
     public static void main(String... args) throws Exception {
         new ConstFoldTest().run();
@@ -82,12 +85,12 @@
 
         URL url = ConstFoldTest.class.getResource("ConstFoldTest$CFTest.class");
         Path file = Paths.get(url.toURI());
-        List<String> result = tb.new JavapTask()
+        List<String> result = new JavapTask(tb)
                 .options("-c")
                 .classes(file.toString())
                 .run()
-                .write(ToolBox.OutputKind.DIRECT)
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .write(Task.OutputKind.DIRECT)
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> bad_codes = tb.grep(regex, result);
         if (!bad_codes.isEmpty()) {
--- a/langtools/test/tools/javac/ExtDirs/ExtDirTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/ExtDirs/ExtDirTest.java	Thu Mar 31 15:20:50 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,15 +27,17 @@
  * @summary Test that '.jar' files in -extdirs are found.
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @run main ExtDirTest
  */
 
 import java.io.File;
 
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 // Original test: test/tools/javac/ExtDirs/ExtDirs.sh
 public class ExtDirTest {
 
@@ -112,22 +114,22 @@
     }
 
     void createJars() throws Exception {
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(".")
                 .sources(ExtDirTestClass1Src)
                 .run();
 
-        tb.new JarTask("pkg1.jar")
+        new JarTask(tb, "pkg1.jar")
                 .manifest(jar1Manifest)
                 .files("pkg1/ExtDirTestClass1.class")
                 .run();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(".")
                 .sources(ExtDirTestClass2Src)
                 .run();
 
-        tb.new JarTask("pkg2.jar")
+        new JarTask(tb, "pkg2.jar")
                 .manifest(jar2Manifest)
                 .files("pkg2/ExtDirTestClass2.class")
                 .run();
@@ -149,7 +151,7 @@
     }
 
     void compileWithExtDirs() throws Exception {
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(".")
                 .options("-source", "8",
                         "-extdirs", "ext1")
@@ -157,7 +159,7 @@
                 .run()
                 .writeAll();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(".")
                 .options("-source", "8",
                         "-extdirs", "ext1" + File.pathSeparator + "ext2")
@@ -165,7 +167,7 @@
                 .run()
                 .writeAll();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(".")
                 .options("-source", "8",
                         "-extdirs", "ext3")
--- a/langtools/test/tools/javac/IncorrectInheritance/IncorrectInheritanceTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/IncorrectInheritance/IncorrectInheritanceTest.java	Thu Mar 31 15:20:50 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
@@ -27,13 +27,15 @@
  * @summary Incorrect inheritance of inaccessible static method
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main IncorrectInheritanceTest
  */
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class IncorrectInheritanceTest {
     private static final String ASrc =
             "package pkg;\n" +
@@ -65,7 +67,7 @@
     public void test() throws Exception {
         ToolBox tb = new ToolBox();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .sources(ASrc, BSrc, CSrc)
                 .run();
     }
--- a/langtools/test/tools/javac/MissingInclude/MissingIncludeTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/MissingInclude/MissingIncludeTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,13 +28,15 @@
  * doesn't exist.
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main MissingIncludeTest
  */
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 // Original test: test/tools/javac/MissingInclude.sh
 public class MissingIncludeTest {
 
@@ -46,10 +48,10 @@
 
         tb.writeFile(MissingIncludeFile, MissingIncludeSrc);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("@/nonexistent_file")
                 .files(MissingIncludeFile)
-                .run(ToolBox.Expect.FAIL);
+                .run(Task.Expect.FAIL);
     }
 
 }
--- a/langtools/test/tools/javac/Paths/AbsolutePathTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/Paths/AbsolutePathTest.java	Thu Mar 31 15:20:50 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
@@ -28,11 +28,9 @@
  * @author govereau
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
  * @ignore 8055768 ToolBox does not close opened files
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask toolbox.JarTask
  * @run main AbsolutePathTest
  */
 
@@ -40,12 +38,16 @@
 import java.nio.file.Files;
 import java.nio.file.Paths;
 
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class AbsolutePathTest {
     public static void main(String... cmdline) throws Exception {
         ToolBox tb = new ToolBox();
 
         // compile test.Test
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(".") // this is needed to get the classfiles in test
                 .sources("package test; public class Test{}")
                 .run();
@@ -54,18 +56,18 @@
         // we need the jars in a directory different from the working
         // directory to trigger the bug.
         Files.createDirectory(Paths.get("jars"));
-        tb.new JarTask("jars/test.jar")
+        new JarTask(tb, "jars/test.jar")
                 .files("test/Test.class")
                 .run();
 
         // build second jar in jars directory using
         // an absolute path reference to the first jar
-        tb.new JarTask("jars/test2.jar")
+        new JarTask(tb, "jars/test2.jar")
                 .classpath(new File("jars/test.jar").getAbsolutePath())
                 .run();
 
         // this should not fail
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(".")
                 .classpath("jars/test2.jar")
                 .sources("import test.Test; class Test2 {}")
--- a/langtools/test/tools/javac/ProtectedInnerClass/ProtectedInnerClassesTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/ProtectedInnerClass/ProtectedInnerClassesTest.java	Thu Mar 31 15:20:50 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,13 +27,16 @@
  * @summary Verify allowed access to protected class from another package
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavaTask toolbox.JavacTask
  * @run main ProtectedInnerClassesTest
  */
 
+import toolbox.JavaTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 // Original tests: test/tools/javac/ProtectedInnerClass/ProtectedInnerClass.sh
 // and test/tools/javac/ProtectedInnerClass/ProtectedInnerClass_2.java
 public class ProtectedInnerClassesTest {
@@ -86,12 +89,12 @@
     }
 
     void compileAndExecute() throws Exception {
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(".")
                 .sources(protectedInnerClass1Src, protectedInnerClass2Src)
                 .run();
 
-        tb.new JavaTask()
+        new JavaTask(tb)
                 .classpath(System.getProperty("user.dir"))
                 .className("p2.ProtectedInnerClass2")
                 .run();
@@ -99,15 +102,15 @@
 
 //from test/tools/javac/ProtectedInnerClass/ProtectedInnerClass_2.java
     void compileOnly() throws Exception {
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(".")
                 .sources(protectedInnerClass1Src)
                 .run();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(".")
                 .sources(protectedInnerClass3Src)
-                .run(ToolBox.Expect.FAIL);
+                .run(Task.Expect.FAIL);
     }
 
 }
--- a/langtools/test/tools/javac/T5090006/AssertionFailureTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/T5090006/AssertionFailureTest.java	Thu Mar 31 15:20:50 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,16 +27,18 @@
  * @summary javac fails with assertion error
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main AssertionFailureTest
  */
 
 import java.io.File;
 import java.nio.file.Paths;
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 // Original test: test/tools/javac/T5090006/compiler.sh
 public class AssertionFailureTest {
 
@@ -62,7 +64,7 @@
         String classpath = Paths.get(tb.testSrc, "broken.jar")
                 + File.pathSeparator
                 + ".";
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .classpath(classpath)
                 .sources(testSrc)
                 .run();
--- a/langtools/test/tools/javac/T6558476.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/T6558476.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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,10 +27,9 @@
  * @summary com/sun/tools/javac/Main.compile don't release file handles on return
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @run main/othervm -Xmx512m -Xms512m  T6558476
  */
 
@@ -42,6 +41,10 @@
 
 import com.sun.tools.javac.Main;
 
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class T6558476 {
 
     private static final String classFoo = "class Foo {}";
@@ -55,17 +58,17 @@
     public static void main(String[] args) throws IOException {
         ToolBox tb = new ToolBox();
 
-        tb.new JavacTask()
-          .sources(classFoo)
-          .run();
-        tb.new JarTask("foo.jar")
-          .files("Foo.class")
-          .run();
+        new JavacTask(tb)
+            .sources(classFoo)
+            .run();
+        new JarTask(tb, "foo.jar")
+            .files("Foo.class")
+            .run();
 
-        tb.new JavacTask()
-          .classpath("foo.jar")
-          .sources(classMyFoo)
-          .run();
+        new JavacTask(tb)
+            .classpath("foo.jar")
+            .sources(classMyFoo)
+            .run();
         File foo_jar = new File("foo.jar");
         if (foo_jar.delete()) {
             System.out.println("jar file successfully deleted");
--- a/langtools/test/tools/javac/T6725036.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/T6725036.java	Thu Mar 31 15:20:50 2016 -0700
@@ -31,8 +31,7 @@
  *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JarTask
  * @run main T6725036
  */
 
@@ -49,6 +48,9 @@
 import com.sun.tools.javac.file.RelativePath.RelativeFile;
 import com.sun.tools.javac.util.Context;
 
+import toolbox.JarTask;
+import toolbox.ToolBox;
+
 public class T6725036 {
     public static void main(String... args) throws Exception {
         new T6725036().run();
@@ -82,7 +84,7 @@
         try (JavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
             File f = new File(name);
             ToolBox tb = new ToolBox();
-            tb.new JarTask(name)
+            new JarTask(tb, name)
                 .files(fm, StandardLocation.PLATFORM_CLASS_PATH, paths)
                 .run();
             return f;
--- a/langtools/test/tools/javac/T6970173/DebugPointerAtBadPositionTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/T6970173/DebugPointerAtBadPositionTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,11 +28,10 @@
  * @library /tools/lib
  * @modules jdk.jdeps/com.sun.tools.classfile
  *          jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main DebugPointerAtBadPositionTest
  */
 
@@ -45,6 +44,9 @@
 import com.sun.tools.classfile.Method;
 import com.sun.tools.javac.util.Assert;
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class DebugPointerAtBadPositionTest {
 
     static final String testSource =
@@ -82,7 +84,7 @@
 
     void compileTestClass() throws Exception {
         ToolBox tb = new ToolBox();
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .sources(testSource)
                 .run();
     }
--- a/langtools/test/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java	Thu Mar 31 15:20:50 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
@@ -28,11 +28,10 @@
  * @library /tools/lib
  * @modules jdk.jdeps/com.sun.tools.classfile
  *          jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main InlinedFinallyConfuseDebuggersTest
  */
 
@@ -45,6 +44,9 @@
 import com.sun.tools.classfile.Method;
 import com.sun.tools.javac.util.Assert;
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class InlinedFinallyConfuseDebuggersTest {
 
     static final String testSource =
@@ -88,7 +90,7 @@
     }
 
     void compileTestClass() throws Exception {
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .sources(testSource)
                 .run();
     }
--- a/langtools/test/tools/javac/T8009640/CheckRejectProfileBCPOptionsIfUsedTogetherTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/T8009640/CheckRejectProfileBCPOptionsIfUsedTogetherTest.java	Thu Mar 31 15:20:50 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,16 +27,20 @@
  * @summary -profile <compact> does not work when -bootclasspath specified
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main CheckRejectProfileBCPOptionsIfUsedTogetherTest
  */
 
+import java.nio.file.Paths;
+
 import com.sun.tools.javac.util.Assert;
-import java.nio.file.Paths;
+
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
 
 public class CheckRejectProfileBCPOptionsIfUsedTogetherTest {
 
@@ -49,14 +53,14 @@
         ToolBox tb = new ToolBox();
         tb.writeFile("Test.java", TestSrc);
 
-        ToolBox.Result result = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        Task.Result result = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-profile", "compact1",
                         "-bootclasspath", Paths.get(ToolBox.testJDK, "jre/lib/rt.jar").toString())
                 .files("Test.java")
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll();
 
-        String out = result.getOutput(ToolBox.OutputKind.DIRECT);
+        String out = result.getOutput(Task.OutputKind.DIRECT);
         Assert.check(out.startsWith(
                 "javac: profile and bootclasspath options cannot be used together"),
                 "Incorrect javac error output");
--- a/langtools/test/tools/javac/T8010659/CompilerCrashWhenMixingBinariesAndSourcesTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/T8010659/CompilerCrashWhenMixingBinariesAndSourcesTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,13 +27,14 @@
  * @summary Javac Crashes while building OpenJFX
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main CompilerCrashWhenMixingBinariesAndSourcesTest
  */
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class CompilerCrashWhenMixingBinariesAndSourcesTest {
     private static final String ASource =
             "class A {\n" +
@@ -53,13 +54,13 @@
     public static void main(String[] args) throws Exception {
         ToolBox tb = new ToolBox();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .sources(ASource, BSource, CSource, DSource)
                 .run();
 
         tb.deleteFiles("A.class", "A$1.class", "C.class", "D.class");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .classpath(".")
                 .sources(ASource, CSource, DSource)
                 .run();
--- a/langtools/test/tools/javac/T8013394/CompileErrorWithIteratorTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/T8013394/CompileErrorWithIteratorTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,13 +27,14 @@
  * @summary compile of iterator use fails with error "defined in an inaccessible class or interface"
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main CompileErrorWithIteratorTest
  */
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class CompileErrorWithIteratorTest {
 
     private static final String TestCollectionSrc =
@@ -80,7 +81,7 @@
     }
 
     void compile() throws Exception {
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .sources(TestCollectionSrc, TestSrc)
                 .run();
     }
--- a/langtools/test/tools/javac/T8019486/WrongLNTForLambdaTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/T8019486/WrongLNTForLambdaTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,12 +27,10 @@
  * @summary javac, generates erroneous LVT for a test case with lambda code
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main WrongLNTForLambdaTest
  */
 
@@ -45,6 +43,9 @@
 import com.sun.tools.classfile.Method;
 import com.sun.tools.javac.util.Assert;
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class WrongLNTForLambdaTest {
 
     static final String testSource =
@@ -152,7 +153,7 @@
     }
 
     void compileTestClass() throws Exception {
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .sources(testSource)
                 .run();
     }
--- a/langtools/test/tools/javac/T8022162/IncorrectSignatureDeterminationForInnerClassesTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/T8022162/IncorrectSignatureDeterminationForInnerClassesTest.java	Thu Mar 31 15:20:50 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,13 +27,15 @@
  * @summary Incorrect signature determination for certain inner class generics
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main IncorrectSignatureDeterminationForInnerClassesTest
  */
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class IncorrectSignatureDeterminationForInnerClassesTest {
 
     private static final String DSrc =
@@ -73,13 +75,13 @@
         ToolBox tb = new ToolBox();
         tb.createDirectories("classes");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir("classes")
                 .sources(DSrc)
                 .run();
 
         // compile class H against the class files for classes D and Q
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir("classes")
                 .classpath("classes")
                 .sources(HSrc)
--- a/langtools/test/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,12 +27,10 @@
  * @summary javac, previous solution for JDK-8022186 was incorrect
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main NoDeadCodeGenerationOnTrySmtTest
  */
 
@@ -45,6 +43,9 @@
 import com.sun.tools.classfile.Method;
 import com.sun.tools.javac.util.Assert;
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class NoDeadCodeGenerationOnTrySmtTest {
 
     static final String testSource =
@@ -93,7 +94,7 @@
     }
 
     void compileTestClass() throws Exception {
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .sources(testSource)
                 .run();
     }
--- a/langtools/test/tools/javac/T8024437/ExceptionInferenceFromClassFileTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/T8024437/ExceptionInferenceFromClassFileTest.java	Thu Mar 31 15:20:50 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,16 +27,18 @@
  * @summary Inferring the exception thrown by a lambda: sometimes fails to compile
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main ExceptionInferenceFromClassFileTest
  */
 
 import java.nio.file.Files;
 import java.nio.file.Paths;
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class ExceptionInferenceFromClassFileTest {
 
     static final String ABSrc =
@@ -61,12 +63,12 @@
         ToolBox tb = new ToolBox();
         tb.createDirectories("out");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir("out")
                 .sources(ABSrc)
                 .run();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir("out")
                 .classpath("out")
                 .sources(CSrc)
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/NestedLambdasCastedTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/NestedLambdasCastedTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,10 +27,9 @@
  * @summary No type annotations generated for nested lambdas
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavapTask
  * @run compile -g NestedLambdasCastedTest.java
  * @run main NestedLambdasCastedTest
  */
@@ -40,20 +39,24 @@
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Target;
 
+import toolbox.JavapTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class NestedLambdasCastedTest {
 
     // Expected output can't be directly encoded into NestedLambdasCastedTest !!!
     static class ExpectedOutputHolder {
-        public String [] outputs = {
+        public String[] outputs = {
                       "public static strictfp void main(java.lang.String[])",
                       "private static strictfp void lambda$main$3();",
                       "private static strictfp void lambda$main$2();",
                       "private static strictfp void lambda$main$1();",
                       "private static strictfp void lambda$main$0();",
-                      "0: #63(#64=s#65): CAST, offset=5, type_index=0",
-                      "0: #63(#64=s#70): CAST, offset=5, type_index=0",
-                      "0: #63(#64=s#73): CAST, offset=5, type_index=0",
-                      "0: #63(#64=s#76): CAST, offset=5, type_index=0"
+                      "0: #62(#63=s#64): CAST, offset=5, type_index=0",
+                      "0: #62(#63=s#69): CAST, offset=5, type_index=0",
+                      "0: #62(#63=s#72): CAST, offset=5, type_index=0",
+                      "0: #62(#63=s#75): CAST, offset=5, type_index=0"
         };
     }
 
@@ -73,11 +76,11 @@
         };
         ToolBox tb = new ToolBox();
         Path classPath = Paths.get(ToolBox.testClasses, "NestedLambdasCastedTest.class");
-        String javapOut = tb.new JavapTask()
+        String javapOut = new JavapTask(tb)
                 .options("-v", "-p")
                 .classes(classPath.toString())
                 .run()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
         ExpectedOutputHolder holder = new ExpectedOutputHolder();
         for (String s : holder.outputs) {
             if (!javapOut.contains(s))
--- a/langtools/test/tools/javac/api/ToolProvider/HelloWorldTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/api/ToolProvider/HelloWorldTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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,15 +27,17 @@
  * @summary ToolProvider should be less compiler-specific
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavaTask
  * @run main HelloWorldTest
  */
 
 import java.util.Arrays;
 
+import toolbox.JavaTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 // verify that running a simple program, such as this one, does not trigger
 // the loading of ToolProvider or any com.sun.tools.javac class
 public class HelloWorldTest {
@@ -53,15 +55,15 @@
 
         String classpath = System.getProperty("java.class.path");
 
-        ToolBox.Result tr = tb.new JavaTask()
+        Task.Result tr = new JavaTask(tb)
                 .vmOptions("-verbose:class")
                 .classpath(classpath)
                 .className(HelloWorldTest.class.getName())
                 .classArgs("Hello", "World")
                 .run();
 
-        if (tr.getOutput(ToolBox.OutputKind.STDOUT).contains("java.lang.Object")) {
-            for (String line : tr.getOutputLines(ToolBox.OutputKind.STDOUT)) {
+        if (tr.getOutput(Task.OutputKind.STDOUT).contains("java.lang.Object")) {
+            for (String line : tr.getOutputLines(Task.OutputKind.STDOUT)) {
                 System.err.println(line);
                 if (line.contains("javax.tools.ToolProvider") || line.contains("com.sun.tools.javac."))
                     error(">>> " + line);
--- a/langtools/test/tools/javac/api/ToolProvider/ToolProviderTest1.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/api/ToolProvider/ToolProviderTest1.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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,15 +27,17 @@
  * @summary ToolProvider should be less compiler-specific
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavaTask
  * @run main ToolProviderTest1
  */
 
 import java.util.List;
 
+import toolbox.JavaTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 // verify that running accessing ToolProvider by itself does not
 // trigger loading com.sun.tools.javac.*
 public class ToolProviderTest1 {
@@ -52,13 +54,13 @@
         ToolBox tb = new ToolBox();
         String classpath = System.getProperty("java.class.path");
 
-        List<String> lines = tb.new JavaTask()
+        List<String> lines = new JavaTask(tb)
                 .vmOptions("-verbose:class")
                 .classpath(classpath)
                 .className(getClass().getName())
                 .classArgs("javax.tools.ToolProvider")
                 .run()
-                .getOutputLines(ToolBox.OutputKind.STDOUT);
+                .getOutputLines(Task.OutputKind.STDOUT);
 
         for (String line : lines) {
             System.err.println(line);
--- a/langtools/test/tools/javac/api/ToolProvider/ToolProviderTest2.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/api/ToolProvider/ToolProviderTest2.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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,18 @@
  * @summary ToolProvider should be less compiler-specific
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavaTask
  * @run main ToolProviderTest2
  */
 
 import javax.tools.ToolProvider;
 import java.util.List;
 
+import toolbox.JavaTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 // control for ToolProviderTest1 -- verify that using ToolProvider to
 // access the compiler does trigger loading com.sun.tools.javac.*
 public class ToolProviderTest2 {
@@ -53,13 +55,13 @@
         ToolBox tb = new ToolBox();
         String classpath = System.getProperty("java.class.path");
 
-        List<String> lines = tb.new JavaTask()
+        List<String> lines = new JavaTask(tb)
                 .vmOptions("-verbose:class")
                 .classpath(classpath)
                 .className(getClass().getName())
                 .classArgs("javax.tools.ToolProvider")
                 .run()
-                .getOutputLines(ToolBox.OutputKind.STDOUT);
+                .getOutputLines(Task.OutputKind.STDOUT);
 
         boolean found = false;
         for (String line : lines) {
--- a/langtools/test/tools/javac/boxing/IncrementBoxedAndAccess.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/boxing/IncrementBoxedAndAccess.java	Thu Mar 31 15:20:50 2016 -0700
@@ -25,10 +25,12 @@
  * @test
  * @bug 8143388
  * @summary Verify that boxed postfix operator works properly when referring to super class' field.
+ * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @library /tools/lib
+ * @build toolbox.ToolBox toolbox.JavacTask
+ * @run main IncrementBoxedAndAccess
  */
 
 import java.io.IOException;
@@ -36,6 +38,9 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class IncrementBoxedAndAccess {
     public static void main(String... args) throws IOException {
         new IncrementBoxedAndAccess().run();
@@ -47,7 +52,7 @@
         Path expected = Paths.get("expected");
         Files.createDirectories(expected);
         tb.cleanDirectory(expected);
-        tb.new JavacTask()
+        new JavacTask(tb)
           .sources("package p1;" +
                    "public class B {" +
                    "    protected Integer i;" +
@@ -68,7 +73,7 @@
         Path actual = Paths.get("actual");
         Files.createDirectories(actual);
         tb.cleanDirectory(actual);
-        tb.new JavacTask()
+        new JavacTask(tb)
           .sources("package p1;" +
                    "public class B {" +
                    "    protected Integer i;" +
--- a/langtools/test/tools/javac/classfiles/InnerClasses/T8068517.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/InnerClasses/T8068517.java	Thu Mar 31 15:20:50 2016 -0700
@@ -26,11 +26,10 @@
  * @summary Verify that nested enums have correct abstract flag in the InnerClasses attribute.
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox T8068517
+ * @build toolbox.ToolBox toolbox.JavacTask
+ * @build T8068517
  * @run main T8068517
  */
 
@@ -40,6 +39,9 @@
 import javax.tools.StandardLocation;
 import javax.tools.ToolProvider;
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class T8068517 {
 
     public static void main(String[] args) throws Exception {
@@ -106,11 +108,11 @@
         try (JavaFileManager fm = ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null)) {
             ToolBox tb = new ToolBox();
             ToolBox.MemoryFileManager memoryFM1 = new ToolBox.MemoryFileManager(fm);
-            tb.new JavacTask().fileManager(memoryFM1)
+            new JavacTask(tb).fileManager(memoryFM1)
                               .sources(aJava, bJava)
                               .run();
             ToolBox.MemoryFileManager memoryFM2 = new ToolBox.MemoryFileManager(fm);
-            tb.new JavacTask().fileManager(memoryFM2)
+            new JavacTask(tb).fileManager(memoryFM2)
                               .sources(bJava, aJava)
                               .run();
 
--- a/langtools/test/tools/javac/classfiles/attributes/AnnotationDefault/AnnotationDefaultTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/AnnotationDefault/AnnotationDefaultTest.java	Thu Mar 31 15:20:50 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
@@ -27,16 +27,13 @@
  * @summary Checking AnnotationDefault attribute.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build AnnotationDefaultTest TestBase TestResult InMemoryFileManager ToolBox AnnotationDefaultVerifier
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build AnnotationDefaultTest AnnotationDefaultVerifier
  * @run main AnnotationDefaultTest
  */
 
-import com.sun.tools.classfile.*;
-
 import java.io.File;
 import java.io.IOException;
 import java.lang.annotation.RetentionPolicy;
@@ -48,6 +45,8 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import com.sun.tools.classfile.*;
+
 public class AnnotationDefaultTest extends TestResult {
 
     private final static String templateFileName = "AnnotationDefault.java.template";
--- a/langtools/test/tools/javac/classfiles/attributes/EnclosingMethod/EnclosingMethodTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/EnclosingMethod/EnclosingMethodTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,9 @@
  * @summary Checking EnclosingMethod attribute of anonymous/local class.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build EnclosingMethodTest TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @run main EnclosingMethodTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTest.java	Thu Mar 31 15:20:50 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
@@ -30,8 +30,8 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox TestBase InMemoryFileManager LineNumberTestBase Container TestCase
+ * @build toolbox.ToolBox InMemoryFileManager TestBase
+ * @build LineNumberTestBase Container TestCase
  * @run main LineNumberTest
  */
 public class LineNumberTest extends LineNumberTestBase {
--- a/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java	Thu Mar 31 15:20:50 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
@@ -30,8 +30,8 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox LocalVariableTestBase TestBase InMemoryFileManager
+ * @build toolbox.ToolBox InMemoryFileManager TestBase
+ * @build LocalVariableTestBase
  * @compile -g LocalVariableTableTest.java
  * @run main LocalVariableTableTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -30,8 +30,7 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox LocalVariableTestBase TestBase InMemoryFileManager
+ * @build toolbox.ToolBox InMemoryFileManager TestBase LocalVariableTestBase
  * @compile -g LocalVariableTypeTableTest.java
  * @run main LocalVariableTypeTableTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/Module/ModuleFlagTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Module/ModuleFlagTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -30,8 +30,7 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask toolbox.ToolBox
  * @run main ModuleFlagTest
  */
 
@@ -43,13 +42,16 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class ModuleFlagTest {
     public static void main(String[] args) throws IOException, ConstantPoolException {
         Path outdir = Paths.get(".");
         ToolBox tb = new ToolBox();
         final Path moduleInfo = Paths.get("module-info.java");
         tb.writeFile(moduleInfo, "module test_module{}");
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(outdir)
                 .files(moduleInfo)
                 .run();
--- a/langtools/test/tools/javac/classfiles/attributes/Module/ModuleTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Module/ModuleTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,9 +29,9 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib ../lib /tools/javac/lib
- * @build ToolBox TestBase TestResult ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask toolbox.ToolBox
+ *      TestBase TestResult ModuleTestBase
  * @run main ModuleTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/Module/ModuleTestBase.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Module/ModuleTestBase.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -42,6 +42,10 @@
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class ModuleTestBase {
     protected final ToolBox tb = new ToolBox();
     private final TestResult tr = new TestResult();
@@ -124,9 +128,9 @@
     }
 
     protected void compile(Path base) throws IOException {
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .files(findJavaFiles(base))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
     }
 
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/ConstructorTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/ConstructorTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,11 +27,9 @@
  * @summary Checks Signature attribute for constructors.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @build ConstructorTest Driver ExpectedSignature ExpectedSignatureContainer
  * @run main Driver ConstructorTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/EnumTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/EnumTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,11 +27,9 @@
  * @summary Checks Signature attribute for enum.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @build EnumTest Driver ExpectedSignature ExpectedSignatureContainer
  * @run main Driver EnumTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/ExceptionTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/ExceptionTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,11 +27,9 @@
  * @summary Checks Signature attribute for methods which throw exceptions.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @build ExceptionTest Driver ExpectedSignature ExpectedSignatureContainer
  * @run main Driver ExceptionTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/FieldTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/FieldTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,11 +27,9 @@
  * @summary Checks Signature attribute for fields.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @build FieldTest Driver ExpectedSignature ExpectedSignatureContainer
  * @run main Driver FieldTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/InnerClassTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/InnerClassTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,11 +27,9 @@
  * @summary Checks Signature attribute for inner classes.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @build InnerClassTest Driver ExpectedSignature ExpectedSignatureContainer
  * @run main Driver InnerClassTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,11 +27,9 @@
  * @summary Checks Signature attribute for method parameters.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @build MethodParameterTest Driver ExpectedSignature ExpectedSignatureContainer
  * @run main Driver MethodParameterTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,11 +27,9 @@
  * @summary Checks Signature attribute for type bounds.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @build MethodTypeBoundTest Driver ExpectedSignature ExpectedSignatureContainer
  * @run main Driver MethodTypeBoundTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,11 +28,9 @@
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules java.desktop
  *          jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @build ReturnTypeTest Driver ExpectedSignature ExpectedSignatureContainer
  * @run main Driver ReturnTypeTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/AnonymousClassTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/AnonymousClassTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,9 @@
  * @bug 8040129
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager
+ * @build toolbox.ToolBox InMemoryFileManager TestBase SourceFileTestBase
  * @run main AnonymousClassTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/InnerClassTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/InnerClassTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,11 +27,9 @@
  * @bug 8040129
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager
+ * @build toolbox.ToolBox InMemoryFileManager TestBase SourceFileTestBase
  * @run main InnerClassTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/LocalClassTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/LocalClassTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,9 @@
  * @bug 8040129
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager
+ * @build toolbox.ToolBox InMemoryFileManager TestBase SourceFileTestBase
  * @run main LocalClassTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/MixTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/MixTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,11 +27,9 @@
  * @bug 8040129
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager
+ * @build toolbox.ToolBox InMemoryFileManager TestBase SourceFileTestBase
  * @run main MixTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/ModuleInfoTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/ModuleInfoTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,27 +27,29 @@
  * @bug 8080878
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager
+ * @build toolbox.ToolBox toolbox.JavacTask InMemoryFileManager TestBase SourceFileTestBase
  * @run main ModuleInfoTest
  */
 
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class ModuleInfoTest extends SourceFileTestBase {
     public static void main(String[] args) throws Exception {
         Path outdir = Paths.get(".");
         ToolBox tb = new ToolBox();
         final Path moduleInfo = Paths.get("module-info.java");
         tb.writeFile(moduleInfo, "module m1{}");
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .files(moduleInfo)
                 .outdir(outdir)
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
 
         new ModuleInfoTest().test(outdir.resolve("module-info.class"), "module-info.java");
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,11 +27,9 @@
  * @bug 8040129
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager
+ * @build toolbox.ToolBox InMemoryFileManager TestBase SourceFileTestBase
  * @compile -g:none NoSourceFileAttribute.java
  * @run main NoSourceFileAttribute
  */
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/SourceFileTestBase.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/SourceFileTestBase.java	Thu Mar 31 15:20:50 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
@@ -31,6 +31,8 @@
 import java.util.Map;
 import javax.tools.JavaFileObject;
 
+import toolbox.ToolBox;
+
 /**
  * Base class for Source file attribute tests. Checks expected file name for specified classes in the SourceFile attribute.
  * To add new tests you should extend the SourceFileTestBase class and invoke {@link #test} for static sources
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/SyntheticClassTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/SyntheticClassTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,9 @@
  * @bug 8040129
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager
+ * @build toolbox.ToolBox InMemoryFileManager TestBase SourceFileTestBase
  * @run main SyntheticClassTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/TopLevelClassesOneFileTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/TopLevelClassesOneFileTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,9 @@
  * @bug 8040129
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox SourceFileTestBase TestBase InMemoryFileManager
+ * @build toolbox.ToolBox InMemoryFileManager TestBase SourceFileTestBase
  * @run main TopLevelClassesOneFileTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,12 +27,10 @@
  * @summary Checking ACC_SYNTHETIC flag is generated for access method
  *          generated to access to private methods and fields.
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult
  * @build AccessToPrivateInnerClassMembersTest SyntheticTestDriver ExpectedClass ExpectedClasses
  * @run main SyntheticTestDriver AccessToPrivateInnerClassMembersTest 1
  */
--- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,9 +29,8 @@
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @build AccessToPrivateSiblingsTest SyntheticTestDriver ExpectedClass ExpectedClasses
  * @run main SyntheticTestDriver AccessToPrivateSiblingsTest 1
  */
--- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -26,12 +26,10 @@
  * @bug 8044537
  * @summary Checking ACC_SYNTHETIC flag is generated for assert statement.
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @build AssertFieldTest SyntheticTestDriver ExpectedClass ExpectedClasses
  * @run main SyntheticTestDriver AssertFieldTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,12 +26,10 @@
  * @bug 8044537
  * @summary Checking ACC_SYNTHETIC flag is generated for bridge method generated for generic method.
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @build BridgeMethodForGenericMethodTest SyntheticTestDriver ExpectedClass ExpectedClasses
  * @run main SyntheticTestDriver BridgeMethodForGenericMethodTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,12 +27,10 @@
  * @summary Checking ACC_SYNTHETIC flag is generated for bridge method
  *          generated for lambda expressions and method references.
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @build BridgeMethodsForLambdaTest SyntheticTestDriver ExpectedClass ExpectedClasses
  * @run main SyntheticTestDriver BridgeMethodsForLambdaTest 1
  */
--- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/EnumTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/EnumTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -26,12 +26,10 @@
  * @bug 8044537
  * @summary Checking ACC_SYNTHETIC flag is generated for enum members.
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @build EnumTest SyntheticTestDriver ExpectedClass ExpectedClasses
  * @run main SyntheticTestDriver EnumTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,12 +26,10 @@
  * @bug 8044537
  * @summary Checking ACC_SYNTHETIC flag is generated for package-info.
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @build SyntheticTestDriver ExpectedClass ExpectedClasses
  * @compile -Xpkginfo:always package_info_test/package-info.java
  * @run main SyntheticTestDriver package_info_test.package-info 1
--- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,9 +28,8 @@
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @build ThisFieldTest SyntheticTestDriver ExpectedClass ExpectedClasses
  * @run main SyntheticTestDriver ThisFieldTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForGenericMethodTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForGenericMethodTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,10 +29,9 @@
  * @modules jdk.jdeps/com.sun.tools.classfile
  *          jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
- * @build TestCase ClassType TestAnnotationInfo
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build WorkAnnotations TestCase ClassType TestAnnotationInfo
  * @build RuntimeAnnotationsForGenericMethodTest AnnotationsTestBase RuntimeAnnotationsTestBase
  * @run main RuntimeAnnotationsForGenericMethodTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerAnnotationTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerAnnotationTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,10 +28,9 @@
  * @modules jdk.jdeps/com.sun.tools.classfile
  *          jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
- * @build TestCase ClassType TestAnnotationInfo
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build WorkAnnotations TestCase ClassType TestAnnotationInfo
  * @build RuntimeAnnotationsForInnerAnnotationTest AnnotationsTestBase RuntimeAnnotationsTestBase
  * @run main RuntimeAnnotationsForInnerAnnotationTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerClassTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerClassTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,10 +28,9 @@
  * @modules jdk.jdeps/com.sun.tools.classfile
  *          jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
- * @build TestCase ClassType TestAnnotationInfo
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build WorkAnnotations TestCase ClassType TestAnnotationInfo
  * @build RuntimeAnnotationsForInnerClassTest AnnotationsTestBase RuntimeAnnotationsTestBase
  * @run main RuntimeAnnotationsForInnerClassTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerEnumTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerEnumTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,10 +28,9 @@
  * @modules jdk.jdeps/com.sun.tools.classfile
  *          jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
- * @build TestCase ClassType TestAnnotationInfo
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build WorkAnnotations TestCase ClassType TestAnnotationInfo
  * @build RuntimeAnnotationsForInnerEnumTest AnnotationsTestBase RuntimeAnnotationsTestBase
  * @run main RuntimeAnnotationsForInnerEnumTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerInterfaceTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerInterfaceTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,10 +28,9 @@
  * @modules jdk.jdeps/com.sun.tools.classfile
  *          jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
- * @build TestCase ClassType TestAnnotationInfo
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build WorkAnnotations TestCase ClassType TestAnnotationInfo
  * @build RuntimeAnnotationsForInnerInterfaceTest AnnotationsTestBase RuntimeAnnotationsTestBase
  * @run main RuntimeAnnotationsForInnerInterfaceTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForTopLevelClassTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForTopLevelClassTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,10 +28,9 @@
  * @modules jdk.jdeps/com.sun.tools.classfile
  *          jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
- * @build TestCase ClassType TestAnnotationInfo
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build WorkAnnotations TestCase ClassType TestAnnotationInfo
  * @build RuntimeAnnotationsForTopLevelClassTest AnnotationsTestBase RuntimeAnnotationsTestBase
  * @run main RuntimeAnnotationsForTopLevelClassTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForGenericMethodTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForGenericMethodTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,10 +29,9 @@
  * @modules jdk.jdeps/com.sun.tools.classfile
  *          jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
- * @build TestCase ClassType TestAnnotationInfo
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build WorkAnnotations TestCase ClassType TestAnnotationInfo
  * @build RuntimeParameterAnnotationsForGenericMethodTest AnnotationsTestBase RuntimeParameterAnnotationsTestBase
  * @run main RuntimeParameterAnnotationsForGenericMethodTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForLambdaTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForLambdaTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,10 +28,9 @@
  * @modules jdk.jdeps/com.sun.tools.classfile
  *          jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
- * @build TestCase ClassType TestAnnotationInfo
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build WorkAnnotations TestCase ClassType TestAnnotationInfo
  * @build RuntimeParameterAnnotationsForLambdaTest AnnotationsTestBase RuntimeParameterAnnotationsTestBase
  * @run main RuntimeParameterAnnotationsForLambdaTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,10 +28,9 @@
  * @modules jdk.jdeps/com.sun.tools.classfile
  *          jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib /tools/javac/lib ../lib
- * @build WorkAnnotations TestBase TestResult InMemoryFileManager ToolBox
- * @build TestCase ClassType TestAnnotationInfo
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build WorkAnnotations TestCase ClassType TestAnnotationInfo
  * @build RuntimeParameterAnnotationsTest AnnotationsTestBase RuntimeParameterAnnotationsTestBase
  * @run main RuntimeParameterAnnotationsTest
  */
--- a/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedPackageTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedPackageTest.java	Thu Mar 31 15:20:50 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
@@ -30,8 +30,7 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build  ToolBox TestBase TestResult InMemoryFileManager
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @run main DeprecatedPackageTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedTest.java	Thu Mar 31 15:20:50 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
@@ -31,8 +31,7 @@
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.util
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox TestBase TestResult InMemoryFileManager
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @run main DeprecatedTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerAnnotationTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerAnnotationTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,10 @@
  * @summary Testing InnerClasses_attribute of inner annotations in inner annotation.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesInInnerClassTestBase InnerClassesTestBase
  * @run main InnerAnnotationsInInnerAnnotationTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerClassTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerClassTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,10 @@
  * @summary Testing InnerClasses_attribute of inner annotations in inner class.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesInInnerClassTestBase InnerClassesTestBase
  * @run main InnerAnnotationsInInnerClassTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerEnumTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerEnumTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,10 @@
  * @summary Testing InnerClasses_attribute of inner annotations in inner enum.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesInInnerClassTestBase InnerClassesTestBase
  * @run main InnerAnnotationsInInnerEnumTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerInterfaceTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerInterfaceTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,10 @@
  * @summary Testing InnerClasses_attribute of inner annotations in inner interface.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesInInnerClassTestBase InnerClassesTestBase
  * @run main InnerAnnotationsInInnerInterfaceTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java	Thu Mar 31 15:20:50 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
@@ -27,17 +27,12 @@
  * @summary Test that inner classes have in its inner classes attribute enclosing classes and its immediate members.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build TestResult TestBase InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @run main InnerClassesHierarchyTest
  */
 
-import com.sun.tools.classfile.*;
-import com.sun.tools.classfile.InnerClasses_attribute.Info;
-
 import java.io.File;
 import java.io.FilenameFilter;
 import java.io.IOException;
@@ -45,6 +40,9 @@
 import java.util.*;
 import java.util.stream.Collectors;
 
+import com.sun.tools.classfile.*;
+import com.sun.tools.classfile.InnerClasses_attribute.Info;
+
 public class InnerClassesHierarchyTest extends TestResult {
 
     private final Map<String, Set<String>> innerClasses;
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,10 @@
  * @summary Testing InnerClasses_attribute of inner classes in anonymous class.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesTestBase TestResult TestBase InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesTestBase
  * @run main InnerClassesInAnonymousClassTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerAnnotationTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerAnnotationTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,10 @@
  * @summary Testing InnerClasses_attribute of inner classes in inner annotation.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestResult TestBase InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesInInnerClassTestBase InnerClassesTestBase
  * @run main InnerClassesInInnerAnnotationTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerClassTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerClassTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,10 @@
  * @summary Testing InnerClasses_attribute of inner classes in inner class.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestResult TestBase InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesInInnerClassTestBase InnerClassesTestBase
  * @run main InnerClassesInInnerClassTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerEnumTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerEnumTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,10 @@
  * @summary Testing InnerClasses_attribute of inner classes in inner enum.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestResult TestBase InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesInInnerClassTestBase InnerClassesTestBase
  * @run main InnerClassesInInnerEnumTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerInterfaceTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerInterfaceTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,10 @@
  * @summary Testing InnerClasses_attribute of inner classes in inner interface.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestResult TestBase InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesInInnerClassTestBase InnerClassesTestBase
  * @run main InnerClassesInInnerInterfaceTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInLocalClassTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInLocalClassTest.java	Thu Mar 31 15:20:50 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
@@ -28,10 +28,9 @@
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.jdeps/com.sun.tools.classfile
  *          jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesTestBase TestResult TestBase InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesTestBase
  * @run main InnerClassesInLocalClassTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,9 @@
  * @summary Test that outer_class_info_index of local and anonymous class is zero.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
  * @run main InnerClassesIndexTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,10 @@
  * @summary Testing inner classes attributes.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesTestBase
  * @run main InnerClassesTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerAnnotationTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerAnnotationTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,11 +27,10 @@
  * @summary Testing InnerClasses_attribute of inner enums in inner annotation.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesInInnerClassTestBase InnerClassesTestBase
  * @run main InnerEnumInInnerAnnotationTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerEnumTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerEnumTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,10 @@
  * @summary Testing InnerClasses_attribute of inner enums in inner enum.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesInInnerClassTestBase InnerClassesTestBase
  * @run main InnerEnumInInnerEnumTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerInterfaceTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerInterfaceTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,10 @@
  * @summary Testing InnerClasses_attribute of inner enums in inner interface.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesInInnerClassTestBase InnerClassesTestBase
  * @run main InnerEnumInInnerInterfaceTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumsInInnerClassTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumsInInnerClassTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,11 +27,10 @@
  * @summary Testing InnerClasses_attribute of inner enums in inner class.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesInInnerClassTestBase InnerClassesTestBase
  * @run main InnerEnumsInInnerClassTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerAnnotationTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerAnnotationTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,10 @@
  * @summary Testing InnerClasses_attribute of inner interfaces in inner annotation.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesInInnerClassTestBase InnerClassesTestBase
  * @run main InnerInterfacesInInnerAnnotationTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerClassTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerClassTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,11 +27,10 @@
  * @author aeremeev
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesInInnerClassTestBase InnerClassesTestBase
  * @run main InnerInterfacesInInnerClassTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerEnumTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerEnumTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,10 @@
  * @summary Testing InnerClasses_attribute of inner interfaces in inner enum.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesInInnerClassTestBase InnerClassesTestBase
  * @run main InnerInterfacesInInnerEnumTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerInterfaceTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerInterfaceTest.java	Thu Mar 31 15:20:50 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
@@ -27,11 +27,10 @@
  * @summary Testing InnerClasses_attribute of inner interfaces in inner interface.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build InnerClassesInInnerClassTestBase InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase
+ * @build InnerClassesInInnerClassTestBase InnerClassesTestBase
  * @run main InnerInterfacesInInnerInterfaceTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/NoInnerClassesTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/NoInnerClassesTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,11 +27,9 @@
  * @summary Test that there are no inner classes attributes in case of there are no inner classes.
  * @library /tools/lib /tools/javac/lib ../lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.classfile
- *          jdk.jdeps/com.sun.tools.javap
- * @build TestBase InMemoryFileManager ToolBox
+ * @build toolbox.ToolBox InMemoryFileManager TestBase
  * @run main NoInnerClassesTest
  */
 
--- a/langtools/test/tools/javac/classfiles/attributes/lib/TestBase.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/lib/TestBase.java	Thu Mar 31 15:20:50 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
@@ -36,6 +36,9 @@
 import com.sun.tools.classfile.ClassFile;
 import com.sun.tools.classfile.ConstantPoolException;
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 /**
  * Base class for class file attribute tests.
  * Contains methods for compiling generated sources in memory,
--- a/langtools/test/tools/javac/completionDeps/DepsAndAnno.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/completionDeps/DepsAndAnno.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,18 @@
  * @summary Make sure -XDcompletionDeps does not cause an infinite loop.
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main/othervm/timeout=10 DepsAndAnno
  */
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Target;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class DepsAndAnno {
 
     @Target(ElementType.METHOD)
@@ -44,7 +46,7 @@
 
     public static void main(String[] args) {
         ToolBox toolBox = new ToolBox();
-        toolBox.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(toolBox, Task.Mode.CMDLINE)
                .options("-XDcompletionDeps")
                .outdir(".")
                .files(ToolBox.testSrc + "/DepsAndAnno.java")
--- a/langtools/test/tools/javac/defaultMethods/AssertionsTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/defaultMethods/AssertionsTest.java	Thu Mar 31 15:20:50 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
@@ -28,10 +28,8 @@
  *          is not generated into an interface
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox Assertions AssertionsTest
+ * @build toolbox.ToolBox toolbox.JavaTask Assertions AssertionsTest
  * @run main AssertionsTest -da
  * @run main AssertionsTest -ea:test.Assertions Inner
  * @run main AssertionsTest -ea:test.Outer Outer
@@ -41,17 +39,21 @@
 
 import java.util.Arrays;
 
+import toolbox.JavaTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class AssertionsTest {
 
     public static void main(String... args) throws Exception {
         String testClasses = System.getProperty("test.classes");
         ToolBox tb = new ToolBox();
-        tb.new JavaTask().classpath(testClasses)
+        new JavaTask(tb).classpath(testClasses)
                          .vmOptions(args[0])
                          .className("test.Assertions")
                          .classArgs(Arrays.copyOfRange(args, 1, args.length))
                          .includeStandardOptions(false)
-                         .run(ToolBox.Expect.SUCCESS)
+                         .run(Task.Expect.SUCCESS)
                          .writeAll();
     }
 
--- a/langtools/test/tools/javac/defaultMethodsVisibility/DefaultMethodsNotVisibleForSourceLessThan8Test.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/defaultMethodsVisibility/DefaultMethodsNotVisibleForSourceLessThan8Test.java	Thu Mar 31 15:20:50 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
@@ -28,16 +28,18 @@
  * Default methods should be visible under source previous to 8
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main DefaultMethodsNotVisibleForSourceLessThan8Test
  */
 
 import java.nio.file.Files;
 import java.nio.file.Paths;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class DefaultMethodsNotVisibleForSourceLessThan8Test {
     // common definitions
 
@@ -132,19 +134,19 @@
         /* as an extra check let's make sure that interface 'I' can't be compiled
          * with source < 8
          */
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(outDir)
                 .options("-source", source)
                 .sources(ISrc)
-                .run(ToolBox.Expect.FAIL);
+                .run(Task.Expect.FAIL);
 
         //but it should compile with source >= 8
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(outDir)
                 .sources(ISrc)
                 .run();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(outDir)
                 .classpath(outDir)
                 .options("-source", source)
@@ -154,7 +156,7 @@
 
     void testLegacyImplementations() throws Exception {
         //compile C1-4
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(outDir)
                 .classpath(outDir)
                 .options("-source", source)
@@ -164,7 +166,7 @@
 
     void testLegacyInvocations() throws Exception {
         //compile LegacyInvocation
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(outDir)
                 .classpath(outDir)
                 .options("-source", source)
@@ -174,7 +176,7 @@
 
     void testSuperInvocations() throws Exception {
         //compile SubA, SubB
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(outDir)
                 .classpath(outDir)
                 .options("-source", source)
--- a/langtools/test/tools/javac/fatalErrors/NoJavaLangTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/fatalErrors/NoJavaLangTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -24,18 +24,20 @@
 /*
  * @test
  * @bug 4263768 4785453
- * @summary Verify that the compiler does not crash when java.lang is not
+ * @summary Verify that the compiler does not crash when java.lang is not available
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main NoJavaLangTest
  */
 
 import java.nio.file.*;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class NoJavaLangTest {
 
     private static final String noJavaLangSrc =
@@ -64,7 +66,7 @@
 
     // sanity check, with java.lang available
     void testStandard() {
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .sources(noJavaLangSrc)
                 .run();
     }
@@ -80,7 +82,7 @@
     void testModulePath() throws Exception {
         // need to ensure there is an empty java.base to avoid different error message
         Files.createDirectories(Paths.get("modules/java.base"));
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .sources("module java.base { }")
                 .outdir("modules/java.base")
                 .run();
@@ -93,12 +95,12 @@
     private void test(String[] options, String expect) {
         System.err.println("Testing " + java.util.Arrays.toString(options));
 
-        String out = tb.new JavacTask()
+        String out = new JavacTask(tb)
                 .options(options)
                 .sources(noJavaLangSrc)
-                .run(ToolBox.Expect.FAIL, 3)
+                .run(Task.Expect.FAIL, 3)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!out.trim().equals(expect)) {
             throw new AssertionError("javac generated error output is not correct");
--- a/langtools/test/tools/javac/file/ExplodedImage.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/file/ExplodedImage.java	Thu Mar 31 15:20:50 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
@@ -21,8 +21,21 @@
  * questions.
  */
 
-import com.sun.source.util.JavacTask;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
+/**
+ * @test
+ * @bug 8067138
+ * @summary Verify that compiling against the exploded JDK image works, and that Locations close
+ *          the directory streams properly when working with exploded JDK image.
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.code
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.jdeps/com.sun.tools.javap
+ * @build toolbox.ToolBox ExplodedImage
+ * @run main/othervm ExplodedImage modules/* testDirectoryStreamClosed
+ * @run main/othervm ExplodedImage modules/* testCanCompileAgainstExplodedImage
+ */
+
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -43,21 +56,10 @@
 import javax.tools.StandardLocation;
 import javax.tools.ToolProvider;
 
-/**
- * @test
- * @bug 8067138
- * @summary Verify that compiling against the exploded JDK image works, and that Locations close
- *          the directory streams properly when working with exploded JDK image.
- * @library /tools/lib
- * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.code
- *          jdk.compiler/com.sun.tools.javac.file
- *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ExplodedImage
- * @run main/othervm ExplodedImage modules/* testDirectoryStreamClosed
- * @run main/othervm ExplodedImage modules/* testCanCompileAgainstExplodedImage
- */
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+
+import toolbox.ToolBox;
 
 public class ExplodedImage {
     public static void main(String... args) throws IOException {
--- a/langtools/test/tools/javac/importscope/CompletionFailureDuringImport.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/importscope/CompletionFailureDuringImport.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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 @@
  * @summary Verify that CompletionFailure thrown during listing of import content is handled properly.
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
+ * @build toolbox.ToolBox toolbox.JavacTask
+ * @run main CompletionFailureDuringImport
  */
 
 import java.nio.file.Files;
@@ -37,6 +37,10 @@
 import java.util.Arrays;
 import java.util.List;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class CompletionFailureDuringImport {
     public static void main(String... args) throws Exception {
         new CompletionFailureDuringImport().run();
@@ -45,7 +49,7 @@
     ToolBox tb = new ToolBox();
 
     void run() throws Exception {
-        tb.new JavacTask()
+        new JavacTask(tb)
           .outdir(".")
           .sources("package p; public class Super { public static final int I = 0; }",
                    "package p; public class Sub extends Super { }")
@@ -75,13 +79,13 @@
     }
 
     void doTest(String importText, String useText, String... expectedOutput) {
-        List<String> log = tb.new JavacTask()
+        List<String> log = new JavacTask(tb)
                 .classpath(".")
                 .sources(importText + " public class Test { " + useText + " }")
                 .options("-XDrawDiagnostics")
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         if (!log.equals(Arrays.asList(expectedOutput))) {
             throw new AssertionError("Unexpected output: " + log);
--- a/langtools/test/tools/javac/importscope/ImportDependenciesTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/importscope/ImportDependenciesTest.java	Thu Mar 31 15:20:50 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
@@ -27,10 +27,8 @@
  * @summary The test checks dependencies through type parameters and implements/extends statements.
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ImportDependenciesTest
+ * @build toolbox.ToolBox ImportDependenciesTest
  * @run main ImportDependenciesTest
  */
 
@@ -43,6 +41,8 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import toolbox.ToolBox;
+
 /**
  * The test checks that code which contains dependencies through type parameters,
  * implements/extends statements compiles properly. All combinations of
--- a/langtools/test/tools/javac/importscope/ImportMembersTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/importscope/ImportMembersTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,10 +27,9 @@
  * @summary The test checks possibility of class members to be imported.
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ImportMembersTest
+ * @build toolbox.ToolBox ImportMembersTest
  * @run main ImportMembersTest
  */
 
@@ -41,6 +40,8 @@
 import java.util.Arrays;
 import java.util.List;
 
+import toolbox.ToolBox;
+
 /**
  * The test checks that members of a class, an enum, an interface or annotation
  * can be imported with help of a static import or an import statement.
--- a/langtools/test/tools/javac/importscope/NegativeCyclicDependencyTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/importscope/NegativeCyclicDependencyTest.java	Thu Mar 31 15:20:50 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
@@ -27,10 +27,8 @@
  * @summary The negative test against cyclic dependencies.
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox NegativeCyclicDependencyTest
+ * @build toolbox.ToolBox NegativeCyclicDependencyTest
  * @run main NegativeCyclicDependencyTest
  */
 
@@ -41,6 +39,8 @@
 import java.util.Arrays;
 import java.util.List;
 
+import toolbox.ToolBox;
+
 /**
  * The test generates the following code:
  *
--- a/langtools/test/tools/javac/innerClassFile/InnerClassFileTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/innerClassFile/InnerClassFileTest.java	Thu Mar 31 15:20:50 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,16 +27,17 @@
  * @summary Prob w/static inner class with same name as a regular class
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main InnerClassFileTest
  */
 
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 // Original test: test/tools/javac/innerClassFile/Driver.sh
 public class InnerClassFileTest {
 
@@ -108,7 +109,7 @@
     }
 
     void compileFiles() throws Exception {
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(".")
                 .classpath(".")
                 .sourcepath("src")
@@ -118,7 +119,7 @@
 
         tb.deleteFiles("y/R3.class");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(".")
                 .classpath(".")
                 .sourcepath("src")
--- a/langtools/test/tools/javac/javazip/JavaZipTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/javazip/JavaZipTest.java	Thu Mar 31 15:20:50 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,10 +27,8 @@
  * @summary check that source files inside zip files on the class path are ignored
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  * @run main JavaZipTest
  */
 
@@ -38,6 +36,11 @@
 import java.nio.file.Paths;
 import java.util.Arrays;
 
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 // Original test: test/tools/javac/javazip/Test.sh
 public class JavaZipTest {
 
@@ -84,8 +87,8 @@
     public void test() throws Exception {
         createOutputDirAndSourceFiles();
         createZipsAndJars();
-        check(ToolBox.Expect.SUCCESS, successfulCompilationArgs);
-        check(ToolBox.Expect.FAIL, unsuccessfulCompilationArgs);
+        check(Task.Expect.SUCCESS, successfulCompilationArgs);
+        check(Task.Expect.FAIL, unsuccessfulCompilationArgs);
     }
 
     void createOutputDirAndSourceFiles() throws Exception {
@@ -101,15 +104,15 @@
     void createZipsAndJars() throws Exception {
         //jar and zip creation
         for (String[] args: jarArgs) {
-            tb.new JarTask().run(args).writeAll();
+            new JarTask(tb).run(args).writeAll();
         }
     }
 
-    void check(ToolBox.Expect expectedStatus, String[][] theArgs) throws Exception {
+    void check(Task.Expect expectedStatus, String[][] theArgs) throws Exception {
 
 
         for (String[] allArgs: theArgs) {
-            tb.new JavacTask()
+            new JavacTask(tb)
                     .options(opts(allArgs))
                     .files(files(allArgs))
                     .run(expectedStatus)
--- a/langtools/test/tools/javac/lambda/T8129740/SourceToSourceTranslationTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/lambda/T8129740/SourceToSourceTranslationTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,10 +27,9 @@
  * @summary Incorrect class file created when passing lambda in inner class constructor
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox
  * @run compile -XD-printsource SourceForTranslation.java
  * @run main SourceToSourceTranslationTest
  */
@@ -39,6 +38,8 @@
 import java.nio.file.Paths;
 import java.util.List;
 
+import toolbox.ToolBox;
+
 public class SourceToSourceTranslationTest {
 
     public static void main(String[] args) throws Exception {
--- a/langtools/test/tools/javac/lambda/lambdaNaming/TestNonSerializableLambdaNameStability.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/lambda/lambdaNaming/TestNonSerializableLambdaNameStability.java	Thu Mar 31 15:20:50 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
@@ -28,21 +28,24 @@
  * @library /tools/lib
  * @modules jdk.jdeps/com.sun.tools.classfile
  *          jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main TestNonSerializableLambdaNameStability
  */
 
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.Method;
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
 import javax.tools.StandardLocation;
 
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.Method;
+
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class TestNonSerializableLambdaNameStability {
 
     public static void main(String... args) throws Exception {
@@ -71,12 +74,12 @@
         ToolBox tb = new ToolBox();
 
         try (ToolBox.MemoryFileManager fm = new ToolBox.MemoryFileManager()) {
-            tb.new JavacTask()
+            new JavacTask(tb)
               .sources(sources.toArray(new String[sources.size()]))
               .fileManager(fm)
               .run();
 
-            for (String file : fm.files.get(StandardLocation.CLASS_OUTPUT).keySet()) {
+            for (String file : fm.getFileNames(StandardLocation.CLASS_OUTPUT)) {
                 byte[] fileBytes = fm.getFileBytes(StandardLocation.CLASS_OUTPUT, file);
                 try (InputStream in = new ByteArrayInputStream(fileBytes)) {
                     boolean foundLambdaMethod = false;
--- a/langtools/test/tools/javac/lambda/lambdaNaming/TestSerializedLambdaNameStability.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/lambda/lambdaNaming/TestSerializedLambdaNameStability.java	Thu Mar 31 15:20:50 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,10 +27,9 @@
  * @summary Desugar serializable lambda bodies using more robust naming scheme
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main TestSerializedLambdaNameStability
  */
 
@@ -40,6 +39,9 @@
 import java.lang.reflect.Method;
 import java.nio.file.*;
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 public class TestSerializedLambdaNameStability {
 
     final ClassLoader writingClassLoader;
@@ -159,7 +161,7 @@
             else
                 throw new Exception("Did not expect to load " + name);
             Path srcFile = Paths.get(sourceBaseDir, context, srcName + ".java");
-            tb.new JavacTask()
+            new JavacTask(tb)
                     .outdir(compiledDir)
                     .files(srcFile)
                     .run();
--- a/langtools/test/tools/javac/links/LinksTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/links/LinksTest.java	Thu Mar 31 15:20:50 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,10 +27,8 @@
  * @summary javac no longer follows symlinks
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main LinksTest
  */
 
@@ -38,6 +36,9 @@
 import java.nio.file.Files;
 import java.nio.file.Paths;
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 // Original test: test/tools/javac/links/links.sh
 public class LinksTest {
 
@@ -65,7 +66,7 @@
 
         // If symbolic link was successfully created,
         // try a compilation that will use it.
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .sourcepath(".")
                 .outdir(".")
                 .sources(TSrc)
--- a/langtools/test/tools/javac/modules/AbstractOrInnerClassServiceImplTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/AbstractOrInnerClassServiceImplTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,13 +29,17 @@
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
  *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main AbstractOrInnerClassServiceImplTest
  */
 
 import java.nio.file.Files;
 import java.nio.file.Path;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class AbstractOrInnerClassServiceImplTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
         AbstractOrInnerClassServiceImplTest t = new AbstractOrInnerClassServiceImplTest();
@@ -52,13 +56,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
         if (!log.contains("module-info.java:1:39: compiler.err.service.implementation.is.abstract: p2.Impl"))
             throw new Exception("expected output not found");
     }
@@ -73,13 +77,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
         if (!log.contains("module-info.java:1:45: compiler.err.service.implementation.is.inner: p2.Outer.Inner"))
             throw new Exception("expected output not found");
     }
@@ -94,13 +98,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
         if (!log.contains("module-info.java:1:45: compiler.err.service.implementation.is.abstract: p2.Outer.Inner"))
             throw new Exception("expected output not found");
     }
--- a/langtools/test/tools/javac/modules/AddLimitMods.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/AddLimitMods.java	Thu Mar 31 15:20:50 2016 -0700
@@ -33,7 +33,7 @@
  *      jdk.compiler/com.sun.tools.javac.processing
  *      jdk.compiler/com.sun.tools.javac.util
  *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask toolbox.JavaTask ModuleTestBase
  * @run main AddLimitMods
  */
 
@@ -65,6 +65,12 @@
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
 import com.sun.tools.javac.util.Context;
 
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.JavaTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class AddLimitMods extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -96,14 +102,14 @@
 
         Files.createDirectories(modulePath);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulesourcepath", moduleSrc.toString())
                 .outdir(modulePath)
                 .files(findJavaFiles(m3))
                 .run()
                 .writeAll();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulesourcepath", moduleSrc.toString())
                 .outdir(modulePath)
                 .files(findJavaFiles(m2))
@@ -111,26 +117,26 @@
                 .writeAll();
 
         //real test
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulepath", modulePath.toString(),
                          "-XDshouldStopPolicyIfNoError=FLOW",
                          "-limitmods", "java.base")
                 .outdir(modulePath)
                 .files(findJavaFiles(m1))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulepath", modulePath.toString(),
                          "-XDshouldStopPolicyIfNoError=FLOW",
                          "-limitmods", "java.base",
                          "-addmods", "m2")
                 .outdir(modulePath)
                 .files(findJavaFiles(m1))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulepath", modulePath.toString(),
                          "-XDshouldStopPolicyIfNoError=FLOW",
                          "-limitmods", "java.base",
@@ -140,7 +146,7 @@
                 .run()
                 .writeAll();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulepath", modulePath.toString(),
                          "-XDshouldStopPolicyIfNoError=FLOW",
                          "-limitmods", "m2")
@@ -149,16 +155,16 @@
                 .run()
                 .writeAll();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulepath", modulePath.toString(),
                          "-XDshouldStopPolicyIfNoError=FLOW",
                          "-limitmods", "m3")
                 .outdir(modulePath)
                 .files(findJavaFiles(m1))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulepath", modulePath.toString(),
                          "-XDshouldStopPolicyIfNoError=FLOW",
                          "-limitmods", "m3",
@@ -185,7 +191,7 @@
 
         Files.createDirectories(modulePath);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulesourcepath", moduleSrc.toString())
                 .outdir(modulePath)
                 .files(findJavaFiles(moduleSrc))
@@ -199,14 +205,14 @@
 
         Files.createDirectories(cpOut);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulepath", modulePath.toString())
                 .outdir(cpOut)
                 .files(findJavaFiles(cpSrc))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulepath", modulePath.toString(),
                          "-addmods", "ALL-MODULE-PATH")
                 .outdir(cpOut)
@@ -219,43 +225,43 @@
                 "- compiler.err.addmods.all.module.path.invalid",
                 "1 error");
 
-        actual = tb.new JavacTask()
+        actual = new JavacTask(tb)
                    .options("-modulesourcepath", moduleSrc.toString(),
                             "-XDrawDiagnostics",
                             "-addmods", "ALL-MODULE-PATH")
                    .outdir(modulePath)
                    .files(findJavaFiles(moduleSrc))
-                   .run(ToolBox.Expect.FAIL)
+                   .run(Task.Expect.FAIL)
                    .writeAll()
-                   .getOutputLines(ToolBox.OutputKind.DIRECT);
+                   .getOutputLines(Task.OutputKind.DIRECT);
 
         if (!Objects.equals(actual, expected)) {
             throw new IllegalStateException("incorrect errors; actual=" + actual + "; expected=" + expected);
         }
 
-        actual = tb.new JavacTask()
+        actual = new JavacTask(tb)
                    .options("-Xmodule:java.base",
                             "-XDrawDiagnostics",
                             "-addmods", "ALL-MODULE-PATH")
                    .outdir(cpOut)
                    .files(findJavaFiles(cpSrc))
-                   .run(ToolBox.Expect.FAIL)
+                   .run(Task.Expect.FAIL)
                    .writeAll()
-                   .getOutputLines(ToolBox.OutputKind.DIRECT);
+                   .getOutputLines(Task.OutputKind.DIRECT);
 
         if (!Objects.equals(actual, expected)) {
             throw new IllegalStateException("incorrect errors; actual=" + actual + "; expected=" + expected);
         }
 
-        actual = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        actual = new JavacTask(tb, Task.Mode.CMDLINE)
                    .options("-source", "8", "-target", "8",
                             "-XDrawDiagnostics",
                             "-addmods", "ALL-MODULE-PATH")
                    .outdir(cpOut)
                    .files(findJavaFiles(cpSrc))
-                   .run(ToolBox.Expect.FAIL)
+                   .run(Task.Expect.FAIL)
                    .writeAll()
-                   .getOutputLines(ToolBox.OutputKind.DIRECT);
+                   .getOutputLines(Task.OutputKind.DIRECT);
 
         if (!actual.contains("javac: option -addmods not allowed with target 1.8")) {
             throw new IllegalStateException("incorrect errors; actual=" + actual);
@@ -263,14 +269,14 @@
 
         tb.writeJavaFiles(cpSrc, "module m1 {}");
 
-        actual = tb.new JavacTask()
+        actual = new JavacTask(tb)
                    .options("-XDrawDiagnostics",
                             "-addmods", "ALL-MODULE-PATH")
                    .outdir(cpOut)
                    .files(findJavaFiles(cpSrc))
-                   .run(ToolBox.Expect.FAIL)
+                   .run(Task.Expect.FAIL)
                    .writeAll()
-                   .getOutputLines(ToolBox.OutputKind.DIRECT);
+                   .getOutputLines(Task.OutputKind.DIRECT);
 
         if (!Objects.equals(actual, expected)) {
             throw new IllegalStateException("incorrect errors; actual=" + actual + "; expected=" + expected);
@@ -287,12 +293,12 @@
 
         Files.createDirectories(classpathOut);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(classpathOut)
                 .files(findJavaFiles(classpathSrc))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         Path automaticSrc = base.resolve("automatic-src");
         Path automaticOut = base.resolve("automatic-out");
@@ -302,12 +308,12 @@
 
         Files.createDirectories(automaticOut);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(automaticOut)
                 .files(findJavaFiles(automaticSrc))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         Path modulePath = base.resolve("module-path");
 
@@ -315,7 +321,7 @@
 
         Path automaticJar = modulePath.resolve("automatic.jar");
 
-        tb.new JarTask(automaticJar)
+        new JarTask(tb, automaticJar)
           .baseDir(automaticOut)
           .files("automatic/Automatic.class")
           .run();
@@ -327,13 +333,13 @@
                           "module m1 { exports api; }",
                           "package api; public class Api { public void test() { } }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulesourcepath", moduleSrc.toString())
                 .outdir(modulePath)
                 .files(findJavaFiles(moduleSrc))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         int index = 0;
 
@@ -369,7 +375,7 @@
 
                 tb.writeJavaFiles(m2Runtime, moduleInfo, testClassNamed.toString());
 
-                tb.new JavacTask()
+                new JavacTask(tb)
                    .options("-modulepath", modulePath.toString())
                    .outdir(out)
                    .files(findJavaFiles(m2Runtime))
@@ -380,7 +386,7 @@
                 String output;
 
                 try {
-                    output = tb.new JavaTask()
+                    output = new JavaTask(tb)
                        .vmOptions(augmentOptions(options,
                                                  Collections.emptyList(),
                                                  "-modulepath", modulePath.toString() + File.pathSeparator + out.getParent().toString(),
@@ -389,10 +395,10 @@
                                                  "-m", "m2/test.Test"))
                        .run()
                        .writeAll()
-                       .getOutput(ToolBox.OutputKind.STDERR);
+                       .getOutput(Task.OutputKind.STDERR);
 
                     success = true;
-                } catch (ToolBox.TaskError err) {
+                } catch (Task.TaskError err) {
                     success = false;
                     output = "";
                 }
@@ -410,7 +416,7 @@
                     "-Aoutput=" + output,
                     "-XDaccessInternalAPI=true"
                 ) : Collections.emptyList();
-                tb.new JavacTask()
+                new JavacTask(tb)
                    .options(augmentOptions(options,
                                            auxOptions,
                                            "-modulepath", modulePath.toString(),
@@ -418,7 +424,7 @@
                                            "-XDshouldStopPolicyIfNoError=FLOW"))
                    .outdir(modulePath)
                    .files(findJavaFiles(m2))
-                   .run(success ? ToolBox.Expect.SUCCESS : ToolBox.Expect.FAIL)
+                   .run(success ? Task.Expect.SUCCESS : Task.Expect.FAIL)
                    .writeAll();
             }
         }
--- a/langtools/test/tools/javac/modules/AddReadsTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/AddReadsTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,7 +28,7 @@
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask toolbox.JavapTask ModuleTestBase
  * @run main AddReadsTest
  */
 
@@ -45,6 +45,12 @@
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.util.ElementFilter;
 
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.JavapTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class AddReadsTest extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -65,20 +71,20 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
                          "-modulesourcepath", src.toString())
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("Test.java:1:44: compiler.err.not.def.access.package.cant.access: api.Api, api"))
             throw new Exception("expected output not found");
 
         //test add dependencies:
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-XaddReads:m2=m1",
                          "-modulesourcepath", src.toString(),
                          "-processor", VerifyRequires.class.getName())
@@ -87,17 +93,17 @@
                 .run()
                 .writeAll();
 
-        String decompiled = tb.new JavapTask()
+        String decompiled = new JavapTask(tb)
                 .options("-verbose", classes.resolve("m2").resolve("module-info.class").toString())
                 .run()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (decompiled.contains("m1")) {
             throw new Exception("Incorrectly refers to m1 module.");
         }
 
         //cyclic dependencies OK when created through addReads:
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-XaddReads:m2=m1,m1=m2",
                          "-modulesourcepath", src.toString())
                 .outdir(classes)
@@ -108,7 +114,7 @@
         tb.writeJavaFiles(src_m2,
                           "module m2 { requires m1; }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-XaddReads:m1=m2",
                          "-modulesourcepath", src.toString())
                 .outdir(classes)
@@ -158,7 +164,7 @@
                           "module m1 { }",
                           "package impl; public class Impl { api.Api api; }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
           .options("-classpath", jar.toString(),
                    "-XaddReads:m1=ALL-UNNAMED",
                    "-XDrawDiagnostics")
@@ -184,7 +190,7 @@
                           "package api; public class Api { public static void test() { } }",
                           "package impl; public class Impl { { api.Api.test(); } }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
           .options("-classpath", jar.toString(),
                    "-modulesourcepath", moduleSrc.toString(),
                    "-XaddReads:m1=ALL-UNNAMED",
@@ -206,7 +212,7 @@
         tb.writeJavaFiles(src,
                           "package impl; public class Impl { api.Api a; }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
           .options("-classpath", jar.toString(),
                    "-XaddReads:java.base=ALL-UNNAMED",
                    "-Xmodule:java.base")
@@ -226,7 +232,7 @@
         tb.writeJavaFiles(src,
                           "package impl; public class Impl { javax.swing.JButton b; }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
           .options("-XaddReads:java.base=java.desktop",
                    "-Xmodule:java.base")
           .outdir(classes)
@@ -242,13 +248,13 @@
         Path legacyClasses = base.resolve("legacy-classes");
         Files.createDirectories(legacyClasses);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options()
                 .outdir(legacyClasses)
                 .files(findJavaFiles(legacySrc))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.isEmpty()) {
             throw new Exception("unexpected output: " + log);
@@ -260,7 +266,7 @@
 
         Path jar = lib.resolve("test-api-1.0.jar");
 
-        tb.new JarTask(jar)
+        new JarTask(tb, jar)
           .baseDir(legacyClasses)
           .files("api/Api.class")
           .run();
@@ -278,7 +284,7 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulesourcepath", src.toString())
                 .outdir(classes)
                 .files(findJavaFiles(src))
@@ -293,7 +299,7 @@
         tb.writeJavaFiles(unnamedSrc,
                           "package impl; public class Impl { }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
           .options("-XaddReads:m1=ALL-UNNAMED",
                    "-Xmodule:m1",
                    "-modulepath", classes.toString())
--- a/langtools/test/tools/javac/modules/AnnotationProcessing.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/AnnotationProcessing.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,8 +28,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main AnnotationProcessing
  */
 
@@ -58,6 +57,10 @@
 import javax.lang.model.util.ElementFilter;
 import javax.lang.model.util.ElementScanner9;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class AnnotationProcessing extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -77,7 +80,7 @@
                           "module m1 { }",
                           "package impl; public class Impl { }");
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-modulesourcepath", moduleSrc.toString(),
                          "-processor", AP.class.getName(),
                          "-AexpectedEnclosedElements=m1=>impl")
@@ -85,7 +88,7 @@
                 .files(findJavaFiles(moduleSrc))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.isEmpty())
             throw new AssertionError("Unexpected output: " + log);
@@ -109,7 +112,7 @@
                           "module m2 { }",
                           "package impl2; public class Impl2 { }");
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-modulesourcepath", moduleSrc.toString(),
                          "-processor", AP.class.getName(),
                          "-AexpectedEnclosedElements=m1=>impl1,m2=>impl2")
@@ -117,7 +120,7 @@
                 .files(findJavaFiles(moduleSrc))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.isEmpty())
             throw new AssertionError("Unexpected output: " + log);
@@ -206,13 +209,13 @@
                           "package api; public class Api { }",
                           "package impl; public class Impl extends api.Api { }");
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-doe", "-processor", VerifyUsesProvidesAP.class.getName())
                 .outdir(classes)
                 .files(findJavaFiles(moduleSrc))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.isEmpty())
             throw new AssertionError("Unexpected output: " + log);
@@ -260,7 +263,7 @@
         tb.writeJavaFiles(src,
                           "package api; public class Api { }");
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-processor", VerifyPackageNoModule.class.getName(),
                          "-source", "8",
                          "-Xlint:-options")
@@ -268,7 +271,7 @@
                 .files(findJavaFiles(src))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.isEmpty())
             throw new AssertionError("Unexpected output: " + log);
--- a/langtools/test/tools/javac/modules/AnnotationProcessorsInModulesTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/AnnotationProcessorsInModulesTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -25,11 +25,9 @@
  * @test
  * @summary Verify that annotation processors inside modules works
  * @library /tools/lib
- * @modules
- *      jdk.compiler/com.sun.tools.javac.api
- *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main AnnotationProcessorsInModulesTest
  */
 
@@ -38,6 +36,10 @@
 import java.util.Arrays;
 import java.util.List;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class AnnotationProcessorsInModulesTest extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -133,13 +135,13 @@
                 annotationProcessorModule2,
                 annotationProcessor2);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-modulesourcepath", moduleSrc.toString())
                 .outdir(processorCompiledModules)
                 .files(findJavaFiles(moduleSrc))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.isEmpty()) {
             throw new AssertionError("Unexpected output: " + log);
@@ -156,14 +158,14 @@
     @Test
     void testUseOnlyOneProcessor(Path base) throws Exception {
         initialization(base);
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-processormodulepath", processorCompiledModules.toString(),
                         "-processor", "mypkg2.MyProcessor2")
                 .outdir(classes)
                 .sources(testClass)
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.STDOUT);
+                .getOutput(Task.OutputKind.STDOUT);
         if (!log.trim().equals("the annotation processor 2 is working!")) {
             throw new AssertionError("Unexpected output: " + log);
         }
@@ -172,27 +174,27 @@
     @Test
     void testAnnotationProcessorExecutionOrder(Path base) throws Exception {
         initialization(base);
-        List<String> log = tb.new JavacTask()
+        List<String> log = new JavacTask(tb)
                 .options("-processormodulepath", processorCompiledModules.toString(),
                         "-processor", "mypkg1.MyProcessor1,mypkg2.MyProcessor2")
                 .outdir(classes)
                 .sources(testClass)
                 .run()
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.STDOUT);
+                .getOutputLines(Task.OutputKind.STDOUT);
         if (!log.equals(Arrays.asList("the annotation processor 1 is working!",
                                       "the annotation processor 2 is working!"))) {
             throw new AssertionError("Unexpected output: " + log);
         }
 
-        log = tb.new JavacTask()
+        log = new JavacTask(tb)
                 .options("-processormodulepath", processorCompiledModules.toString(),
                         "-processor", "mypkg2.MyProcessor2,mypkg1.MyProcessor1")
                 .outdir(classes)
                 .sources(testClass)
                 .run()
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.STDOUT);
+                .getOutputLines(Task.OutputKind.STDOUT);
         if (!log.equals(Arrays.asList("the annotation processor 2 is working!",
                                       "the annotation processor 1 is working!"))) {
             throw new AssertionError("Unexpected output: " + log);
@@ -202,14 +204,14 @@
     @Test
     void testErrorOutputIfOneProcessorNameIsIncorrect(Path base) throws Exception {
         initialization(base);
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-processormodulepath", processorCompiledModules.toString(),
                          "-processor", "mypkg2.MyProcessor2,noPackage.noProcessor,mypkg1.MyProcessor1")
                 .outdir(classes)
                 .sources(testClass)
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.STDOUT, ToolBox.OutputKind.DIRECT).toString();
+                .getOutputLines(Task.OutputKind.STDOUT, Task.OutputKind.DIRECT).toString();
         if (!log.trim().equals("[the annotation processor 2 is working!, - compiler.err.proc.processor.not.found: noPackage.noProcessor, 1 error]")) {
             throw new AssertionError("Unexpected output: " + log);
         }
@@ -218,14 +220,14 @@
     @Test
     void testOptionsExclusion(Path base) throws Exception {
         initialization(base);
-        List<String> log = tb.new JavacTask()
+        List<String> log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-processormodulepath", processorCompiledModules.toString(),
                         "-processorpath", processorCompiledModules.toString())
                 .outdir(classes)
                 .sources(testClass)
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
         if (!log.equals(Arrays.asList("- compiler.err.processorpath.no.processormodulepath",
                                       "1 error"))) {
             throw new AssertionError("Unexpected output: " + log);
--- a/langtools/test/tools/javac/modules/AutomaticModules.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/AutomaticModules.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,14 +28,18 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask toolbox.JarTask ModuleTestBase
  * @run main AutomaticModules
  */
 
 import java.nio.file.Files;
 import java.nio.file.Path;
 
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class AutomaticModules extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -51,13 +55,13 @@
         Path legacyClasses = base.resolve("legacy-classes");
         Files.createDirectories(legacyClasses);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options()
                 .outdir(legacyClasses)
                 .files(findJavaFiles(legacySrc))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.isEmpty()) {
             throw new Exception("unexpected output: " + log);
@@ -69,7 +73,7 @@
 
         Path jar = modulePath.resolve("test-api-1.0.jar");
 
-        tb.new JarTask(jar)
+        new JarTask(tb, jar)
           .baseDir(legacyClasses)
           .files("api/Api.class")
           .run();
@@ -85,7 +89,7 @@
                           "module m1 { requires test.api; }",
                           "package impl; public class Impl { public void e(api.Api api) { api.actionPerformed(null); } }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulesourcepath", moduleSrc.toString(), "-modulepath", modulePath.toString(), "-addmods", "java.desktop")
                 .outdir(classes)
                 .files(findJavaFiles(moduleSrc))
@@ -102,13 +106,13 @@
         Path legacyClasses = base.resolve("legacy-classes");
         Files.createDirectories(legacyClasses);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options()
                 .outdir(legacyClasses)
                 .files(findJavaFiles(legacySrc))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.isEmpty()) {
             throw new Exception("unexpected output: " + log);
@@ -120,14 +124,14 @@
 
         Path apiJar = modulePath.resolve("test-api-1.0.jar");
 
-        tb.new JarTask(apiJar)
+        new JarTask(tb, apiJar)
           .baseDir(legacyClasses)
           .files("api/Api.class")
           .run();
 
         Path baseJar = base.resolve("base.jar");
 
-        tb.new JarTask(baseJar)
+        new JarTask(tb, baseJar)
           .baseDir(legacyClasses)
           .files("base/Base.class")
           .run();
@@ -143,7 +147,7 @@
                           "module m1 { requires test.api; }",
                           "package impl; public class Impl { public void e(api.Api api) { api.run(\"\"); } }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulesourcepath", moduleSrc.toString(), "-modulepath", modulePath.toString(), "-classpath", baseJar.toString())
                 .outdir(classes)
                 .files(findJavaFiles(moduleSrc))
@@ -158,12 +162,12 @@
         Path automaticClasses = base.resolve("automaticClasses");
         tb.createDirectories(automaticClasses);
 
-        String automaticLog = tb.new JavacTask()
+        String automaticLog = new JavacTask(tb)
                                 .outdir(automaticClasses)
                                 .files(findJavaFiles(automaticSrc))
                                 .run()
                                 .writeAll()
-                                .getOutput(ToolBox.OutputKind.DIRECT);
+                                .getOutput(Task.OutputKind.DIRECT);
 
         if (!automaticLog.isEmpty())
             throw new Exception("expected output not found: " + automaticLog);
@@ -174,7 +178,7 @@
 
         Path automaticJar = modulePath.resolve("automatic-1.0.jar");
 
-        tb.new JarTask(automaticJar)
+        new JarTask(tb, automaticJar)
           .baseDir(automaticClasses)
           .files("api/Api.class")
           .run();
@@ -189,7 +193,7 @@
                           "module m1 { requires public automatic; }",
                           "package dep; public class Dep { api.Api api; }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulepath", modulePath.toString())
                 .outdir(depClasses)
                 .files(findJavaFiles(depSrc))
@@ -198,7 +202,7 @@
 
         Path moduleJar = modulePath.resolve("m1.jar");
 
-        tb.new JarTask(moduleJar)
+        new JarTask(tb, moduleJar)
           .baseDir(depClasses)
           .files("module-info.class", "dep/Dep.class")
           .run();
@@ -213,7 +217,7 @@
                           "module m2 { requires automatic; }",
                           "package test; public class Test { }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulepath", modulePath.toString())
                 .outdir(testClasses)
                 .files(findJavaFiles(testSrc))
--- a/langtools/test/tools/javac/modules/DoclintOtherModules.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/DoclintOtherModules.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,14 +28,17 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main DoclintOtherModules
  */
 
 import java.nio.file.Files;
 import java.nio.file.Path;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class DoclintOtherModules extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -57,13 +60,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString(), "-Xlint:deprecation", "-Xdoclint:-reference", "-Werror")
                 .outdir(classes)
                 .files(findJavaFiles(m1))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.isEmpty())
             throw new Exception("expected output not found: " + log);
--- a/langtools/test/tools/javac/modules/DuplicateClassTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/DuplicateClassTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,14 +28,17 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main DuplicateClassTest
  */
 
 import java.nio.file.Files;
 import java.nio.file.Path;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class DuplicateClassTest extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -56,13 +59,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-modulesourcepath", base.toString())
                 .outdir(classes)
                 .files(findJavaFiles(base))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.isEmpty())
             throw new Exception("expected output not found; output: " + log);
--- a/langtools/test/tools/javac/modules/EdgeCases.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/EdgeCases.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,8 +29,7 @@
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.code
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask ModuleTestBase
  * @run main EdgeCases
  */
 
@@ -51,10 +50,15 @@
 import javax.tools.ToolProvider;
 
 import com.sun.source.tree.CompilationUnitTree;
-import com.sun.source.util.JavacTask;
+//import com.sun.source.util.JavacTask; // conflicts with toolbox.JavacTask
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.code.Symbol.ModuleSymbol;
 
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class EdgeCases extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -68,13 +72,13 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        List<String> log = tb.new JavacTask()
+        List<String> log = new JavacTask(tb)
                 .options("-XaddExports:undef/undef=ALL-UNNAMED", "-XDrawDiagnostics")
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList("- compiler.err.cant.find.module: undef",
                                               "Test.java:1:27: compiler.err.doesnt.exist: undef",
@@ -94,7 +98,8 @@
             tb.writeJavaFiles(m1, "module m1 { }");
 
             Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(findJavaFiles(moduleSrc));
-            JavacTask task = (JavacTask) compiler.getTask(null, fm, null, null, null, files);
+            com.sun.source.util.JavacTask task =
+                (com.sun.source.util.JavacTask) compiler.getTask(null, fm, null, null, null, files);
 
             task.analyze();
 
@@ -160,14 +165,14 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
                          "-modulesourcepath", src.toString())
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("Test.java:1:52: compiler.err.not.def.access.class.intf.cant.access: call(), api1.Api1") ||
             !log.contains("Test.java:1:76: compiler.err.not.def.access.class.intf.cant.access: toString(), java.lang.Object"))
@@ -183,12 +188,12 @@
         Path automaticClasses = base.resolve("automaticClasses");
         tb.createDirectories(automaticClasses);
 
-        String automaticLog = tb.new JavacTask()
+        String automaticLog = new JavacTask(tb)
                                 .outdir(automaticClasses)
                                 .files(findJavaFiles(automaticSrc))
                                 .run()
                                 .writeAll()
-                                .getOutput(ToolBox.OutputKind.DIRECT);
+                                .getOutput(Task.OutputKind.DIRECT);
 
         if (!automaticLog.isEmpty())
             throw new Exception("expected output not found: " + automaticLog);
@@ -199,7 +204,7 @@
 
         Path automaticJar = modulePath.resolve("m1-1.0.jar");
 
-        tb.new JarTask(automaticJar)
+        new JarTask(tb, automaticJar)
           .baseDir(automaticClasses)
           .files("api1/Api1.class")
           .run();
@@ -216,7 +221,7 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulepath", modulePath.toString(),
                          "-modulesourcepath", src.toString())
                 .outdir(classes)
@@ -224,7 +229,7 @@
                 .run()
                 .writeAll();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulepath", modulePath.toString(),
                          "-modulesourcepath", src.toString())
                 .outdir(classes)
@@ -244,18 +249,18 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-sourcepath", src_m1.toString(),
                          "-XDrawDiagnostics")
                 .outdir(classes)
                 .files(findJavaFiles(src_m1.resolve("test")))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll();
 
         tb.writeJavaFiles(src_m1,
                           "module m1 {}");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-sourcepath", src_m1.toString())
                 .outdir(classes)
                 .files(findJavaFiles(src_m1.resolve("test")))
--- a/langtools/test/tools/javac/modules/GraphsTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/GraphsTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,8 +28,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask ModuleTestBase
  * @run main GraphsTest
  */
 
@@ -40,6 +39,11 @@
 import java.util.List;
 import java.util.regex.Pattern;
 
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class GraphsTest extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -77,7 +81,7 @@
 
         Path jarModules = Files.createDirectories(base.resolve("jarModules"));
         Path jar = jarModules.resolve("J.jar");
-        tb.new JarTask(jar)
+        new JarTask(tb, jar)
                 .baseDir(base.resolve("jar/J"))
                 .files(".")
                 .run()
@@ -109,7 +113,7 @@
                 .classes("package p; public class Positive { openO.O o; openN.N n; openL.L l; }")
                 .write(base.resolve("positiveSrc"));
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-mp", modules + File.pathSeparator + jarModules)
                 .outdir(Files.createDirectories(base.resolve("positive")))
                 .files(findJavaFiles(positiveSrc))
@@ -118,13 +122,13 @@
         //negative case
         Path negativeSrc = m.classes("package p; public class Negative { closedO.O o; closedN.N n; closedL.L l; }")
                 .write(base.resolve("negativeSrc"));
-        List<String> log = tb.new JavacTask()
+        List<String> log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-mp", modules + File.pathSeparator + jarModules)
                 .outdir(Files.createDirectories(base.resolve("negative")))
                 .files(findJavaFiles(negativeSrc))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList(
                 "Negative.java:1:43: compiler.err.doesnt.exist: closedO",
@@ -135,16 +139,16 @@
         }
         //multi module mode
         m.write(modules);
-        List<String> out = tb.new JavacTask()
+        List<String> out = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", modules + "/*/src",
                         "-mp", jarModules.toString()
                 )
                 .outdir(Files.createDirectories(base.resolve("negative")))
                 .files(findJavaFiles(modules))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
         expected = Arrays.asList(
                 "Negative.java:1:43: compiler.err.not.def.access.package.cant.access: closedO.O, closedO",
                 "Negative.java:1:56: compiler.err.not.def.access.package.cant.access: closedN.N, closedN",
@@ -185,14 +189,14 @@
                 .requires("M")
                 .classes("package p; public class A { A(pack.Clazz cl){} } ")
                 .write(modules);
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", modules + "/*/src")
                 .outdir(Files.createDirectories(base.resolve("negative")))
                 .files(findJavaFiles(modules))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         String expected = "A.java:1:35: compiler.err.not.def.access.package.cant.access: pack.Clazz, pack";
         if (!log.contains(expected)) {
--- a/langtools/test/tools/javac/modules/HelloWorldTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/HelloWorldTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,14 +28,18 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask ModuleTestBase
  * @run main HelloWorldTest
  */
 
 import java.nio.file.*;
 import javax.tools.*;
 
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class HelloWorldTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
         HelloWorldTest t = new HelloWorldTest();
@@ -63,13 +67,13 @@
 
         Path smallRtJar = base.resolve("small-rt.jar");
         try (JavaFileManager fm = ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null)) {
-            tb.new JarTask(smallRtJar)
+            new JarTask(tb, smallRtJar)
                 .files(fm, StandardLocation.PLATFORM_CLASS_PATH,
                     "java.lang.**", "java.io.*", "java.util.*")
                 .run();
         }
 
-        tb.new JavacTask()
+        new JavacTask(tb)
             .options("-source", "8",
                 "-target", "8",
                 "-bootclasspath", smallRtJar.toString())
@@ -88,7 +92,7 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
             .outdir(classes)
             .files(src.resolve("HelloWorld.java"))
             .run();
@@ -105,7 +109,7 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
             .outdir(classes)
             .files(src.resolve("module-info.java"), src.resolve("p/HelloWorld.java"))
             .run()
@@ -126,7 +130,7 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
             .options("-modulesourcepath", src.toString())
             .outdir(classes)
             .files(src_m1.resolve("p/HelloWorld.java"))
--- a/langtools/test/tools/javac/modules/MOptionTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/MOptionTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,8 +29,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main MOptionTest
  */
 
@@ -38,7 +37,9 @@
 import java.nio.file.Path;
 import java.nio.file.attribute.FileTime;
 
-import com.sun.source.util.JavacTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
 
 public class MOptionTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
@@ -56,9 +57,9 @@
                 "module m1 {}",
                 "package test; public class Test {}");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-m", "m1", "-modulesourcepath", src.toString(), "-d", build.toString())
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
 
         Path moduleInfoClass = build.resolve("m1/module-info.class");
@@ -79,9 +80,9 @@
 
         Thread.sleep(2000); //timestamps
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-m", "m1", "-modulesourcepath", src.toString(), "-d", build.toString())
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
 
         if (!moduleInfoTimeStamp.equals(Files.getLastModifiedTime(moduleInfoClass))) {
@@ -96,9 +97,9 @@
 
         Files.setLastModifiedTime(testTest, FileTime.fromMillis(System.currentTimeMillis()));
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-m", "m1", "-modulesourcepath", src.toString(), "-d", build.toString())
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
 
         if (!moduleInfoTimeStamp.equals(Files.getLastModifiedTime(moduleInfoClass))) {
@@ -121,13 +122,13 @@
                 "module m1 {}",
                 "package test; public class Test {}");
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
                     "-m", "m1",
                     "-modulesourcepath", src.toString())
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("- compiler.err.output.dir.must.be.specified.with.dash.m.option"))
             throw new Exception("expected output not found");
@@ -144,13 +145,13 @@
                 "module m1 {}",
                 "package test; public class Test {}");
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
                         "-m", "m1",
                         "-d", build.toString())
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("- compiler.err.modulesourcepath.must.be.specified.with.dash.m.option"))
             throw new Exception("expected output not found");
@@ -172,9 +173,9 @@
                 "module m2 {}",
                 "package p2; public class C2 {}");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-m", "m1,m2", "-modulesourcepath", src.toString(), "-d", build.toString())
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
 
         Path m1ModuleInfoClass = build.resolve("m1/module-info.class");
@@ -213,9 +214,9 @@
 
         Thread.sleep(2000); //timestamps
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-m", "m1,m2", "-modulesourcepath", src.toString(), "-d", build.toString())
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
 
         if (!m1ModuleInfoTimeStamp.equals(Files.getLastModifiedTime(m1ModuleInfoClass))) {
@@ -239,9 +240,9 @@
         Files.setLastModifiedTime(C1Source, FileTime.fromMillis(System.currentTimeMillis()));
         Files.setLastModifiedTime(C2Source, FileTime.fromMillis(System.currentTimeMillis()));
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-m", "m1,m2", "-modulesourcepath", src.toString(), "-d", build.toString())
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
 
         if (!m1ModuleInfoTimeStamp.equals(Files.getLastModifiedTime(m1ModuleInfoClass))) {
--- a/langtools/test/tools/javac/modules/ModuleFinderTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/ModuleFinderTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,14 +28,18 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask ModuleTestBase
  * @run main ModuleFinderTest
  */
 
 import java.nio.file.Files;
 import java.nio.file.Path;
 
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class ModuleFinderTest extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -53,18 +57,18 @@
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
                 .writeAll();
 
-        tb.new JarTask(modules.resolve("m1-1.jar"))
+        new JarTask(tb, modules.resolve("m1-1.jar"))
                 .baseDir(classes)
                 .files(".")
                 .run();
 
-        tb.new JarTask(modules.resolve("m1-2.jar"))
+        new JarTask(tb, modules.resolve("m1-2.jar"))
                 .baseDir(classes)
                 .files(".")
                 .run();
@@ -73,13 +77,13 @@
         tb.writeJavaFiles(src2, "module m2 { requires m1; }");
 
 
-        String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics", "-modulepath", modules.toString())
                 .outdir(classes)
                 .files(findJavaFiles(src2))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("- compiler.err.duplicate.module.on.path: (compiler.misc.locn.module_path), m1"))
             throw new Exception("expected output not found");
--- a/langtools/test/tools/javac/modules/ModuleInfoTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/ModuleInfoTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -23,19 +23,23 @@
 
 /*
  * @test
- * @summary tests for modfule declarations
+ * @summary tests for module declarations
  * @library /tools/lib
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
  *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main ModuleInfoTest
  */
 
 import java.nio.file.Files;
 import java.nio.file.Path;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class ModuleInfoTest extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -50,12 +54,12 @@
     void testModuleDeclNotInModuleJava(Path base) throws Exception {
         Path src = base.resolve("src");
         tb.writeFile(src.resolve("M.java"), "module M { }");
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("M.java:1:1: compiler.err.module.decl.sb.in.module-info.java"))
             throw new Exception("expected output not found");
@@ -68,7 +72,7 @@
     void testNotModuleDeclInModuleJava_1(Path base) throws Exception {
         Path src = base.resolve("src");
         tb.writeFile(src.resolve("module-info.java"), "class C { }");
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .files(findJavaFiles(src))
                 .run()
@@ -82,12 +86,12 @@
     void testNotModuleDeclInModuleJava_2(Path base) throws Exception {
         Path src = base.resolve("src");
         tb.writeFile(src.resolve("module-info.java"), "public class C { }");
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("module-info.java:1:8: compiler.err.class.public.should.be.in.file: C"))
             throw new Exception("expected output not found");
@@ -100,12 +104,12 @@
     void testSingleModuleDecl(Path base) throws Exception {
         Path src = base.resolve("src");
         tb.writeJavaFiles(src, "module M1 { } /*...*/ module M2 { }");
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("module-info.java:1:14: compiler.err.expected: token.end-of-input"))
             throw new Exception("expected output not found");
@@ -118,12 +122,12 @@
     void testRequiresNotFound(Path base) throws Exception {
         Path src = base.resolve("src");
         tb.writeJavaFiles(src, "module M1 { requires M2; }");
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("module-info.java:1:22: compiler.err.module.not.found: M2"))
             throw new Exception("expected output not found");
@@ -136,12 +140,12 @@
     void testExportsNotFound(Path base) throws Exception {
         Path src = base.resolve("src");
         tb.writeJavaFiles(src, "module M1 { exports p to M2; }");
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("module-info.java:1:26: compiler.err.module.not.found: M2"))
             throw new Exception("expected output not found");
@@ -154,12 +158,12 @@
     void testRequiresSelf(Path base) throws Exception {
         Path src = base.resolve("src");
         tb.writeJavaFiles(src, "module M { requires M; }");
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("module-info.java:1:21: compiler.err.cyclic.requires: M"))
             throw new Exception("expected output not found");
@@ -181,13 +185,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString())
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("module-info.java:1:22: compiler.err.cyclic.requires: m3"))
             throw new Exception("expected output not found");
@@ -209,13 +213,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString())
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("module-info.java:1:29: compiler.err.cyclic.requires: m3"))
             throw new Exception("expected output not found");
@@ -235,13 +239,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString())
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("module-info.java:1:35: compiler.err.duplicate.requires: m1"))
             throw new Exception("expected output not found");
@@ -258,13 +262,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("module-info.java:1:32: compiler.err.duplicate.exports: p"))
             throw new Exception("expected output not found");
@@ -282,13 +286,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString())
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("module-info.java:1:32: compiler.err.duplicate.exports: p"))
             throw new Exception("expected output not found");
@@ -308,13 +312,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString())
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("module-info.java:1:30: compiler.err.duplicate.exports: m1"))
             throw new Exception("expected output not found");
--- a/langtools/test/tools/javac/modules/ModulePathTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/ModulePathTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -30,7 +30,7 @@
  *      jdk.compiler/com.sun.tools.javac.main
  *      jdk.jdeps/com.sun.tools.javap
  *      jdk.jlink/jdk.tools.jmod
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask ModuleTestBase
  * @run main ModulePathTest
  */
 
@@ -39,6 +39,11 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class ModulePathTest extends ModuleTestBase {
 
     public static final String PATH_SEP = File.pathSeparator;
@@ -53,13 +58,13 @@
         Path src = base.resolve("src");
         tb.writeJavaFiles(src, "class C { }");
 
-        String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulepath", "doesNotExist")
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("- compiler.err.illegal.argument.for.option: -modulepath, doesNotExist"))
             throw new Exception("expected output not found");
@@ -71,13 +76,13 @@
         tb.writeJavaFiles(src, "class C { }");
         tb.writeFile("dummy.txt", "");
 
-        String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulepath", "dummy.txt")
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("- compiler.err.illegal.argument.for.option: -modulepath, dummy.txt"))
             throw new Exception("expected output not found");
@@ -89,13 +94,13 @@
         tb.writeJavaFiles(src, "class C { }");
         tb.writeFile("dummy.jimage", "");
 
-        String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulepath", "dummy.jimage")
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("- compiler.err.illegal.argument.for.option: -modulepath, dummy.jimage"))
             throw new Exception("expected output not found");
@@ -110,7 +115,7 @@
         Path modClasses = base.resolve("modClasses");
         Files.createDirectories(modClasses);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .outdir(modClasses)
                 .files(findJavaFiles(modSrc))
                 .run()
@@ -123,7 +128,7 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .outdir(classes)
                 .options("-modulepath", modClasses.toString())
                 .files(findJavaFiles(src))
@@ -143,14 +148,14 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .outdir(classes)
                 .options("-XDrawDiagnostics",
                         "-modulepath", modClasses.toString())
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("- compiler.err.locn.bad.module-info: " + modClasses.toString()))
             throw new Exception("expected output not found");
@@ -164,14 +169,14 @@
         Path jarClasses = base.resolve("jarClasses");
         Files.createDirectories(jarClasses);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .outdir(jarClasses)
                 .files(findJavaFiles(jarSrc))
                 .run()
                 .writeAll();
 
         Path moduleJar = base.resolve("m1.jar");
-        tb.new JarTask(moduleJar)
+        new JarTask(tb, moduleJar)
           .baseDir(jarClasses)
           .files("p/CC.class")
           .run();
@@ -181,7 +186,7 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .outdir(classes)
                 .options("-modulepath", moduleJar.toString(), "-addmods", "m1")
                 .files(findJavaFiles(src))
@@ -198,14 +203,14 @@
         Path jarClasses = base.resolve("jarClasses");
         Files.createDirectories(jarClasses);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .outdir(jarClasses)
                 .files(findJavaFiles(jarSrc))
                 .run()
                 .writeAll();
 
         Path moduleJar = base.resolve("myModule.jar"); // deliberately not m1
-        tb.new JarTask(moduleJar)
+        new JarTask(tb, moduleJar)
           .baseDir(jarClasses)
           .files("module-info.class", "p/CC.class")
           .run();
@@ -217,7 +222,7 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .outdir(classes)
                 .options("-modulepath", moduleJar.toString())
                 .files(findJavaFiles(src))
@@ -231,13 +236,13 @@
         tb.writeJavaFiles(src, "class C { }");
         tb.writeFile("dummy.jar", "");
 
-        String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulepath", "dummy.jar")
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("- compiler.err.locn.cant.read.file: dummy.jar"))
             throw new Exception("expected output not found");
@@ -252,7 +257,7 @@
         Path jmodClasses = base.resolve("jmodClasses");
         Files.createDirectories(jmodClasses);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .outdir(jmodClasses)
                 .files(findJavaFiles(jmodSrc))
                 .run()
@@ -268,7 +273,7 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .outdir(classes)
                 .options("-modulepath", jmod.toString())
                 .files(findJavaFiles(src))
@@ -282,13 +287,13 @@
         tb.writeJavaFiles(src, "class C { }");
         tb.writeFile("dummy.jmod", "");
 
-        String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulepath", "dummy.jmod")
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("- compiler.err.locn.cant.read.file: dummy.jmod"))
             throw new Exception("expected output not found");
@@ -302,7 +307,7 @@
         Path src = base.resolve("src");
         tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }");
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulepath", modules + "/./../modules")
                 .files(findJavaFiles(src))
@@ -318,7 +323,7 @@
         Path src = base.resolve("src");
         tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }");
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulepath", modules + "/./../modules" + PATH_SEP + modules)
                 .files(findJavaFiles(src))
@@ -334,7 +339,7 @@
         Path src = base.resolve("src");
         tb.writeJavaFiles(src, "module m2 { requires m1; }", "class A { }");
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulepath", modules.toString(),
                         "-modulepath", modules.toString())
@@ -360,7 +365,7 @@
         Path src = base.resolve("src");
         tb.writeJavaFiles(src, "module m2 { requires m1; }", " package p; class A { void main() { pkg2.E.class.getName(); } }");
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulepath", deepModuleDir + PATH_SEP + module)
                 .files(findJavaFiles(src))
@@ -390,7 +395,7 @@
         tb.writeJavaFiles(src, "module m { requires m3; requires m2; requires m1; }",
                 "package p; class A { void main() { one.A.class.getName(); } }");
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulepath", modules.toString())
                 .files(findJavaFiles(src))
@@ -399,7 +404,7 @@
     }
 
     private void jar(Path dir, Path jar) throws IOException {
-        tb.new JarTask(jar)
+        new JarTask(tb, jar)
                 .baseDir(dir)
                 .files(".")
                 .run()
--- a/langtools/test/tools/javac/modules/ModuleSourcePathTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/ModuleSourcePathTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,8 +28,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main ModuleSourcePathTest
  */
 
@@ -43,6 +42,10 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class ModuleSourcePathTest extends ModuleTestBase {
 
     public static final char PATH_SEP = File.pathSeparatorChar;
@@ -57,14 +60,14 @@
         Path sp = base.resolve("src");
         Path msp = base.resolve("srcmodules");
 
-        String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-sourcepath", sp.toString().replace('/', File.separatorChar),
                         "-modulesourcepath", msp.toString().replace('/', File.separatorChar),
                         "dummyClass")
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("cannot specify both -sourcepath and -modulesourcepath"))
             throw new Exception("expected diagnostic not found");
@@ -78,7 +81,7 @@
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", src.toString())
                 .outdir(modules)
@@ -95,7 +98,7 @@
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", "./" + src)
                 .outdir(modules)
@@ -118,7 +121,7 @@
         final Path modules = base.resolve("modules");
         tb.createDirectories(modules);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", base + "/{src1,src2/inner_dir}")
                 .files(base.resolve("src1/m0/pkg0/A.java"), base.resolve("src2/inner_dir/m1/pkg1/A.java"))
@@ -149,12 +152,12 @@
                 "{}*}"
         );
         for (String sourcepath : sourcePaths) {
-            String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+            String log = new JavacTask(tb, Task.Mode.CMDLINE)
                     .options("-XDrawDiagnostics",
                             "-modulesourcepath", sourcepath.replace('/', File.separatorChar))
-                    .run(ToolBox.Expect.FAIL)
+                    .run(Task.Expect.FAIL)
                     .writeAll()
-                    .getOutput(ToolBox.OutputKind.DIRECT);
+                    .getOutput(Task.OutputKind.DIRECT);
 
             if (!log.contains("- compiler.err.illegal.argument.for.option: -modulesourcepath, mismatched braces"))
                 throw new Exception("expected output for path [" + sourcepath + "] not found");
@@ -177,7 +180,7 @@
         final Path modules = base.resolve("modules");
         tb.createDirectories(modules);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath",
                         base + "/{src/{{src1,src2,src3},{srcB,srcC}/{src1,src2/srcX{X,Y}/}},.}"
@@ -202,7 +205,7 @@
         final Path modules = base.resolve("modules");
         tb.createDirectories(modules);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", base + "/{dummy.txt,src}")
                 .files(src.resolve("kettle$/electric/Heater.java"))
@@ -222,7 +225,7 @@
         final Path modules = base.resolve("modules");
         tb.createDirectories(modules);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", base + "/{src}")
                 .files(src.resolve("kettle$/electric/Heater.java"))
@@ -241,7 +244,7 @@
         final Path modules = base.resolve("modules");
         tb.createDirectories(modules);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", base + "/{}")
                 .files(base.resolve("kettle$/electric/Heater.java"))
@@ -262,7 +265,7 @@
         final Path modules = src.resolve("modules");
         tb.createDirectories(modules);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", "{" + src + "," + src + "/car}")
                 .files(findJavaFiles(src))
@@ -281,7 +284,7 @@
         final Path modules = base.resolve("modules");
         tb.createDirectories(modules);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", base + "/src/./../src")
                 .files(src.resolve("kettle/electric/Heater.java"))
@@ -300,7 +303,7 @@
         final Path modules = base.resolve("modules");
         tb.createDirectories(modules);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", base + "/{src,src,src}")
                 .files(src.resolve("m1/a/A.java"))
@@ -318,14 +321,14 @@
         final Path modules = base.resolve("modules");
         tb.createDirectories(modules);
 
-        String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", base + "/not_exist" + PATH_SEP + base + "/{not_exist,}")
                 .files(base.resolve("m1/a/A.java"))
                 .outdir(modules)
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
         if (!log.contains("compiler.err.module.not.found: m0"))
             throw new Exception("expected output for not existent module source path not found");
     }
@@ -337,7 +340,7 @@
         final Path modules = base.resolve("modules");
         tb.createDirectories(modules);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", base + "{/not_exist,/}")
                 .files(base.resolve("m1/a/A.java"))
@@ -356,7 +359,7 @@
         final Path modules = base.resolve("modules");
         tb.createDirectories(modules);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", base + "/{,{,,,,src,,,}}")
                 .files(src.resolve("m1/a/A.java"))
@@ -375,7 +378,7 @@
         final Path modules = base.resolve("modules");
         tb.createDirectories(modules);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", base + "/*/classes/")
                 .files(base.resolve("kettle/classes/electric/Heater.java"))
@@ -398,7 +401,7 @@
         final Path modules = base.resolve("modules");
         tb.createDirectories(modules);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", src + "{/*/gensrc/,/*/classes/}" + PATH_SEP
                                 + src + "/*/special/classes")
@@ -427,12 +430,12 @@
                 "src/module*/"
         );
         for (String sourcepath : sourcePaths) {
-            String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+            String log = new JavacTask(tb, Task.Mode.CMDLINE)
                     .options("-XDrawDiagnostics",
                             "-modulesourcepath", sourcepath.replace('/', File.separatorChar))
-                    .run(ToolBox.Expect.FAIL)
+                    .run(Task.Expect.FAIL)
                     .writeAll()
-                    .getOutput(ToolBox.OutputKind.DIRECT);
+                    .getOutput(Task.OutputKind.DIRECT);
 
             if (!log.contains("- compiler.err.illegal.argument.for.option: -modulesourcepath, illegal use of *"))
                 throw new Exception("expected output for path [" + sourcepath + "] not found");
--- a/langtools/test/tools/javac/modules/ModuleTestBase.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/ModuleTestBase.java	Thu Mar 31 15:20:50 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
@@ -42,6 +42,9 @@
 import java.util.TreeSet;
 import java.util.stream.Collectors;
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 /**
  * Base class for module tests.
  */
@@ -175,7 +178,7 @@
 
         public void build(Path where) throws IOException {
             Path moduleSrc = write(where);
-            tb.new JavacTask()
+            new JavacTask(tb)
                     .outdir(where.resolve(name))
                     .options("-mp", modulePath)
                     .files(findJavaFiles(moduleSrc))
--- a/langtools/test/tools/javac/modules/ModulesAndClassPathTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/ModulesAndClassPathTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -25,11 +25,9 @@
  * @test
  * @summary Ensure named modules cannot refer to classpath types.
  * @library /tools/lib
- * @modules
- *      jdk.compiler/com.sun.tools.javac.api
- *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask ModuleTestBase
  * @run main ModulesAndClassPathTest
  */
 
@@ -45,6 +43,11 @@
 import javax.annotation.processing.SupportedAnnotationTypes;
 import javax.lang.model.element.TypeElement;
 
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class ModulesAndClassPathTest extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -66,14 +69,14 @@
                           "module m1 { }",
                           "package impl; public class Impl { api.Api api; }");
 
-        List<String> modLog = tb.new JavacTask()
+        List<String> modLog = new JavacTask(tb)
                                 .options("-classpath", jar.toString(),
                                          "-XDrawDiagnostics")
                                 .outdir(classes)
                                 .files(findJavaFiles(moduleSrc))
-                                .run(ToolBox.Expect.FAIL)
+                                .run(Task.Expect.FAIL)
                                 .writeAll()
-                                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList("Impl.java:1:38: compiler.err.doesnt.exist: api",
                                               "1 error");
@@ -82,16 +85,16 @@
             throw new Exception("unexpected output: " + modLog);
         }
 
-        tb.new JavacTask()
+        new JavacTask(tb)
           .options("-classpath", jar.toString(),
                    "-XaddReads:m1=ALL-UNNAMED")
           .outdir(classes)
           .files(findJavaFiles(moduleSrc))
           .run()
           .writeAll()
-          .getOutputLines(ToolBox.OutputKind.DIRECT);
+          .getOutputLines(Task.OutputKind.DIRECT);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
           .options("-classpath", jar.toString() + File.pathSeparator + System.getProperty("test.classes"),
                    "-XaddReads:m1=ALL-UNNAMED",
                    "-processor", ProcessorImpl.class.getName())
@@ -99,7 +102,7 @@
           .files(findJavaFiles(moduleSrc))
           .run()
           .writeAll()
-          .getOutputLines(ToolBox.OutputKind.DIRECT);
+          .getOutputLines(Task.OutputKind.DIRECT);
     }
 
     @Test
@@ -117,15 +120,15 @@
                           "module m1 { }",
                           "package impl; public class Impl { api.Api api; }");
 
-        List<String> modLog = tb.new JavacTask()
+        List<String> modLog = new JavacTask(tb)
                                 .options("-classpath", jar.toString(),
                                          "-sourcepath", m1.toString(),
                                          "-XDrawDiagnostics")
                                 .outdir(classes)
                                 .files(m1.resolve("impl").resolve("Impl.java"))
-                                .run(ToolBox.Expect.FAIL)
+                                .run(Task.Expect.FAIL)
                                 .writeAll()
-                                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList("Impl.java:1:38: compiler.err.doesnt.exist: api",
                                               "1 error");
@@ -150,23 +153,23 @@
                           "module m1 { }",
                           "package impl; public class Impl { api.Api api; }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
           .options("-classpath", jar.toString(),
                    "-XDrawDiagnostics")
           .outdir(classes)
           .files(m1.resolve("module-info.java"))
           .run()
           .writeAll()
-          .getOutputLines(ToolBox.OutputKind.DIRECT);
+          .getOutputLines(Task.OutputKind.DIRECT);
 
-        List<String> modLog = tb.new JavacTask()
+        List<String> modLog = new JavacTask(tb)
                                 .options("-classpath", jar.toString(),
                                          "-XDrawDiagnostics")
                                 .outdir(classes)
                                 .files(m1.resolve("impl").resolve("Impl.java"))
-                                .run(ToolBox.Expect.FAIL)
+                                .run(Task.Expect.FAIL)
                                 .writeAll()
-                                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList("Impl.java:1:38: compiler.err.doesnt.exist: api",
                                               "1 error");
@@ -183,13 +186,13 @@
         Path legacyClasses = base.resolve("legacy-classes");
         Files.createDirectories(legacyClasses);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options()
                 .outdir(legacyClasses)
                 .files(findJavaFiles(legacySrc))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.isEmpty()) {
             throw new Exception("unexpected output: " + log);
@@ -201,7 +204,7 @@
 
         Path jar = lib.resolve("test-api-1.0.jar");
 
-        tb.new JarTask(jar)
+        new JarTask(tb, jar)
           .baseDir(legacyClasses)
           .files("api/Api.class")
           .run();
@@ -233,33 +236,33 @@
                           "package test; public class TestCP extends impl.Impl { }",
                           "package test; public class TestSP extends src.Src { }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
           .outdir(classes)
           .files(m1.resolve("impl").resolve("Impl.java"))
           .run()
           .writeAll()
-          .getOutputLines(ToolBox.OutputKind.DIRECT);
+          .getOutputLines(Task.OutputKind.DIRECT);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
           .outdir(classes)
           .files(m1.resolve("module-info.java"))
           .run()
           .writeAll()
-          .getOutputLines(ToolBox.OutputKind.DIRECT);
+          .getOutputLines(Task.OutputKind.DIRECT);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
           .outdir(classes)
           .files(m1.resolve("test").resolve("TestCP.java"))
           .run()
           .writeAll()
-          .getOutputLines(ToolBox.OutputKind.DIRECT);
+          .getOutputLines(Task.OutputKind.DIRECT);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
           .options("-sourcepath", m1.toString())
           .outdir(classes)
           .files(m1.resolve("test").resolve("TestSP.java"))
           .run()
           .writeAll()
-          .getOutputLines(ToolBox.OutputKind.DIRECT);
+          .getOutputLines(Task.OutputKind.DIRECT);
     }
 }
--- a/langtools/test/tools/javac/modules/MultiModuleModeTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/MultiModuleModeTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,8 +28,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main MultiModuleModeTest
  */
 
@@ -39,6 +38,10 @@
 import java.util.Arrays;
 import java.util.List;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class MultiModuleModeTest extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -55,14 +58,14 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", src.toString())
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("module-info.java:1:1: compiler.err.duplicate.module: m1"))
             throw new Exception("expected output not found");
@@ -78,14 +81,14 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", src.toString())
                 .outdir(classes)
                 .files(join(findJavaFiles(src), findJavaFiles(misc)))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("C.java:1:1: compiler.err.unnamed.pkg.not.allowed.named.modules"))
             throw new Exception("expected output not found");
@@ -99,14 +102,14 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", src.toString())
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("module-info.java:1:8: compiler.err.module.name.mismatch: m2, m1"))
             throw new Exception("expected output not found");
@@ -120,7 +123,7 @@
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulesourcepath", src.toString())
                 .outdir(modules)
                 .files(src.resolve("m2/module-info.java"))
@@ -135,7 +138,7 @@
         Path modules1 = base.resolve("modules1");
         Files.createDirectories(modules1);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulesourcepath", src1.toString())
                 .outdir(modules1)
                 .files(src1.resolve("m1/module-info.java"))
@@ -147,7 +150,7 @@
         Path modules2 = base.resolve("modules2");
         Files.createDirectories(modules2);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulepath", modules1.toString(),
                         "-modulesourcepath", src2.toString())
                 .outdir(modules2)
--- a/langtools/test/tools/javac/modules/NPECompilingModuleInfoTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/NPECompilingModuleInfoTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,14 +29,15 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main NPECompilingModuleInfoTest
  */
 
 import java.nio.file.Path;
 
-import com.sun.source.util.JavacTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
 
 public class NPECompilingModuleInfoTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
@@ -53,11 +54,11 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(classes)
                 .files(findJavaFiles(mod))
                 .run()
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
     }
 }
--- a/langtools/test/tools/javac/modules/NPEEmptyFileTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/NPEEmptyFileTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,14 +28,17 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main NPEEmptyFileTest
  */
 
 import java.nio.file.Files;
 import java.nio.file.Path;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class NPEEmptyFileTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
         new NPEEmptyFileTest().runTests();
@@ -47,7 +50,7 @@
         Files.createDirectories(modules);
         Path emptyJavaFile = base.resolve("Test.java");
         tb.writeFile(emptyJavaFile, "");
-        tb.new JavacTask(ToolBox.Mode.EXEC)
+        new JavacTask(tb, Task.Mode.EXEC)
                 .options("-modulesourcepath", modules.toString(),
                         "-d", modules.toString(), emptyJavaFile.toString())
                 .run()
--- a/langtools/test/tools/javac/modules/OutputDirTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/OutputDirTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,8 +28,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main OutputDirTest
  */
 
@@ -38,6 +37,10 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class OutputDirTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
         new OutputDirTest().run();
@@ -58,13 +61,13 @@
 
     @Test
     void testError(Path base) throws Exception {
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", src.toString())
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("- compiler.err.no.output.dir"))
             throw new Exception("expected output not found");
@@ -72,24 +75,24 @@
 
     @Test
     void testProcOnly(Path base) throws IOException {
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-XDrawDiagnostics",
                         "-proc:only",
                         "-modulesourcepath", src.toString())
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
     }
 
     @Test
     void testClassOutDir(Path base) throws IOException {
         Path classes = base.resolve("classes");
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-XDrawDiagnostics",
                         "-d", classes.toString(),
                         "-modulesourcepath", src.toString())
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
     }
 
@@ -102,7 +105,7 @@
         Path modClasses = base.resolve("modClasses");
         Files.createDirectories(modClasses);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .outdir(modClasses)
                 .files(findJavaFiles(modSrc))
                 .run()
@@ -114,14 +117,14 @@
                 "module m { requires m1 ; }",
                 "class C { }");
 
-        String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .outdir(modClasses) // an exploded module
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", src.toString())
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("- compiler.err.multi-module.outdir.cannot.be.exploded.module: " + modClasses.toString()))
             throw new Exception("expected output not found");
@@ -136,7 +139,7 @@
         Path modClasses = base.resolve("modClasses");
         Files.createDirectories(modClasses);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .outdir(modClasses)
                 .files(findJavaFiles(modSrc))
                 .run()
@@ -150,15 +153,15 @@
         Path classes = modClasses.resolve("m");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .outdir(classes) // within an exploded module
                 .options("-XDrawDiagnostics",
                         "-Xlint", "-Werror",
                         "-modulepath", modClasses.toString())
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("- compiler.warn.outdir.is.in.exploded.module: " + classes.toString()))
             throw new Exception("expected output not found");
--- a/langtools/test/tools/javac/modules/PackageConflictTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/PackageConflictTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,8 +28,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main PackageConflictTest
  */
 
@@ -38,6 +37,10 @@
 import java.util.Arrays;
 import java.util.List;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class PackageConflictTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
         PackageConflictTest t = new PackageConflictTest();
@@ -52,13 +55,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("MyList.java:1:1: compiler.err.package.in.other.module: java.base"))
             throw new Exception("expected output not found");
@@ -77,7 +80,7 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
           .options("-Werror", "-modulesourcepath", base.toString())
           .outdir(classes)
           .files(findJavaFiles(base))
@@ -102,13 +105,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        List<String> log = tb.new JavacTask()
+        List<String> log = new JavacTask(tb)
                        .options("-XDrawDiagnostics", "-modulesourcepath", base.toString())
                        .outdir(classes)
                        .files(findJavaFiles(base))
-                       .run(ToolBox.Expect.FAIL)
+                       .run(Task.Expect.FAIL)
                        .writeAll()
-                       .getOutputLines(ToolBox.OutputKind.DIRECT);
+                       .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected =
                 Arrays.asList("module-info.java:1:1: compiler.err.package.clash.from.requires: m3, test, m1, m2",
@@ -131,13 +134,13 @@
                 .classes("package pack; public class B { pack.A f; }")
                 .write(modules);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-mp", modules.toString())
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(modules.resolve("M")))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("B.java:1:1: compiler.err.package.in.other.module: N"))
             throw new Exception("expected output not found");
@@ -156,13 +159,13 @@
                 .classes("package pack; public class C { publ.B b; }")
                 .write(modules);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", modules + "/*/src")
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(modules))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains(""))
             throw new Exception("unexpected output not found");
@@ -182,13 +185,13 @@
                 .classes("package pack; public class C { publ.B b; }")
                 .write(modules);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-mp", modules.toString())
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(modules.resolve("M")))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains(""))
             throw new Exception("expected output not found");
@@ -212,13 +215,13 @@
                 .classes("package pkg; public class C { pack.A a; pack.B b; }")
                 .write(modules);
 
-        List<String> log = tb.new JavacTask()
+        List<String> log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-mp", modules.toString())
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(modules.resolve("K")))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected =
                 Arrays.asList("module-info.java:1:1: compiler.err.package.clash.from.requires: K, pack, M, N",
@@ -244,11 +247,11 @@
                 .requires("N")
                 .classes("package p; public class DependsOnN { boolean f = pkg.A.flagN; } ")
                 .write(modules);
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulesourcepath", modules + "/*/src")
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(modules.resolve("K")))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
 
         //negative case
@@ -256,14 +259,14 @@
                 .classes("package p; public class DependsOnM { boolean f = pkg.A.flagM; } ")
                 .write(modules);
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", modules + "/*/src")
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(modules.resolve("K")))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList(
                 "DependsOnM.java:1:55: compiler.err.cant.resolve.location: kindname.variable, flagM, , , (compiler.misc.location: kindname.class, pkg.A, null)");
--- a/langtools/test/tools/javac/modules/PackageMultipleModules.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/PackageMultipleModules.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,8 +28,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main PackageMultipleModules
  */
 
@@ -38,6 +37,10 @@
 import java.util.Arrays;
 import java.util.List;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class PackageMultipleModules extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -60,13 +63,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        List<String> log = tb.new JavacTask()
+        List<String> log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", base.toString())
                 .outdir(classes)
                 .files(findJavaFiles(base))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList("A.java:1:26: compiler.err.not.def.access.package.cant.access: test.B, test",
                                               "B.java:1:26: compiler.err.not.def.access.package.cant.access: test.A, test",
--- a/langtools/test/tools/javac/modules/PluginsInModulesTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/PluginsInModulesTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,8 +28,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main PluginsInModulesTest
  */
 
@@ -38,6 +37,10 @@
 import java.util.Arrays;
 import java.util.List;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class PluginsInModulesTest extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -103,13 +106,13 @@
                 pluginModule1,
                 plugin1);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-modulesourcepath", moduleSrc.toString())
                 .outdir(processorCompiledModules)
                 .files(findJavaFiles(moduleSrc))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.isEmpty()) {
             throw new AssertionError("Unexpected output: " + log);
@@ -126,14 +129,14 @@
     @Test
     void testUseOnlyOneProcessor(Path base) throws Exception {
         initialization(base);
-        List<String> log = tb.new JavacTask()
+        List<String> log = new JavacTask(tb)
                 .options("-processormodulepath", processorCompiledModules.toString(),
                         "-Xplugin:simpleplugin1")
                 .outdir(classes)
                 .sources(testClass)
                 .run()
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.STDOUT);
+                .getOutputLines(Task.OutputKind.STDOUT);
         if (!log.equals(Arrays.asList("simpleplugin1 started for event COMPILATION",
                                       "simpleplugin1 finished for event COMPILATION"))) {
             throw new AssertionError("Unexpected output: " + log);
--- a/langtools/test/tools/javac/modules/ProvidesTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/ProvidesTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,8 +28,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main ProvidesTest
  */
 
@@ -38,6 +37,10 @@
 import java.util.Arrays;
 import java.util.List;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class ProvidesTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
         ProvidesTest t = new ProvidesTest();
@@ -54,10 +57,10 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
     }
 
@@ -73,11 +76,11 @@
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulesourcepath", src.toString())
                 .outdir(modules)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
 
     }
@@ -91,13 +94,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("module-info.java:1:24: compiler.err.expected: 'with'"))
             throw new Exception("expected output not found");
@@ -114,11 +117,11 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-XDrawDiagnostic")
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll();
     }
 
@@ -129,13 +132,13 @@
                 "module m { provides p.Missing with p.C; }",
                 "package p; public class C extends p.Missing { }");
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList(
                 "C.java:1:36: compiler.err.cant.resolve.location: kindname.class, Missing, , , (compiler.misc.location: kindname.package, p, null)",
@@ -156,14 +159,14 @@
         tb.writeJavaFiles(modules.resolve("L"),
                 "module L { requires M; provides p.Service with p.Service; }");
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", modules.toString())
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(modules))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
         List<String> expected = Arrays.asList(
                 "module-info.java:1:24: compiler.err.service.implementation.not.in.right.module: M",
                 "1 error");
@@ -181,13 +184,13 @@
                 "package p; public class A { }",
                 "package p; public class B { }");
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList("module-info.java:1:31: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: p.B, p.A)",
                 "1 error");
@@ -203,13 +206,13 @@
                 "module m { provides p.C with p.Impl; }",
                 "package p; public class C { }");
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList("module-info.java:1:31: compiler.err.cant.resolve.location: kindname.class, Impl, , , (compiler.misc.location: kindname.package, p, null)",
                 "1 error");
@@ -227,10 +230,10 @@
                 "package p; public class Impl1 extends p.C { }",
                 "package p; public class Impl2 extends p.C { }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
     }
 
@@ -243,10 +246,10 @@
                 "package p; public abstract class Service2 { }",
                 "package p; public class Impl extends p.Service2 implements p.Service1 { }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
     }
 
@@ -258,13 +261,13 @@
                 "package p1; public class C1 { }",
                 "package p2; public abstract class C2 extends p1.C1 { }");
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList(
                 "module-info.java:1:34: compiler.err.service.implementation.is.abstract: p2.C2");
@@ -281,13 +284,13 @@
                 "package p1; public interface Service { }",
                 "package p2; public interface Impl extends p1.Service { }");
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList(
                 "module-info.java:1:39: compiler.err.service.implementation.is.abstract: p2.Impl");
@@ -304,13 +307,13 @@
                 "package p1; public class C1 { }",
                 "package p2; class C2 extends p1.C1 { }");
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList("module-info.java:1:34: compiler.err.not.def.public.cant.access: p2.C2, p2",
                 "1 error");
@@ -327,13 +330,13 @@
                 "package p1; public class C1 { }",
                 "package p2; public class C2 extends p1.C1 { public C2(String str) { } }");
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList(
                 "module-info.java:1:46: compiler.err.service.implementation.doesnt.have.a.no.args.constructor: p2.C2");
@@ -350,13 +353,13 @@
                 "package p1; public class C1 { }",
                 "package p2; public class C2 extends p1.C1 { private C2() { } }");
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList(
                 "module-info.java:1:46: compiler.err.service.implementation.no.args.constructor.not.public: p2.C2");
@@ -374,10 +377,10 @@
                 "package p2; public class C2 extends p1.C1 {  }",
                 "package p2; public class C3 extends p2.C2 {  }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
     }
 
@@ -389,13 +392,13 @@
                 "package p1; public class C1 { }",
                 "package p2; public class C2  { public class Inner extends p1.C1 { } }");
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList(
                 "module-info.java:1:37: compiler.err.service.implementation.is.inner: p2.C2.Inner");
@@ -412,13 +415,13 @@
                 "package p1; public class C1 { public class InnerDefinition { } }",
                 "package p2; public class C2 extends p1.C1.InnerDefinition { }");
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList(
                 "module-info.java:1:26: compiler.err.service.definition.is.inner: p1.C1.InnerDefinition",
--- a/langtools/test/tools/javac/modules/QueryBeforeEnter.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/QueryBeforeEnter.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,8 +28,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main QueryBeforeEnter
  */
 
@@ -49,12 +48,16 @@
 import javax.tools.StandardJavaFileManager;
 import javax.tools.ToolProvider;
 
-import com.sun.source.util.JavacTask;
+// import com.sun.source.util.JavacTask;
 import com.sun.source.util.Plugin;
 import com.sun.source.util.TaskEvent;
 import com.sun.source.util.TaskListener;
 import com.sun.tools.javac.Main;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class QueryBeforeEnter extends ModuleTestBase {
     public static void main(String... args) throws Exception {
         QueryBeforeEnter t = new QueryBeforeEnter();
@@ -64,7 +67,8 @@
     @Test
     void testEmpty(Path base) throws Exception {
         JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
-        JavacTask task = (JavacTask) javaCompiler.getTask(null, null, null, null, null, null);
+        com.sun.source.util.JavacTask task =
+            (com.sun.source.util.JavacTask) javaCompiler.getTask(null, null, null, null, null, null);
         TypeElement jlString = task.getElements().getTypeElement("java.lang.String");
 
         assertNotNull(jlString);
@@ -89,7 +93,7 @@
 
         Files.createDirectories(modulePath);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulesourcepath", moduleSrc.toString())
                 .outdir(modulePath)
                 .files(findJavaFiles(moduleSrc))
@@ -105,7 +109,7 @@
 
         Files.createDirectories(cp);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(cp)
                 .files(findJavaFiles(cpSrc))
                 .run()
@@ -123,7 +127,8 @@
 
         JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
         try (StandardJavaFileManager fm = javaCompiler.getStandardFileManager(null, null, null)) {
-            JavacTask task = (JavacTask) javaCompiler.getTask(null,
+            com.sun.source.util.JavacTask task =
+                (com.sun.source.util.JavacTask) javaCompiler.getTask(null,
                                                               null,
                                                               d -> { throw new IllegalStateException(d.toString()); },
                                                               Arrays.asList("-modulepath", modulePath.toString(),
@@ -164,7 +169,7 @@
 
         Files.createDirectories(modulePath);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulesourcepath", moduleSrc.toString())
                 .outdir(modulePath)
                 .files(findJavaFiles(moduleSrc))
@@ -180,7 +185,7 @@
 
         Files.createDirectories(cp);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(cp)
                 .files(findJavaFiles(cpSrc))
                 .run()
@@ -198,7 +203,8 @@
 
         JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
         try (StandardJavaFileManager fm = javaCompiler.getStandardFileManager(null, null, null)) {
-            JavacTask task = (JavacTask) javaCompiler.getTask(null,
+            com.sun.source.util.JavacTask task =
+                (com.sun.source.util.JavacTask) javaCompiler.getTask(null,
                                                               null,
                                                               d -> { throw new IllegalStateException(d.toString()); },
                                                               Arrays.asList("-modulepath", modulePath.toString(),
@@ -238,7 +244,7 @@
 
         Files.createDirectories(modulePath);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulesourcepath", modulePathSrc.toString())
                 .outdir(modulePath)
                 .files(findJavaFiles(modulePathSrc))
@@ -254,7 +260,7 @@
 
         Files.createDirectories(cp);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(cp)
                 .files(findJavaFiles(cpSrc))
                 .run()
@@ -279,7 +285,8 @@
 
         JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
         try (StandardJavaFileManager fm = javaCompiler.getStandardFileManager(null, null, null)) {
-            JavacTask task = (JavacTask) javaCompiler.getTask(null,
+            com.sun.source.util.JavacTask task =
+                (com.sun.source.util.JavacTask) javaCompiler.getTask(null,
                                                               null,
                                                               d -> { throw new IllegalStateException(d.toString()); },
                                                               Arrays.asList("-modulepath", modulePath.toString(),
@@ -328,7 +335,8 @@
         JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
         Path testSource = src.resolve("test").resolve("Test.java");
         try (StandardJavaFileManager fm = javaCompiler.getStandardFileManager(null, null, null)) {
-            JavacTask task = (JavacTask) javaCompiler.getTask(null,
+            com.sun.source.util.JavacTask task =
+                (com.sun.source.util.JavacTask) javaCompiler.getTask(null,
                                                               null,
                                                               d -> { throw new IllegalStateException(d.toString()); },
                                                               Arrays.asList("-processorpath", processorPath,
@@ -352,7 +360,7 @@
         }
 
         @Override
-        public void init(JavacTask task, String... args) {
+        public void init(com.sun.source.util.JavacTask task, String... args) {
             task.addTaskListener(new TaskListener() {
                 boolean wasEntered;
                 @Override
--- a/langtools/test/tools/javac/modules/RepeatedUsesAndProvidesTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/RepeatedUsesAndProvidesTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,14 +28,17 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main RepeatedUsesAndProvidesTest
  */
 
 import java.nio.file.Files;
 import java.nio.file.Path;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class RepeatedUsesAndProvidesTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
         RepeatedUsesAndProvidesTest t = new RepeatedUsesAndProvidesTest();
@@ -51,13 +54,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
         if (!log.contains("module-info.java:1:24: compiler.err.duplicate.uses: p1.C1"))
             throw new Exception("expected output not found");
     }
@@ -72,13 +75,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
         if (!log.contains("module-info.java:1:39: compiler.err.duplicate.provides"))
             throw new Exception("expected output not found");
     }
--- a/langtools/test/tools/javac/modules/ReportNonExistentPackageTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/ReportNonExistentPackageTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,14 +28,17 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main ReportNonExistentPackageTest
  */
 
 import java.nio.file.Files;
 import java.nio.file.Path;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class ReportNonExistentPackageTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
         ReportNonExistentPackageTest t = new ReportNonExistentPackageTest();
@@ -49,13 +52,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
         if (!log.contains("module-info.java:1:20: compiler.err.package.empty.or.not.found: p1"))
             throw new Exception("expected output not found");
     }
@@ -69,13 +72,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
         if (!log.contains("module-info.java:1:20: compiler.err.package.empty.or.not.found: p1"))
             throw new Exception("expected output not found");
     }
@@ -90,13 +93,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
         if (!log.contains("module-info.java:1:20: compiler.err.package.empty.or.not.found: p1"))
             throw new Exception("expected output not found");
     }
--- a/langtools/test/tools/javac/modules/RequiresPublicTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/RequiresPublicTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,14 +28,17 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main RequiresPublicTest
  */
 
 import java.nio.file.Files;
 import java.nio.file.Path;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class RequiresPublicTest extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -55,7 +58,7 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .files(findJavaFiles(src))
                 .outdir(classes)
                 .run()
@@ -74,13 +77,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics")
                 .files(findJavaFiles(src))
                 .outdir(classes.toString()) // should allow Path here
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("Test.java:1:27: compiler.err.doesnt.exist: com.sun.source.tree"))
             throw new Exception("expected output not found");
@@ -92,7 +95,7 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-modulesourcepath", src.toString())
                 .files(findJavaFiles(src))
                 .outdir(classes)
@@ -108,14 +111,14 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulesourcepath", src.toString())
                 .files(findJavaFiles(src))
                 .outdir(classes)
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         String[] expect = {
             "C1.java:5:10: compiler.err.not.def.access.package.cant.access: p5.C5, p5",
--- a/langtools/test/tools/javac/modules/ResolveTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/ResolveTest.java	Thu Mar 31 15:20:50 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
@@ -28,13 +28,16 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main ResolveTest
  */
 
 import java.nio.file.*;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class ResolveTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
         ResolveTest t = new ResolveTest();
@@ -46,12 +49,12 @@
         Path src = base.resolve("src");
         tb.writeJavaFiles(src, "class C { D d; }");
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("C.java:1:11: compiler.err.cant.resolve.location: "
                 + "kindname.class, D, , , (compiler.misc.location: kindname.class, C, null)"))
@@ -65,12 +68,12 @@
                 "module m { }",
                 "class C { D d; }");
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("C.java:1:11: compiler.err.cant.resolve.location: "
                 + "kindname.class, D, , , (compiler.misc.location: kindname.class, C, null)"))
@@ -89,13 +92,13 @@
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString())
                 .outdir(modules)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
             throw new Exception("expected output not found");
@@ -113,13 +116,13 @@
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString())
                 .outdir(modules)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
             throw new Exception("expected output not found");
@@ -139,13 +142,13 @@
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString())
                 .outdir(modules)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
             throw new Exception("expected output not found");
@@ -163,13 +166,13 @@
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString())
                 .outdir(modules)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
             throw new Exception("expected output not found");
@@ -187,7 +190,7 @@
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString())
                 .outdir(modules)
                 .files(findJavaFiles(src))
@@ -207,7 +210,7 @@
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString())
                 .outdir(modules)
                 .files(findJavaFiles(src))
--- a/langtools/test/tools/javac/modules/ServiceInStaticClassErrorTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/ServiceInStaticClassErrorTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,8 +29,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main ServiceInStaticClassErrorTest
  */
 
@@ -38,6 +37,10 @@
 import java.nio.file.Path;
 import java.util.List;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class ServiceInStaticClassErrorTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
         ServiceInStaticClassErrorTest t = new ServiceInStaticClassErrorTest();
@@ -54,12 +57,12 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
     }
 
 }
--- a/langtools/test/tools/javac/modules/ServiceProvidedButNotExportedOrUsedTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/ServiceProvidedButNotExportedOrUsedTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,8 +29,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main ServiceProvidedButNotExportedOrUsedTest
  */
 
@@ -39,6 +38,10 @@
 import java.util.Arrays;
 import java.util.List;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class ServiceProvidedButNotExportedOrUsedTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
         ServiceProvidedButNotExportedOrUsedTest t = new ServiceProvidedButNotExportedOrUsedTest();
@@ -55,13 +58,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .outdir(classes)
                 .options("-Werror", "-XDrawDiagnostics")
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
         List<String> expected = Arrays.asList(
                 "module-info.java:1:12: compiler.warn.service.provided.but.not.exported.or.used: p1.C1",
                 "- compiler.err.warnings.and.werror",
@@ -86,13 +89,13 @@
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString())
                 .outdir(modules)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
         List<String> expected = Arrays.asList(
                 "module-info.java:1:39: compiler.err.service.implementation.not.in.right.module: m3",
                 "1 error");
--- a/langtools/test/tools/javac/modules/SingleModuleModeTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/SingleModuleModeTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,8 +28,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main SingleModuleModeTest
  */
 
@@ -43,6 +42,10 @@
 import javax.lang.model.SourceVersion;
 import javax.lang.model.element.TypeElement;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class SingleModuleModeTest extends ModuleTestBase{
 
     public static void main(String... args) throws Exception {
@@ -61,12 +64,12 @@
         tb.writeJavaFiles(src.resolve("m1"), "module m1 { }");
         tb.writeJavaFiles(src.resolve("m2"), "module m2 { }");
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("module-info.java:1:1: compiler.err.too.many.modules"))
             throw new Exception("expected output not found");
@@ -79,7 +82,7 @@
                 "module m { }",
                 "class C { }");
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .classpath(src)
                 .files(src.resolve("C.java"))
                 .run()
@@ -95,13 +98,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(classes)
                 .files(src.resolve("module-info.java"))
                 .run()
                 .writeAll();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .classpath(classes)
                 .files(src.resolve("C.java"))
                 .run()
@@ -117,13 +120,13 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(classes)
                 .files(src.resolve("module-info.java"))
                 .run()
                 .writeAll();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-processor", VerifyUsesProvides.class.getName(),
                          "-processorpath", System.getProperty("test.classes"))
                 .outdir(classes)
@@ -142,7 +145,7 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-processor", VerifyUsesProvides.class.getName(),
                          "-processorpath", System.getProperty("test.classes"))
                 .outdir(classes)
--- a/langtools/test/tools/javac/modules/SubpackageTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/SubpackageTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,8 +28,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main SubpackageTest
  */
 
@@ -41,6 +40,10 @@
 import java.util.List;
 import java.util.stream.Collectors;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class SubpackageTest extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -55,7 +58,7 @@
             "package p; public class E extends Error { }");
         Path libclasses = base.resolve("lib/classes");
         Files.createDirectories(libclasses);
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(libclasses)
                 .files(findJavaFiles(libsrc))
                 .run()
@@ -71,7 +74,7 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .classpath(libclasses)
                 .outdir(classes)
                 .files(findJavaFiles(src))
@@ -106,7 +109,7 @@
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulesourcepath", src.toString())
                 .outdir(modules)
                 .files(findJavaFiles(src))
--- a/langtools/test/tools/javac/modules/UpgradeModulePathTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/UpgradeModulePathTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,14 +28,17 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main UpgradeModulePathTest
  */
 
 import java.io.File;
 import java.nio.file.Path;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class UpgradeModulePathTest extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -61,7 +64,7 @@
         tb.writeJavaFiles(src, "module m2 { requires m1; }",
                 "package p; class A { void main() { pkg2.E.class.getName(); } }");
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-modulepath", module.toString(),
                         "-upgrademodulepath", upgradeModule.toString())
                 .files(findJavaFiles(src))
@@ -87,7 +90,7 @@
         tb.writeJavaFiles(src, "module m2 { requires m1; }",
                 "package p; class A { void main() { pkg2.E.class.getName(); } }");
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-upgrademodulepath", upgradeModule + File.pathSeparator + module)
                 .files(findJavaFiles(src))
                 .run()
@@ -121,7 +124,7 @@
         tb.writeJavaFiles(src.resolve("m2"), "module m2 { requires m1; requires m3; }",
                 "package p; class A { void main() { pkg2.E.class.getName(); } }");
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-modulepath", module.toString(),
                         "-modulesourcepath", src + File.pathSeparator + s,
                         "-upgrademodulepath", upgradeModule + File.pathSeparator + upgradeModule3)
@@ -149,7 +152,7 @@
         tb.writeJavaFiles(src, "module m2 { requires m1; }",
                 "package p; class A { void main() { pkg2.E.class.getName(); } }");
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-modulepath", upgradeModule + File.pathSeparator + module,
                         "-upgrademodulepath", upgradeModule.toString())
                 .files(findJavaFiles(src))
@@ -172,14 +175,14 @@
         tb.writeJavaFiles(src, "module m2 { requires m1; }",
                 "package p; class A { void main() { pkg2.E.class.getName(); } }");
 
-        String output = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        String output = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulepath", module.toString(),
                         "-upgrademodulepath", dummy.toString())
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
         if (!output.contains("compiler.err.illegal.argument.for.option: -upgrademodulepath, " + dummy)) {
             throw new Exception("Expected output was not found");
         }
@@ -212,7 +215,7 @@
         tb.writeJavaFiles(src, "module m4 { requires m1; requires m2; requires m3; }",
                 "package p; class A { void main() { pkg1.A.class.getName(); pkg2.BC.class.getName(); pkg3.DC.class.getName(); } }");
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-modulepath", module.toString(),
                         "-upgrademodulepath", upgradeModule.toString())
                 .files(findJavaFiles(src))
@@ -223,14 +226,14 @@
         tb.writeJavaFiles(src2, "module m4 { requires m1; }",
                 "package p; class A { void main() { pkg2.B.class.getName(); } }");
 
-        String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulepath", module.toString(),
                         "-upgrademodulepath", upgradeModule.toString())
                 .files(findJavaFiles(src2))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
         if (!log.contains("compiler.err.doesnt.exist: pkg2")) {
             throw new Exception("Expected output was not found");
         }
@@ -260,7 +263,7 @@
         tb.writeJavaFiles(src, "module m2 { requires m1; }",
                 "package p; class A { void main() { pkg2.EC2.class.getName(); } }");
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-modulepath", module.toString(),
                         "-upgrademodulepath", upgradeModule1.toString(),
                         "-upgrademodulepath", upgradeModule2.toString())
@@ -272,15 +275,15 @@
         tb.writeJavaFiles(src2, "module m2 { requires m1; }",
                 "package p; class A { void main() { pkg2.EC1.class.getName(); } }");
 
-        final String log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        final String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulepath", module.toString(),
                         "-upgrademodulepath", upgradeModule1.toString(),
                         "-upgrademodulepath", upgradeModule2.toString())
                 .files(findJavaFiles(src2))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.contains("compiler.err.cant.resolve.location: kindname.class, EC1, , , (compiler.misc.location: kindname.package, pkg2, null)")) {
             throw new Exception("Expected output was not found");
--- a/langtools/test/tools/javac/modules/UsesTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/UsesTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,8 +28,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main UsesTest
  */
 
@@ -39,6 +38,10 @@
 import java.util.Collection;
 import java.util.List;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class UsesTest extends ModuleTestBase {
     public static void main(String... args) throws Exception {
         UsesTest t = new UsesTest();
@@ -54,10 +57,10 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
     }
 
@@ -70,10 +73,10 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
     }
 
@@ -86,10 +89,10 @@
         Path classes = base.resolve("classes");
         Files.createDirectories(classes);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
     }
 
@@ -100,13 +103,13 @@
                 "module m { uses p.C.A; uses p.C; }",
                 "package p; public class C { protected class A { } }");
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList("module-info.java:1:20: compiler.err.report.access: p.C.A, protected, p.C",
                 "1 error");
@@ -126,11 +129,11 @@
         Path modules = base.resolve("modules");
         Files.createDirectories(modules);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-modulesourcepath", src.toString())
                 .outdir(modules)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
     }
 
@@ -146,11 +149,11 @@
                 .uses("p.C")
                 .write(modules);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-mp", modules.toString())
                 .outdir(modules)
                 .files(findJavaFiles(modules.resolve("m2")))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
     }
 
@@ -166,11 +169,11 @@
                 .uses("p.C.Inner")
                 .write(modules);
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .options("-mp", modules.toString())
                 .outdir(modules)
                 .files(findJavaFiles(modules.resolve("m2")))
-                .run(ToolBox.Expect.SUCCESS)
+                .run(Task.Expect.SUCCESS)
                 .writeAll();
     }
 
@@ -181,13 +184,13 @@
                 "module m { uses p.C; uses p.C; }",
                 "package p; public class C { }");
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics")
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         if (!output.containsAll(Arrays.asList(
                 "module-info.java:1:22: compiler.err.duplicate.uses: p.C"))) {
@@ -202,13 +205,13 @@
                 "module m { uses p.NotExist; }",
                 "package p; public class C { }");
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .outdir(Files.createDirectories(base.resolve("classes")))
                 .options("-XDrawDiagnostics")
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
         Collection<?> expected = Arrays.asList("module-info.java:1:18: compiler.err.cant.resolve.location: kindname.class, NotExist, , , (compiler.misc.location: kindname.package, p, null)",
                 "1 error");
         if (!output.containsAll(expected)) {
@@ -225,13 +228,13 @@
         tb.writeJavaFiles(src.resolve("m2"),
                 "module m2 { requires m1; uses p.C; }");
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString())
                 .outdir(Files.createDirectories(base.resolve("modules")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList("module-info.java:1:32: compiler.err.not.def.access.package.cant.access: p.C, p",
                 "1 error");
@@ -249,13 +252,13 @@
         tb.writeJavaFiles(src.resolve("m2"),
                 "module m2 { requires m1; uses p.C; }");
 
-        List<String> output = tb.new JavacTask()
+        List<String> output = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-modulesourcepath", src.toString())
                 .outdir(Files.createDirectories(base.resolve("modules")))
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList("module-info.java:1:32: compiler.err.not.def.access.package.cant.access: p.C, p",
                 "1 error");
--- a/langtools/test/tools/javac/modules/XModuleTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/modules/XModuleTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,8 +28,7 @@
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
  *      jdk.compiler/com.sun.tools.javac.main
- *      jdk.jdeps/com.sun.tools.javap
- * @build ToolBox ModuleTestBase
+ * @build toolbox.ToolBox toolbox.JavacTask ModuleTestBase
  * @run main XModuleTest
  */
 
@@ -37,6 +36,10 @@
 import java.util.Arrays;
 import java.util.List;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class XModuleTest extends ModuleTestBase {
 
     public static void main(String... args) throws Exception {
@@ -51,13 +54,13 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-Xmodule:java.compiler")
                 .outdir(classes)
                 .files(findJavaFiles(src))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.isEmpty())
             throw new Exception("expected output not found: " + log);
@@ -71,13 +74,13 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-Xmodule:java.compiler", "-sourcepath", src.toString())
                 .outdir(classes)
                 .files(src.resolve("javax/lang/model/element/Extra.java"))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.isEmpty())
             throw new Exception("expected output not found: " + log);
@@ -90,12 +93,12 @@
         Path cpClasses = base.resolve("cpClasses");
         tb.createDirectories(cpClasses);
 
-        String cpLog = tb.new JavacTask()
+        String cpLog = new JavacTask(tb)
                 .outdir(cpClasses)
                 .files(findJavaFiles(cpSrc))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!cpLog.isEmpty())
             throw new Exception("expected output not found: " + cpLog);
@@ -106,13 +109,13 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        String log = tb.new JavacTask()
+        String log = new JavacTask(tb)
                 .options("-Xmodule:java.compiler", "-classpath", cpClasses.toString())
                 .outdir(classes)
                 .files(src.resolve("javax/lang/model/element/Extra.java"))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!log.isEmpty())
             throw new Exception("expected output not found: " + log);
@@ -128,13 +131,13 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        List<String> log = tb.new JavacTask()
+        List<String> log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-Xmodule:java.compiler")
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList("Extra.java:1:1: compiler.err.module-info.with.xmodule.sourcepath",
                                               "1 error");
@@ -152,13 +155,13 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        String logMod = tb.new JavacTask()
+        String logMod = new JavacTask(tb)
                 .options()
                 .outdir(classes)
                 .files(findJavaFiles(srcMod))
                 .run()
                 .writeAll()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!logMod.isEmpty())
             throw new Exception("unexpected output found: " + logMod);
@@ -168,13 +171,13 @@
                           "package javax.lang.model.element; public interface Extra { }");
         tb.createDirectories(classes);
 
-        List<String> log = tb.new JavacTask()
+        List<String> log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-Xmodule:java.compiler")
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList("Extra.java:1:1: compiler.err.module-info.with.xmodule.classpath",
                                               "1 error");
@@ -191,13 +194,13 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        List<String> log = tb.new JavacTask()
+        List<String> log = new JavacTask(tb)
                 .options("-XDrawDiagnostics", "-Xmodule:java.compiler", "-modulesourcepath", src.toString())
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList("- compiler.err.xmodule.no.module.sourcepath",
                                               "1 error");
@@ -214,13 +217,13 @@
         Path classes = base.resolve("classes");
         tb.createDirectories(classes);
 
-        List<String> log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        List<String> log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics", "-Xmodule:java.compiler", "-Xmodule:java.compiler")
                 .outdir(classes)
                 .files(findJavaFiles(src))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList("javac: option -Xmodule: can only be specified once",
                                               "Usage: javac <options> <source files>",
@@ -240,7 +243,7 @@
         Path src = base.resolve("src");
         tb.writeJavaFiles(src, "package p; interface A extends pkg1.E { }");
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-modulepath", module.toString(),
                         "-Xmodule:m1")
                 .files(findJavaFiles(src))
@@ -255,14 +258,14 @@
         Path src2 = base.resolve("src2");
         tb.writeJavaFiles(src2, "package p; interface A extends pkg2.D { }");
 
-        List<String> log = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        List<String> log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
                         "-modulepath", module.toString(),
                         "-Xmodule:m1")
                 .files(findJavaFiles(src2))
-                .run(ToolBox.Expect.FAIL)
+                .run(Task.Expect.FAIL)
                 .writeAll()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> expected = Arrays.asList("A.java:1:36: compiler.err.doesnt.exist: pkg2",
                 "1 error");
@@ -286,7 +289,7 @@
         Path src = base.resolve("src");
         tb.writeJavaFiles(src, "package p; interface A extends pkg1.D { }");
 
-        tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-modulepath", module.toString(),
                         "-upgrademodulepath", upgrade.toString(),
                         "-Xmodule:m1")
--- a/langtools/test/tools/javac/newlines/NewLineTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/newlines/NewLineTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,10 +27,8 @@
  * @summary portability : javac.properties
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask
  * @run main NewLineTest
  */
 
@@ -39,16 +37,20 @@
 import java.nio.file.Files;
 import java.util.List;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 //original test: test/tools/javac/newlines/Newlines.sh
 public class NewLineTest {
 
     public static void main(String args[]) throws Exception {
         ToolBox tb = new ToolBox();
         File javacErrOutput = new File("output.txt");
-        tb.new JavacTask(ToolBox.Mode.EXEC)
-                .redirect(ToolBox.OutputKind.STDERR, javacErrOutput.getPath())
+        new JavacTask(tb, Task.Mode.EXEC)
+                .redirect(Task.OutputKind.STDERR, javacErrOutput.getPath())
                 .options("-J-Dline.separator='@'")
-                .run(ToolBox.Expect.FAIL);
+                .run(Task.Expect.FAIL);
 
         List<String> lines = Files.readAllLines(javacErrOutput.toPath(),
                 Charset.defaultCharset());
--- a/langtools/test/tools/javac/platform/PlatformProviderTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/platform/PlatformProviderTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,12 +27,11 @@
  * @summary Ensure all methods of PlatformProvider are called correctly, and their result is used
  *          correctly.
  * @library /tools/lib
- * @build ToolBox PlatformProviderTest
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.platform
  *          jdk.compiler/com.sun.tools.javac.util
- *          jdk.jdeps/com.sun.tools.javap
+ * @build toolbox.ToolBox PlatformProviderTest
  * @run main/othervm PlatformProviderTest
  */
 
@@ -62,12 +61,16 @@
 import javax.tools.StandardLocation;
 import javax.tools.ToolProvider;
 
-import com.sun.source.util.JavacTask;
+// import com.sun.source.util.JavacTask;
 import com.sun.source.util.Plugin;
 import com.sun.tools.javac.platform.PlatformDescription;
 import com.sun.tools.javac.platform.PlatformProvider;
 import com.sun.tools.javac.util.Log;
 
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class PlatformProviderTest implements PlatformProvider {
 
     public static void main(String... args) throws IOException {
@@ -91,8 +94,8 @@
 
     void doTest(String platformSpec, String expectedParameter) {
         ToolBox tb = new ToolBox();
-        ToolBox.Result result =
-                tb.new JavacTask(ToolBox.Mode.EXEC)
+        Task.Result result =
+                new JavacTask(tb, Task.Mode.EXEC)
                   .outdir(".")
                   .options("-J-classpath",
                            "-J" + System.getProperty("test.classes"),
@@ -116,7 +119,7 @@
                               "PlatformProviderTestSource.java:4:49: compiler.warn.raw.class.use: java.util.ArrayList, java.util.ArrayList<E>",
                               "compiler.misc.count.warn",
                               "close");
-        List<String> actualOutput = result.getOutputLines(ToolBox.OutputKind.STDERR);
+        List<String> actualOutput = result.getOutputLines(Task.OutputKind.STDERR);
         result.writeAll();
         if (!expectedOutput.equals(actualOutput)) {
             throw new AssertionError(  "Expected output: " + expectedOutput +
@@ -127,8 +130,8 @@
 
     void doTestFailure() {
         ToolBox tb = new ToolBox();
-        ToolBox.Result result =
-                tb.new JavacTask(ToolBox.Mode.EXEC)
+        Task.Result result =
+                new JavacTask(tb, Task.Mode.EXEC)
                   .outdir(".")
                   .options("-J-classpath",
                            "-J" + System.getProperty("test.classes"),
@@ -137,14 +140,14 @@
                            "-release",
                            "fail",
                            System.getProperty("test.src") + "/PlatformProviderTestSource.java")
-                  .run(ToolBox.Expect.FAIL);
+                  .run(Task.Expect.FAIL);
 
         List<String> expectedOutput =
                 Arrays.asList("getSupportedPlatformNames",
                               "getPlatform(fail, )",
                               "javac: javac.err.unsupported.release.version",
                               "javac.msg.usage");
-        List<String> actualOutput = result.getOutputLines(ToolBox.OutputKind.STDERR);
+        List<String> actualOutput = result.getOutputLines(Task.OutputKind.STDERR);
         result.writeAll();
         if (!expectedOutput.equals(actualOutput)) {
             throw new AssertionError(  "Expected output: " + expectedOutput +
@@ -281,7 +284,7 @@
         }
 
         @Override
-        public void init(JavacTask task, String... args) {
+        public void init(com.sun.source.util.JavacTask task, String... args) {
             System.err.println("testPlugin: " + Arrays.toString(args));
         }
 
--- a/langtools/test/tools/javac/plugin/showtype/Test.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/plugin/showtype/Test.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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,10 +26,9 @@
  *  @bug 8001098 8004961 8004082
  *  @library /tools/lib
  *  @modules jdk.compiler/com.sun.tools.javac.api
- *           jdk.compiler/com.sun.tools.javac.file
  *           jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- *  @build ToolBox
+ *  @build toolbox.ToolBox toolbox.JavacTask toolbox.JarTask
  *  @run main Test
  *  @summary Provide a simple light-weight "plug-in" mechanism for javac
  */
@@ -44,7 +43,10 @@
 import javax.tools.StandardLocation;
 import javax.tools.ToolProvider;
 
-import com.sun.source.util.JavacTask;
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
 
 public class Test {
     public static void main(String... args) throws Exception {
@@ -77,14 +79,14 @@
         try {
             // compile the plugin explicitly, to a non-standard directory
             // so that we don't find it on the wrong path by accident
-            tb.new JavacTask()
+            new JavacTask(tb)
               .options("-d", pluginClasses.getPath())
               .files(pluginSrc.getPath())
               .run();
 
             File plugin = new File(pluginClasses.getPath(), "META-INF/services/com.sun.source.util.Plugin");
             tb.writeFile(plugin.getPath(), "ShowTypePlugin\n");
-            tb.new JarTask()
+            new JarTask(tb)
               .run("cf", pluginJar.getPath(), "-C", pluginClasses.getPath(), ".");
 
             testCommandLine("-Xplugin:showtype", ref1);
@@ -107,13 +109,13 @@
         Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(identifiers);
 
         System.err.println("test api: " + options + " " + files);
-        ToolBox.Result result = tb.new JavacTask(ToolBox.Mode.API)
+        Task.Result result = new JavacTask(tb, Task.Mode.API)
                                   .fileManager(fm)
                                   .options(opt)
                                   .files(identifiers.toPath())
-                                  .run(ToolBox.Expect.SUCCESS)
+                                  .run(Task.Expect.SUCCESS)
                                   .writeAll();
-        String out = result.getOutput(ToolBox.OutputKind.DIRECT);
+        String out = result.getOutput(Task.OutputKind.DIRECT);
         checkOutput(out, ref);
     }
 
@@ -126,11 +128,11 @@
             identifiers.getPath() };
 
         System.err.println("test command line: " + Arrays.asList(args));
-        ToolBox.Result result = tb.new JavacTask(ToolBox.Mode.CMDLINE)
+        Task.Result result = new JavacTask(tb, Task.Mode.CMDLINE)
                                   .options(args)
-                                  .run(ToolBox.Expect.SUCCESS)
+                                  .run(Task.Expect.SUCCESS)
                                   .writeAll();
-        String out = result.getOutput(ToolBox.OutputKind.DIRECT);
+        String out = result.getOutput(Task.OutputKind.DIRECT);
         checkOutput(out, ref);
     }
 
--- a/langtools/test/tools/javac/processing/rounds/CompleteOnClosed.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/processing/rounds/CompleteOnClosed.java	Thu Mar 31 15:20:50 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
@@ -28,10 +28,9 @@
  *          the compiler.
  * @library /tools/lib /tools/javac/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox JavacTestingAbstractProcessor
+ * @build toolbox.ToolBox JavacTestingAbstractProcessor
  * @run main CompleteOnClosed
  */
 
@@ -45,6 +44,8 @@
 import javax.tools.JavaFileObject;
 import javax.tools.ToolProvider;
 
+import toolbox.ToolBox;
+
 public class CompleteOnClosed extends JavacTestingAbstractProcessor {
     public static void main(String... args) {
         JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
--- a/langtools/test/tools/javac/processing/rounds/OverwriteBetweenCompilations.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/processing/rounds/OverwriteBetweenCompilations.java	Thu Mar 31 15:20:50 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
@@ -28,13 +28,13 @@
  *          during previous compilations, and that the Symbols are updated appropriatelly.
  * @library /tools/lib /tools/javac/lib/
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.javac.processing
  *          jdk.compiler/com.sun.tools.javac.util
  *          jdk.jdeps/com.sun.tools.javap
  * @clean *
- * @build OverwriteBetweenCompilations ToolBox JavacTestingAbstractProcessor
+ * @build toolbox.ToolBox toolbox.JavacTask
+ * @build OverwriteBetweenCompilations JavacTestingAbstractProcessor
  * @compile/ref=OverwriteBetweenCompilations_1.out -XDaccessInternalAPI -processor OverwriteBetweenCompilations -Apass=1 -parameters -XDrawDiagnostics OverwriteBetweenCompilationsSource.java
  * @compile/ref=OverwriteBetweenCompilations_2.out -XDaccessInternalAPI -processor OverwriteBetweenCompilations -Apass=2 -parameters -XDrawDiagnostics OverwriteBetweenCompilationsSource.java
  * @compile/ref=OverwriteBetweenCompilations_3.out -XDaccessInternalAPI -processor OverwriteBetweenCompilations -Apass=3 -parameters -XDrawDiagnostics OverwriteBetweenCompilationsSource.java
@@ -52,6 +52,9 @@
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.Log.WriterKind;
 
+import toolbox.JavacTask;
+import toolbox.ToolBox;
+
 @SupportedOptions("pass")
 public class OverwriteBetweenCompilations extends JavacTestingAbstractProcessor {
     int round = 1;
@@ -95,7 +98,7 @@
 
                 ToolBox tb = new ToolBox();
                 ToolBox.MemoryFileManager mfm = new ToolBox.MemoryFileManager();
-                tb.new JavacTask()
+                new JavacTask(tb)
                         .fileManager(mfm)
                         .options("-parameters")
                         .sources(code)
--- a/langtools/test/tools/javac/stackmap/StackMapTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/stackmap/StackMapTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,10 +27,9 @@
  * @summary The "method0" StackMap attribute should have two entries instead of three
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavapTask
  * @run compile StackMapTest.java
  * @run main StackMapTest
  */
@@ -38,6 +37,10 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import toolbox.JavapTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 // Original test: test/tools/javac/stackmap/T4955930.sh
 public class StackMapTest {
 
@@ -54,11 +57,11 @@
     public static void main(String args[]) throws Exception {
         ToolBox tb = new ToolBox();
         Path pathToClass = Paths.get(ToolBox.testClasses, "StackMapTest$Test.class");
-        String javapOut = tb.new JavapTask()
+        String javapOut = new JavapTask(tb)
                 .options("-v")
                 .classes(pathToClass.toString())
                 .run()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!javapOut.contains("StackMapTable: number_of_entries = 2"))
             throw new AssertionError("The number of entries of the stack map "
--- a/langtools/test/tools/javac/sym/ElementStructureTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/sym/ElementStructureTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,7 +26,6 @@
  * @bug 8072480
  * @summary Check the platform classpath contains the correct elements.
  * @library /tools/lib
- * @build ToolBox ElementStructureTest
  * @modules jdk.compiler/com.sun.tools.javac.code
  *          jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -34,6 +33,7 @@
  *          jdk.compiler/com.sun.tools.javac.util
  *          jdk.jdeps/com.sun.tools.classfile
  *          jdk.jdeps/com.sun.tools.javap
+ * @build toolbox.ToolBox ElementStructureTest
  * @run main ElementStructureTest
  */
 
@@ -99,6 +99,9 @@
 import com.sun.tools.javac.code.Symbol.CompletionFailure;
 import com.sun.tools.javac.platform.PlatformProvider;
 
+import toolbox.ToolBox;
+
+
 /**To generate the hash values for version N, invoke this class like:
  *
  *     java ElementStructureTest generate-hashes $LANGTOOLS_DIR/make/data/symbols/include.list (<classes-for-N> N)+
--- a/langtools/test/tools/javac/tree/8067914/NukeExtraCast.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javac/tree/8067914/NukeExtraCast.java	Thu Mar 31 15:20:50 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
@@ -24,13 +24,11 @@
 /*
  * @test
  * @bug 8067914
- * @summary Redunant type cast nodes in AST (follow up from JDK-8043741)
+ * @summary Redundant type cast nodes in AST (follow up from JDK-8043741)
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox
  * @run compile -XD-printsource T8067914.java
  * @run main NukeExtraCast
  */
@@ -39,6 +37,8 @@
 import java.nio.file.Paths;
 import java.util.List;
 
+import toolbox.ToolBox;
+
 public class NukeExtraCast {
 
     public static void main(String[] args) throws Exception {
--- a/langtools/test/tools/javadoc/CompletionError.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javadoc/CompletionError.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -64,7 +64,7 @@
             testsDone = false;
             while (!testsDone) {
                 ToolBox tb = new ToolBox();
-                tb.new JavacTask()
+                new JavacTask(tb)
                   .sources(testSource.toString(),
                            "public class CompletionErrorMissing {}",
                            "public interface CompletionErrorIntfMissing {}",
--- a/langtools/test/tools/javah/6257087/T6257087.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javah/6257087/T6257087.java	Thu Mar 31 15:20:50 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,15 +27,16 @@
  * @summary javah doesn't produce proper signatures for inner class native methods
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavahTask
  * @run main T6257087
  */
 
 import java.util.List;
 
+import toolbox.JavahTask;
+import toolbox.ToolBox;
+
 public class T6257087 {
 
     private static final String fooBarGoldenFile =
@@ -63,7 +64,7 @@
 
     public static void main(String[] args) throws Exception {
         ToolBox tb = new ToolBox();
-        tb.new JavahTask()
+        new JavahTask(tb)
                 .classpath(ToolBox.testClasses)
                 .classes("foo")
                 .run();
--- a/langtools/test/tools/javah/ModuleClass.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javah/ModuleClass.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,15 +27,16 @@
  * @summary javah should accept module/class names
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavahTask
  * @run main ModuleClass
  */
 
 import java.util.List;
 
+import toolbox.JavahTask;
+import toolbox.ToolBox;
+
 public class ModuleClass {
     static public void main(String[] args) throws Exception {
         ToolBox tb = new ToolBox();
@@ -44,7 +45,7 @@
     }
 
     static void check(ToolBox tb, String name) throws Exception {
-        tb.new JavahTask()
+        new JavahTask(tb)
                 .classes(name)
                 .run();
 
--- a/langtools/test/tools/javah/T4942232/MissingParamClassTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javah/T4942232/MissingParamClassTest.java	Thu Mar 31 15:20:50 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
@@ -29,10 +29,8 @@
  * class is missing or not in the classpath
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
- *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavahTask
  * @run compile MissingParamClassTest.java
  * @clean MissingParamClassException
  * @run main MissingParamClassTest
@@ -44,17 +42,21 @@
 import java.nio.file.Files;
 import java.nio.file.Paths;
 
+import toolbox.JavahTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 // Original test: test/tools/javah/MissingParamClassTest.sh
 public class MissingParamClassTest {
 
     public static void main(String[] args) throws Exception {
         ToolBox tb = new ToolBox();
 
-        String out = tb.new JavahTask()
+        String out = new JavahTask(tb)
                 .classpath(ToolBox.testClasses)
                 .classes("ParamClassTest")
-                .run(ToolBox.Expect.FAIL)
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .run(Task.Expect.FAIL)
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (Files.exists(Paths.get("ParamClassTest.h")) || out.isEmpty())
             throw new AssertionError("The only output generated by javah must be an error message");
--- a/langtools/test/tools/javah/constMacroTest/ConstMacroTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javah/constMacroTest/ConstMacroTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,16 +29,18 @@
  * header file.
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavahTask
  * @run main ConstMacroTest
  */
 
 import java.io.*;
 import java.util.List;
 
+import toolbox.JavahTask;
+import toolbox.ToolBox;
+
 // Original test: test/tools/javah/ConstMacroTest.sh
 public class ConstMacroTest {
 
@@ -78,7 +80,7 @@
     public static void main(String[] args) throws Exception {
         ToolBox tb = new ToolBox();
 
-        tb.new JavahTask()
+        new JavahTask(tb)
                 .classpath(ToolBox.testClasses)
                 .classes("SubClassConsts")
                 .run();
--- a/langtools/test/tools/javap/4798312/JavapShouldLoadClassesFromRTJarTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javap/4798312/JavapShouldLoadClassesFromRTJarTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,22 +27,25 @@
  * @summary In Windows, javap doesn't load classes from rt.jar
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavapTask
  * @run main JavapShouldLoadClassesFromRTJarTest
  */
 
+import toolbox.JavapTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 public class JavapShouldLoadClassesFromRTJarTest {
 
     public static void main(String[] args) throws Exception {
         ToolBox tb = new ToolBox();
-        String out = tb.new JavapTask()
+        String out = new JavapTask(tb)
                 .options("-v")
                 .classes("java.lang.String")
                 .run()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (out.isEmpty())
             throw new AssertionError("javap generated no output");
--- a/langtools/test/tools/javap/4866831/PublicInterfaceTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javap/4866831/PublicInterfaceTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,16 +27,19 @@
  * @summary Verify that javap marks public interfaces as public
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavapTask
  * @run main PublicInterfaceTest
  */
 
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import toolbox.JavapTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 // Original test: test/tools/javap/PublicInterfaceTest.sh
 public class PublicInterfaceTest {
     public interface Test {}
@@ -46,10 +49,10 @@
 
         Path pathToClass = Paths.get(ToolBox.testClasses, "PublicInterfaceTest$Test.class");
 
-        String out = tb.new JavapTask()
+        String out = new JavapTask(tb)
                 .classes(pathToClass.toString())
                 .run()
-                .getOutput(ToolBox.OutputKind.DIRECT);
+                .getOutput(Task.OutputKind.DIRECT);
 
         if (!out.contains("public"))
             throw new AssertionError("The javap output does not contain \"public\"");
--- a/langtools/test/tools/javap/T6729471.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javap/T6729471.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,10 +27,9 @@
  * @summary javap does not output inner interfaces of an interface
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JarTask
  * @run main T6729471
  */
 
@@ -39,6 +38,9 @@
 import java.util.*;
 import javax.tools.*;
 
+import toolbox.JarTask;
+import toolbox.ToolBox;
+
 public class T6729471
 {
     public static void main(String... args) throws IOException {
@@ -82,7 +84,7 @@
         try (JavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
             File f = new File(name);
             ToolBox tb = new ToolBox();
-            tb.new JarTask(f.getPath())
+            new JarTask(tb, f.getPath())
                 .files(fm, StandardLocation.PLATFORM_CLASS_PATH, paths)
                 .run();
             return f;
--- a/langtools/test/tools/javap/stackmap/StackmapTest.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/javap/stackmap/StackmapTest.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,16 +27,20 @@
  * @summary Verify that javap prints StackMapTable attribute contents
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build ToolBox
+ * @build toolbox.ToolBox toolbox.JavacTask toolbox.JavapTask
  * @run main StackmapTest
  */
 
 import java.util.ArrayList;
 import java.util.List;
 
+import toolbox.JavacTask;
+import toolbox.JavapTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
 // Original test: test/tools/javap/stackmap/T6271292.sh
 public class StackmapTest {
 
@@ -80,15 +84,15 @@
     public static void main(String[] args) throws Exception {
         ToolBox tb = new ToolBox();
 
-        tb.new JavacTask()
+        new JavacTask(tb)
                 .sources(TestSrc)
                 .run();
 
-        List<String> out = tb.new JavapTask()
+        List<String> out = new JavapTask(tb)
                 .options("-v")
                 .classes("Test.class")
                 .run()
-                .getOutputLines(ToolBox.OutputKind.DIRECT);
+                .getOutputLines(Task.OutputKind.DIRECT);
 
         List<String> grepResult = new ArrayList<>();
         grepResult.addAll(tb.grep("frame_type",   out));
--- a/langtools/test/tools/lib/ToolBox.java	Thu Mar 31 14:56:33 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2166 +0,0 @@
-/*
- * Copyright (c) 2013, 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 java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FilterOutputStream;
-import java.io.FilterWriter;
-import java.io.IOError;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.net.URI;
-import java.nio.charset.Charset;
-import java.nio.file.FileVisitResult;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.SimpleFileVisitor;
-import java.nio.file.StandardCopyOption;
-import java.nio.file.attribute.BasicFileAttributes;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.EnumMap;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.jar.Attributes;
-import java.util.jar.JarEntry;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import java.util.stream.StreamSupport;
-
-import javax.tools.FileObject;
-import javax.tools.ForwardingJavaFileManager;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.tools.JavaFileObject.Kind;
-import javax.tools.JavaFileManager.Location;
-import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-
-import com.sun.tools.javac.api.JavacTaskImpl;
-import com.sun.tools.javac.api.JavacTool;
-
-/**
- * Utility methods and classes for writing jtreg tests for
- * javac, javah, javap, and sjavac. (For javadoc support,
- * see JavadocTester.)
- *
- * <p>There is support for common file operations similar to
- * shell commands like cat, cp, diff, mv, rm, grep.
- *
- * <p>There is also support for invoking various tools, like
- * javac, javah, javap, jar, java and other JDK tools.
- *
- * <p><em>File separators</em>: for convenience, many operations accept strings
- * to represent filenames. On all platforms on which JDK is supported,
- * "/" is a legal filename component separator. In particular, even
- * on Windows, where the official file separator is "\", "/" is a legal
- * alternative. It is therefore recommended that any client code using
- * strings to specify filenames should use "/".
- *
- * @author Vicente Romero (original)
- * @author Jonathan Gibbons (revised)
- */
-public class ToolBox {
-    /** The platform line separator. */
-    public static final String lineSeparator = System.getProperty("line.separator");
-    /** The platform OS name. */
-    public static final String osName = System.getProperty("os.name");
-
-    /** The location of the class files for this test, or null if not set. */
-    public static final String testClasses = System.getProperty("test.classes");
-    /** The location of the source files for this test, or null if not set. */
-    public static final String testSrc = System.getProperty("test.src");
-    /** The location of the test JDK for this test, or null if not set. */
-    public static final String testJDK = System.getProperty("test.jdk");
-
-    /** The current directory. */
-    public static final Path currDir = Paths.get(".");
-
-    /** The stream used for logging output. */
-    public PrintStream out = System.err;
-
-    /**
-     * Checks if the host OS is some version of Windows.
-     * @return true if the host OS is some version of Windows
-     */
-    public boolean isWindows() {
-        return osName.toLowerCase(Locale.ENGLISH).startsWith("windows");
-    }
-
-    /**
-     * Splits a string around matches of the given regular expression.
-     * If the string is empty, an empty list will be returned.
-     * @param text the string to be split
-     * @param sep  the delimiting regular expression
-     * @return the strings between the separators
-     */
-    public List<String> split(String text, String sep) {
-        if (text.isEmpty())
-            return Collections.emptyList();
-        return Arrays.asList(text.split(sep));
-    }
-
-    /**
-     * Checks if two lists of strings are equal.
-     * @param l1 the first list of strings to be compared
-     * @param l2 the second list of strings to be compared
-     * @throws Error if the lists are not equal
-     */
-    public void checkEqual(List<String> l1, List<String> l2) throws Error {
-        if (!Objects.equals(l1, l2)) {
-            // l1 and l2 cannot both be null
-            if (l1 == null)
-                throw new Error("comparison failed: l1 is null");
-            if (l2 == null)
-                throw new Error("comparison failed: l2 is null");
-            // report first difference
-            for (int i = 0; i < Math.min(l1.size(), l2.size()); i++) {
-                String s1 = l1.get(i);
-                String s2 = l1.get(i);
-                if (!Objects.equals(s1, s2)) {
-                    throw new Error("comparison failed, index " + i +
-                            ", (" + s1 + ":" + s2 + ")");
-                }
-            }
-            throw new Error("comparison failed: l1.size=" + l1.size() + ", l2.size=" + l2.size());
-        }
-    }
-
-    /**
-     * Filters a list of strings according to the given regular expression.
-     * @param regex the regular expression
-     * @param lines the strings to be filtered
-     * @return the strings matching the regular expression
-     */
-    public List<String> grep(String regex, List<String> lines) {
-        return grep(Pattern.compile(regex), lines);
-    }
-
-    /**
-     * Filters a list of strings according to the given regular expression.
-     * @param pattern the regular expression
-     * @param lines the strings to be filtered
-     * @return the strings matching the regular expression
-     */
-    public List<String> grep(Pattern pattern, List<String> lines) {
-        return lines.stream()
-                .filter(s -> pattern.matcher(s).find())
-                .collect(Collectors.toList());
-    }
-
-    /**
-     * Copies a file.
-     * If the given destination exists and is a directory, the copy is created
-     * in that directory.  Otherwise, the copy will be placed at the destination,
-     * possibly overwriting any existing file.
-     * <p>Similar to the shell "cp" command: {@code cp from to}.
-     * @param from the file to be copied
-     * @param to where to copy the file
-     * @throws IOException if any error occurred while copying the file
-     */
-    public void copyFile(String from, String to) throws IOException {
-        copyFile(Paths.get(from), Paths.get(to));
-    }
-
-    /**
-     * Copies a file.
-     * If the given destination exists and is a directory, the copy is created
-     * in that directory.  Otherwise, the copy will be placed at the destination,
-     * possibly overwriting any existing file.
-     * <p>Similar to the shell "cp" command: {@code cp from to}.
-     * @param from the file to be copied
-     * @param to where to copy the file
-     * @throws IOException if an error occurred while copying the file
-     */
-    public void copyFile(Path from, Path to) throws IOException {
-        if (Files.isDirectory(to)) {
-            to = to.resolve(from.getFileName());
-        } else {
-            Files.createDirectories(to.getParent());
-        }
-        Files.copy(from, to, StandardCopyOption.REPLACE_EXISTING);
-    }
-
-    /**
-     * Creates one of more directories.
-     * For each of the series of paths, a directory will be created,
-     * including any necessary parent directories.
-     * <p>Similar to the shell command: {@code mkdir -p paths}.
-     * @param paths the directories to be created
-     * @throws IOException if an error occurred while creating the directories
-     */
-    public void createDirectories(String... paths) throws IOException {
-        if (paths.length == 0)
-            throw new IllegalArgumentException("no directories specified");
-        for (String p : paths)
-            Files.createDirectories(Paths.get(p));
-    }
-
-    /**
-     * Creates one or more directories.
-     * For each of the series of paths, a directory will be created,
-     * including any necessary parent directories.
-     * <p>Similar to the shell command: {@code mkdir -p paths}.
-     * @param paths the directories to be created
-     * @throws IOException if an error occurred while creating the directories
-     */
-    public void createDirectories(Path... paths) throws IOException {
-        if (paths.length == 0)
-            throw new IllegalArgumentException("no directories specified");
-        for (Path p : paths)
-            Files.createDirectories(p);
-    }
-
-    /**
-     * Deletes one or more files.
-     * Any directories to be deleted must be empty.
-     * <p>Similar to the shell command: {@code rm files}.
-     * @param files the files to be deleted
-     * @throws IOException if an error occurred while deleting the files
-     */
-    public void deleteFiles(String... files) throws IOException {
-        if (files.length == 0)
-            throw new IllegalArgumentException("no files specified");
-        for (String file : files)
-            Files.delete(Paths.get(file));
-    }
-
-    /**
-     * Deletes all content of a directory (but not the directory itself).
-     * @param root the directory to be cleaned
-     */
-    public void cleanDirectory(Path root) throws IOException {
-        if (!Files.isDirectory(root)) {
-            throw new IOException(root + " is not a directory");
-        }
-        Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
-            @Override
-            public FileVisitResult visitFile(Path file, BasicFileAttributes a) throws IOException {
-                Files.delete(file);
-                return FileVisitResult.CONTINUE;
-            }
-
-            @Override
-            public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException {
-                if (e != null) {
-                    throw e;
-                }
-                if (!dir.equals(root)) {
-                    Files.delete(dir);
-                }
-                return FileVisitResult.CONTINUE;
-            }
-        });
-    }
-
-    /**
-     * Moves a file.
-     * If the given destination exists and is a directory, the file will be moved
-     * to that directory.  Otherwise, the file will be moved to the destination,
-     * possibly overwriting any existing file.
-     * <p>Similar to the shell "mv" command: {@code mv from to}.
-     * @param from the file to be moved
-     * @param to where to move the file
-     * @throws IOException if an error occurred while moving the file
-     */
-    public void moveFile(String from, String to) throws IOException {
-        moveFile(Paths.get(from), Paths.get(to));
-    }
-
-    /**
-     * Moves a file.
-     * If the given destination exists and is a directory, the file will be moved
-     * to that directory.  Otherwise, the file will be moved to the destination,
-     * possibly overwriting any existing file.
-     * <p>Similar to the shell "mv" command: {@code mv from to}.
-     * @param from the file to be moved
-     * @param to where to move the file
-     * @throws IOException if an error occurred while moving the file
-     */
-    public void moveFile(Path from, Path to) throws IOException {
-        if (Files.isDirectory(to)) {
-            to = to.resolve(from.getFileName());
-        } else {
-            Files.createDirectories(to.getParent());
-        }
-        Files.move(from, to, StandardCopyOption.REPLACE_EXISTING);
-    }
-
-    /**
-     * Reads the lines of a file.
-     * The file is read using the default character encoding.
-     * @param path the file to be read
-     * @return the lines of the file.
-     * @throws IOException if an error occurred while reading the file
-     */
-    public List<String> readAllLines(String path) throws IOException {
-        return readAllLines(path, null);
-    }
-
-    /**
-     * Reads the lines of a file.
-     * The file is read using the default character encoding.
-     * @param path the file to be read
-     * @return the lines of the file.
-     * @throws IOException if an error occurred while reading the file
-     */
-    public List<String> readAllLines(Path path) throws IOException {
-        return readAllLines(path, null);
-    }
-
-    /**
-     * Reads the lines of a file using the given encoding.
-     * @param path the file to be read
-     * @param encoding the encoding to be used to read the file
-     * @return the lines of the file.
-     * @throws IOException if an error occurred while reading the file
-     */
-    public List<String> readAllLines(String path, String encoding) throws IOException {
-        return readAllLines(Paths.get(path), encoding);
-    }
-
-    /**
-     * Reads the lines of a file using the given encoding.
-     * @param path the file to be read
-     * @param encoding the encoding to be used to read the file
-     * @return the lines of the file.
-     * @throws IOException if an error occurred while reading the file
-     */
-    public List<String> readAllLines(Path path, String encoding) throws IOException {
-        return Files.readAllLines(path, getCharset(encoding));
-    }
-
-    private Charset getCharset(String encoding) {
-        return (encoding == null) ? Charset.defaultCharset() : Charset.forName(encoding);
-    }
-
-    /**
-     * Writes a file containing the given content.
-     * Any necessary directories for the file will be created.
-     * @param path where to write the file
-     * @param content the content for the file
-     * @throws IOException if an error occurred while writing the file
-     */
-    public void writeFile(String path, String content) throws IOException {
-        writeFile(Paths.get(path), content);
-    }
-
-    /**
-     * Writes a file containing the given content.
-     * Any necessary directories for the file will be created.
-     * @param path where to write the file
-     * @param content the content for the file
-     * @throws IOException if an error occurred while writing the file
-     */
-    public void writeFile(Path path, String content) throws IOException {
-        Path dir = path.getParent();
-        if (dir != null)
-            Files.createDirectories(dir);
-        try (BufferedWriter w = Files.newBufferedWriter(path)) {
-            w.write(content);
-        }
-    }
-
-    /**
-     * Writes one or more files containing Java source code.
-     * For each file to be written, the filename will be inferred from the
-     * given base directory, the package declaration (if present) and from the
-     * the name of the first class, interface or enum declared in the file.
-     * <p>For example, if the base directory is /my/dir/ and the content
-     * contains "package p; class C { }", the file will be written to
-     * /my/dir/p/C.java.
-     * <p>Note: the content is analyzed using regular expressions;
-     * errors can occur if any contents have initial comments that might trip
-     * up the analysis.
-     * @param dir the base directory
-     * @param contents the contents of the files to be written
-     * @throws IOException if an error occurred while writing any of the files.
-     */
-    public void writeJavaFiles(Path dir, String... contents) throws IOException {
-        if (contents.length == 0)
-            throw new IllegalArgumentException("no content specified for any files");
-        for (String c : contents) {
-            new JavaSource(c).write(dir);
-        }
-    }
-
-    /**
-     * Returns the path for the binary of a JDK tool within {@link testJDK}.
-     * @param tool the name of the tool
-     * @return the path of the tool
-     */
-    public Path getJDKTool(String tool) {
-        return Paths.get(testJDK, "bin", tool);
-    }
-
-    /**
-     * Returns a string representing the contents of an {@code Iterable} as a list.
-     * @param <T> the type parameter of the {@code Iterable}
-     * @param items the iterable
-     * @return the string
-     */
-    <T> String toString(Iterable<T> items) {
-        return StreamSupport.stream(items.spliterator(), false)
-                .map(Objects::toString)
-                .collect(Collectors.joining(",", "[", "]"));
-    }
-
-    /**
-     * The supertype for tasks.
-     * Complex operations are modelled by building and running a "Task" object.
-     * Tasks are typically configured in a fluent series of calls.
-     */
-    public interface Task {
-        /**
-         * Returns the name of the task.
-         * @return the name of the task
-         */
-        String name();
-
-        /**
-         * Executes the task as currently configured.
-         * @return a Result object containing the results of running the task
-         * @throws TaskError if the outcome of the task was not as expected
-         */
-        Result run() throws TaskError;
-    }
-
-    /**
-     * Exception thrown by {@code Task.run} when the outcome is not as
-     * expected.
-     */
-    public static class TaskError extends Error {
-        /**
-         * Creates a TaskError object with the given message.
-         * @param message the message
-         */
-        public TaskError(String message) {
-            super(message);
-        }
-    }
-
-    /**
-     * An enum to indicate the mode a task should use it is when executed.
-     */
-    public enum Mode {
-        /**
-         * The task should use the interface used by the command
-         * line launcher for the task.
-         * For example, for javac: com.sun.tools.javac.Main.compile
-         */
-        CMDLINE,
-        /**
-         * The task should use a publicly defined API for the task.
-         * For example, for javac: javax.tools.JavaCompiler
-         */
-        API,
-        /**
-         * The task should use the standard launcher for the task.
-         * For example, $JAVA_HOME/bin/javac
-         */
-        EXEC
-    }
-
-    /**
-     * An enum to indicate the expected success or failure of executing a task.
-     */
-    public enum Expect {
-        /** It is expected that the task will complete successfully. */
-        SUCCESS,
-        /** It is expected that the task will not complete successfully. */
-        FAIL
-    }
-
-    /**
-     * An enum to identify the streams that may be written by a {@code Task}.
-     */
-    public enum OutputKind {
-        /** Identifies output written to {@code System.out} or {@code stdout}. */
-        STDOUT,
-        /** Identifies output written to {@code System.err} or {@code stderr}. */
-        STDERR,
-        /** Identifies output written to a stream provided directly to the task. */
-        DIRECT
-    };
-
-    /**
-     * The results from running a {@link Task}.
-     * The results contain the exit code returned when the tool was invoked,
-     * and a map containing the output written to any streams during the
-     * execution of the tool.
-     * All tools support "stdout" and "stderr".
-     * Tools that take an explicit PrintWriter save output written to that
-     * stream as "main".
-     */
-    public class Result {
-
-        final Task task;
-        final int exitCode;
-        final Map<OutputKind, String> outputMap;
-
-        Result(Task task, int exitCode, Map<OutputKind, String> outputMap) {
-            this.task = task;
-            this.exitCode = exitCode;
-            this.outputMap = outputMap;
-        }
-
-        /**
-         * Returns the content of a specified stream.
-         * @param outputKind the kind of the selected stream
-         * @return the content that was written to that stream when the tool
-         *  was executed.
-         */
-        public String getOutput(OutputKind outputKind) {
-            return outputMap.get(outputKind);
-        }
-
-        /**
-         * Returns the content of named streams as a list of lines.
-         * @param outputKinds the kinds of the selected streams
-         * @return the content that was written to the given streams when the tool
-         *  was executed.
-         */
-        public List<String> getOutputLines(OutputKind... outputKinds) {
-            List<String> result = new ArrayList<>();
-            for (OutputKind outputKind : outputKinds) {
-                result.addAll(Arrays.asList(outputMap.get(outputKind).split(lineSeparator)));
-            }
-            return result;
-        }
-
-        /**
-         * Writes the content of the specified stream to the log.
-         * @param kind the kind of the selected stream
-         * @return this Result object
-         */
-        public Result write(OutputKind kind) {
-            String text = getOutput(kind);
-            if (text == null || text.isEmpty())
-                out.println("[" + task.name() + ":" + kind + "]: empty");
-            else {
-                out.println("[" + task.name() + ":" + kind + "]:");
-                out.print(text);
-            }
-            return this;
-        }
-
-        /**
-         * Writes the content of all streams with any content to the log.
-         * @return this Result object
-         */
-        public Result writeAll() {
-            outputMap.forEach((name, text) -> {
-                if (!text.isEmpty()) {
-                    out.println("[" + name + "]:");
-                    out.print(text);
-                }
-            });
-            return this;
-        }
-    }
-
-    /**
-     * A utility base class to simplify the implementation of tasks.
-     * Provides support for running the task in a process and for
-     * capturing output written by the task to stdout, stderr and
-     * other writers where applicable.
-     * @param <T> the implementing subclass
-     */
-    protected static abstract class AbstractTask<T extends AbstractTask<T>> implements Task {
-        protected final Mode mode;
-        private final Map<OutputKind, String> redirects = new EnumMap<>(OutputKind.class);
-        private final Map<String, String> envVars = new HashMap<>();
-        private Expect expect = Expect.SUCCESS;
-        int expectedExitCode = 0;
-
-        /**
-         * Create a task that will execute in the specified mode.
-         * @param mode the mode
-         */
-        protected AbstractTask(Mode mode) {
-            this.mode = mode;
-        }
-
-        /**
-         * Sets the expected outcome of the task and calls {@code run()}.
-         * @param expect the expected outcome
-         * @return the result of calling {@code run()}
-         */
-        public Result run(Expect expect) {
-            expect(expect, Integer.MIN_VALUE);
-            return run();
-        }
-
-        /**
-         * Sets the expected outcome of the task and calls {@code run()}.
-         * @param expect the expected outcome
-         * @param exitCode the expected exit code if the expected outcome
-         *      is {@code FAIL}
-         * @return the result of calling {@code run()}
-         */
-        public Result run(Expect expect, int exitCode) {
-            expect(expect, exitCode);
-            return run();
-        }
-
-        /**
-         * Sets the expected outcome and expected exit code of the task.
-         * The exit code will not be checked if the outcome is
-         * {@code Expect.SUCCESS} or if the exit code is set to
-         * {@code Integer.MIN_VALUE}.
-         * @param expect the expected outcome
-         * @param exitCode the expected exit code
-         */
-        protected void expect(Expect expect, int exitCode) {
-            this.expect = expect;
-            this.expectedExitCode = exitCode;
-        }
-
-        /**
-         * Checks the exit code contained in a {@code Result} against the
-         * expected outcome and exit value
-         * @param result the result object
-         * @return the result object
-         * @throws TaskError if the exit code stored in the result object
-         *      does not match the expected outcome and exit code.
-         */
-        protected Result checkExit(Result result) throws TaskError {
-            switch (expect) {
-                case SUCCESS:
-                    if (result.exitCode != 0) {
-                        result.writeAll();
-                        throw new TaskError("Task " + name() + " failed: rc=" + result.exitCode);
-                    }
-                    break;
-
-                case FAIL:
-                    if (result.exitCode == 0) {
-                        result.writeAll();
-                        throw new TaskError("Task " + name() + " succeeded unexpectedly");
-                    }
-
-                    if (expectedExitCode != Integer.MIN_VALUE
-                            && result.exitCode != expectedExitCode) {
-                        result.writeAll();
-                        throw new TaskError("Task " + name() + "failed with unexpected exit code "
-                            + result.exitCode + ", expected " + expectedExitCode);
-                    }
-                    break;
-            }
-            return result;
-        }
-
-        /**
-         * Sets an environment variable to be used by this task.
-         * @param name the name of the environment variable
-         * @param value the value for the environment variable
-         * @return this task object
-         * @throws IllegalStateException if the task mode is not {@code EXEC}
-         */
-        protected T envVar(String name, String value) {
-            if (mode != Mode.EXEC)
-                throw new IllegalStateException();
-            envVars.put(name, value);
-            return (T) this;
-        }
-
-        /**
-         * Redirects output from an output stream to a file.
-         * @param outputKind the name of the stream to be redirected.
-         * @param path the file
-         * @return this task object
-         * @throws IllegalStateException if the task mode is not {@code EXEC}
-         */
-        protected T redirect(OutputKind outputKind, String path) {
-            if (mode != Mode.EXEC)
-                throw new IllegalStateException();
-            redirects.put(outputKind, path);
-            return (T) this;
-        }
-
-        /**
-         * Returns a {@code ProcessBuilder} initialized with any
-         * redirects and environment variables that have been set.
-         * @return a {@code ProcessBuilder}
-         */
-        protected ProcessBuilder getProcessBuilder() {
-            if (mode != Mode.EXEC)
-                throw new IllegalStateException();
-            ProcessBuilder pb = new ProcessBuilder();
-            if (redirects.get(OutputKind.STDOUT) != null)
-                pb.redirectOutput(new File(redirects.get(OutputKind.STDOUT)));
-            if (redirects.get(OutputKind.STDERR) != null)
-                pb.redirectError(new File(redirects.get(OutputKind.STDERR)));
-            pb.environment().putAll(envVars);
-            return pb;
-        }
-
-        /**
-         * Collects the output from a process and saves it in a {@code Result}.
-         * @param tb the {@code ToolBox} containing the task {@code t}
-         * @param t the task initiating the process
-         * @param p the process
-         * @return a Result object containing the output from the process and its
-         *      exit value.
-         * @throws InterruptedException if the thread is interrupted
-         */
-        protected Result runProcess(ToolBox tb, Task t, Process p) throws InterruptedException {
-            if (mode != Mode.EXEC)
-                throw new IllegalStateException();
-            ProcessOutput sysOut = new ProcessOutput(p.getInputStream()).start();
-            ProcessOutput sysErr = new ProcessOutput(p.getErrorStream()).start();
-            sysOut.waitUntilDone();
-            sysErr.waitUntilDone();
-            int rc = p.waitFor();
-            Map<OutputKind, String> outputMap = new EnumMap<>(OutputKind.class);
-            outputMap.put(OutputKind.STDOUT, sysOut.getOutput());
-            outputMap.put(OutputKind.STDERR, sysErr.getOutput());
-            return checkExit(tb.new Result(t, rc, outputMap));
-        }
-
-        /**
-         * Thread-friendly class to read the output from a process until the stream
-         * is exhausted.
-         */
-        static class ProcessOutput implements Runnable {
-            ProcessOutput(InputStream from) {
-                in = new BufferedReader(new InputStreamReader(from));
-                out = new StringBuilder();
-            }
-
-            ProcessOutput start() {
-                new Thread(this).start();
-                return this;
-            }
-
-            @Override
-            public void run() {
-                try {
-                    String line;
-                    while ((line = in.readLine()) != null) {
-                        out.append(line).append(lineSeparator);
-                    }
-                } catch (IOException e) {
-                }
-                synchronized (this) {
-                    done = true;
-                    notifyAll();
-                }
-            }
-
-            synchronized void waitUntilDone() throws InterruptedException {
-                boolean interrupted = false;
-
-                // poll interrupted flag, while waiting for copy to complete
-                while (!(interrupted = Thread.interrupted()) && !done)
-                    wait(1000);
-
-                if (interrupted)
-                    throw new InterruptedException();
-            }
-
-            String getOutput() {
-                return out.toString();
-            }
-
-            private BufferedReader in;
-            private final StringBuilder out;
-            private boolean done;
-        }
-
-        /**
-         * Utility class to simplify the handling of temporarily setting a
-         * new stream for System.out or System.err.
-         */
-        static class StreamOutput {
-            // Functional interface to set a stream.
-            // Expected use: System::setOut, System::setErr
-            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;
-            }
-
-            /**
-             * Closes the stream and returns the contents that were written to it.
-             * @return the contents that were written to it.
-             */
-            String close() {
-                init.set(prev);
-                ps.close();
-                return baos.toString();
-            }
-        }
-
-        /**
-         * Utility class to simplify the handling of creating an in-memory PrintWriter.
-         */
-        static class WriterOutput {
-            private final StringWriter sw = new StringWriter();
-            final PrintWriter pw = new PrintWriter(sw);
-
-            /**
-             * Closes the stream and returns the contents that were written to it.
-             * @return the contents that were written to it.
-             */
-            String close() {
-                pw.close();
-                return sw.toString();
-            }
-        }
-    }
-
-    /**
-     * A task to configure and run the Java compiler, javac.
-     */
-    public class JavacTask extends AbstractTask<JavacTask> {
-        private boolean includeStandardOptions;
-        private List<Path> classpath;
-        private List<Path> sourcepath;
-        private Path outdir;
-        private List<String> options;
-        private List<String> classes;
-        private List<String> files;
-        private List<JavaFileObject> fileObjects;
-        private JavaFileManager fileManager;
-
-        private JavaCompiler compiler;
-        private StandardJavaFileManager internalFileManager;
-
-        /**
-         * Creates a task to execute {@code javac} using API mode.
-         */
-        public JavacTask() {
-            super(Mode.API);
-        }
-
-        /**
-         * Creates a task to execute {@code javac} in a specified mode.
-         * @param mode the mode to be used
-         */
-        public JavacTask(Mode mode) {
-            super(mode);
-        }
-
-        /**
-         * Sets the classpath.
-         * @param classpath the classpath
-         * @return this task object
-         */
-        public JavacTask classpath(String classpath) {
-            this.classpath = Stream.of(classpath.split(File.pathSeparator))
-                    .filter(s -> !s.isEmpty())
-                    .map(s -> Paths.get(s))
-                    .collect(Collectors.toList());
-            return this;
-        }
-
-        /**
-         * Sets the classpath.
-         * @param classpath the classpath
-         * @return this task object
-         */
-        public JavacTask classpath(Path... classpath) {
-            this.classpath = Arrays.asList(classpath);
-            return this;
-        }
-
-        /**
-         * Sets the sourcepath.
-         * @param sourcepath the sourcepath
-         * @return this task object
-         */
-        public JavacTask sourcepath(String sourcepath) {
-            this.sourcepath = Stream.of(sourcepath.split(File.pathSeparator))
-                    .filter(s -> !s.isEmpty())
-                    .map(s -> Paths.get(s))
-                    .collect(Collectors.toList());
-            return this;
-        }
-
-        /**
-         * Sets the sourcepath.
-         * @param classpath the sourcepath
-         * @return this task object
-         */
-        public JavacTask sourcepath(Path... sourcepath) {
-            this.sourcepath = Arrays.asList(sourcepath);
-            return this;
-        }
-
-        /**
-         * Sets the output directory.
-         * @param outdir the output directory
-         * @return this task object
-         */
-        public JavacTask outdir(String outdir) {
-            this.outdir = Paths.get(outdir);
-            return this;
-        }
-
-        /**
-         * Sets the output directory.
-         * @param outdir the output directory
-         * @return this task object
-         */
-        public JavacTask outdir(Path outdir) {
-            this.outdir = outdir;
-            return this;
-        }
-
-        /**
-         * Sets the options.
-         * @param options the options
-         * @return this task object
-         */
-        public JavacTask options(String... options) {
-            this.options = Arrays.asList(options);
-            return this;
-        }
-
-        /**
-         * Sets the classes to be analyzed.
-         * @param classes the classes
-         * @return this task object
-         */
-        public JavacTask classes(String... classes) {
-            this.classes = Arrays.asList(classes);
-            return this;
-        }
-
-        /**
-         * Sets the files to be compiled or analyzed.
-         * @param files the files
-         * @return this task object
-         */
-        public JavacTask files(String... files) {
-            this.files = Arrays.asList(files);
-            return this;
-        }
-
-        /**
-         * Sets the files to be compiled or analyzed.
-         * @param files the files
-         * @return this task object
-         */
-        public JavacTask files(Path... files) {
-            this.files = Stream.of(files)
-                    .map(Path::toString)
-                    .collect(Collectors.toList());
-            return this;
-        }
-
-        /**
-         * Sets the sources to be compiled or analyzed.
-         * Each source string is converted into an in-memory object that
-         * can be passed directly to the compiler.
-         * @param sources the sources
-         * @return this task object
-         */
-        public JavacTask sources(String... sources) {
-            fileObjects = Stream.of(sources)
-                    .map(s -> new JavaSource(s))
-                    .collect(Collectors.toList());
-            return this;
-        }
-
-        /**
-         * Sets the file manager to be used by this task.
-         * @param fileManager the file manager
-         * @return this task object
-         */
-        public JavacTask fileManager(JavaFileManager fileManager) {
-            this.fileManager = fileManager;
-            return this;
-        }
-
-        /**
-         * {@inheritDoc}
-         * @return the name "javac"
-         */
-        @Override
-        public String name() {
-            return "javac";
-        }
-
-        /**
-         * Calls the compiler with the arguments as currently configured.
-         * @return a Result object indicating the outcome of the compilation
-         * and the content of any output written to stdout, stderr, or the
-         * main stream by the compiler.
-         * @throws TaskError if the outcome of the task is not as expected.
-         */
-        @Override
-        public Result run() {
-            if (mode == Mode.EXEC)
-                return runExec();
-
-            WriterOutput direct = new WriterOutput();
-            // The following are to catch output to System.out and System.err,
-            // in case these are used instead of the primary (main) stream
-            StreamOutput sysOut = new StreamOutput(System.out, System::setOut);
-            StreamOutput sysErr = new StreamOutput(System.err, System::setErr);
-            int rc;
-            Map<OutputKind, String> outputMap = new HashMap<>();
-            try {
-                switch (mode == null ? Mode.API : mode) {
-                    case API:
-                        rc = runAPI(direct.pw);
-                        break;
-                    case CMDLINE:
-                        rc = runCommand(direct.pw);
-                        break;
-                    default:
-                        throw new IllegalStateException();
-                }
-            } catch (IOException e) {
-                out.println("Exception occurred: " + e);
-                rc = 99;
-            } finally {
-                outputMap.put(OutputKind.STDOUT, sysOut.close());
-                outputMap.put(OutputKind.STDERR, sysErr.close());
-                outputMap.put(OutputKind.DIRECT, direct.close());
-            }
-            return checkExit(new Result(this, rc, outputMap));
-        }
-
-        private int runAPI(PrintWriter pw) throws IOException {
-            try {
-//                if (compiler == null) {
-                    // TODO: allow this to be set externally
-//                    compiler = ToolProvider.getSystemJavaCompiler();
-                    compiler = JavacTool.create();
-//                }
-
-                if (fileManager == null)
-                    fileManager = internalFileManager = compiler.getStandardFileManager(null, null, null);
-                if (outdir != null)
-                    setLocationFromPaths(StandardLocation.CLASS_OUTPUT, Collections.singletonList(outdir));
-                if (classpath != null)
-                    setLocationFromPaths(StandardLocation.CLASS_PATH, classpath);
-                if (sourcepath != null)
-                    setLocationFromPaths(StandardLocation.SOURCE_PATH, sourcepath);
-                List<String> allOpts = new ArrayList<>();
-                if (options != null)
-                    allOpts.addAll(options);
-
-                Iterable<? extends JavaFileObject> allFiles = joinFiles(files, fileObjects);
-                JavaCompiler.CompilationTask task = compiler.getTask(pw,
-                        fileManager,
-                        null,  // diagnostic listener; should optionally collect diags
-                        allOpts,
-                        classes,
-                        allFiles);
-                return ((JavacTaskImpl) task).doCall().exitCode;
-            } finally {
-                if (internalFileManager != null)
-                    internalFileManager.close();
-            }
-        }
-
-        private void setLocationFromPaths(StandardLocation location, List<Path> files) throws IOException {
-            if (!(fileManager instanceof StandardJavaFileManager))
-                throw new IllegalStateException("not a StandardJavaFileManager");
-            ((StandardJavaFileManager) fileManager).setLocationFromPaths(location, files);
-        }
-
-        private int runCommand(PrintWriter pw) {
-            List<String> args = getAllArgs();
-            String[] argsArray = args.toArray(new String[args.size()]);
-            return com.sun.tools.javac.Main.compile(argsArray, pw);
-        }
-
-        private Result runExec() {
-            List<String> args = new ArrayList<>();
-            Path javac = getJDKTool("javac");
-            args.add(javac.toString());
-            if (includeStandardOptions) {
-                args.addAll(split(System.getProperty("test.tool.vm.opts"), " +"));
-                args.addAll(split(System.getProperty("test.compiler.opts"), " +"));
-            }
-            args.addAll(getAllArgs());
-
-            String[] argsArray = args.toArray(new String[args.size()]);
-            ProcessBuilder pb = getProcessBuilder();
-            pb.command(argsArray);
-            try {
-                return runProcess(ToolBox.this, this, pb.start());
-            } catch (IOException | InterruptedException e) {
-                throw new Error(e);
-            }
-        }
-
-        private List<String> getAllArgs() {
-            List<String> args = new ArrayList<>();
-            if (options != null)
-                args.addAll(options);
-            if (outdir != null) {
-                args.add("-d");
-                args.add(outdir.toString());
-            }
-            if (classpath != null) {
-                args.add("-classpath");
-                args.add(toSearchPath(classpath));
-            }
-            if (sourcepath != null) {
-                args.add("-sourcepath");
-                args.add(toSearchPath(sourcepath));
-            }
-            if (classes != null)
-                args.addAll(classes);
-            if (files != null)
-                args.addAll(files);
-
-            return args;
-        }
-
-        private String toSearchPath(List<Path> files) {
-            return files.stream()
-                .map(Path::toString)
-                .collect(Collectors.joining(File.pathSeparator));
-        }
-
-        private Iterable<? extends JavaFileObject> joinFiles(
-                List<String> files, List<JavaFileObject> fileObjects) {
-            if (files == null)
-                return fileObjects;
-            if (internalFileManager == null)
-                internalFileManager = compiler.getStandardFileManager(null, null, null);
-            Iterable<? extends JavaFileObject> filesAsFileObjects =
-                    internalFileManager.getJavaFileObjectsFromStrings(files);
-            if (fileObjects == null)
-                return filesAsFileObjects;
-            List<JavaFileObject> combinedList = new ArrayList<>();
-            for (JavaFileObject o : filesAsFileObjects)
-                combinedList.add(o);
-            combinedList.addAll(fileObjects);
-            return combinedList;
-        }
-    }
-
-    /**
-     * A task to configure and run the native header tool, javah.
-     */
-    public class JavahTask extends AbstractTask<JavahTask> {
-        private String classpath;
-        private List<String> options;
-        private List<String> classes;
-
-        /**
-         * Create a task to execute {@code javah} using {@code CMDLINE} mode.
-         */
-        public JavahTask() {
-            super(Mode.CMDLINE);
-        }
-
-        /**
-         * Sets the classpath.
-         * @param classpath the classpath
-         * @return this task object
-         */
-        public JavahTask classpath(String classpath) {
-            this.classpath = classpath;
-            return this;
-        }
-
-        /**
-         * Sets the options.
-         * @param options the options
-         * @return this task object
-         */
-        public JavahTask options(String... options) {
-            this.options = Arrays.asList(options);
-            return this;
-        }
-
-        /**
-         * Sets the classes to be analyzed.
-         * @param classes the classes
-         * @return this task object
-         */
-        public JavahTask classes(String... classes) {
-            this.classes = Arrays.asList(classes);
-            return this;
-        }
-
-        /**
-         * {@inheritDoc}
-         * @return the name "javah"
-         */
-        @Override
-        public String name() {
-            return "javah";
-        }
-
-        /**
-         * Calls the javah tool with the arguments as currently configured.
-         * @return a Result object indicating the outcome of the task
-         * and the content of any output written to stdout, stderr, or the
-         * main stream provided to the task.
-         * @throws TaskError if the outcome of the task is not as expected.
-         */
-        @Override
-        public Result run() {
-            List<String> args = new ArrayList<>();
-            if (options != null)
-                args.addAll(options);
-            if (classpath != null) {
-                args.add("-classpath");
-                args.add(classpath);
-            }
-            if (classes != null)
-                args.addAll(classes);
-
-            WriterOutput direct = new WriterOutput();
-            // These are to catch output to System.out and System.err,
-            // in case these are used instead of the primary streams
-            StreamOutput sysOut = new StreamOutput(System.out, System::setOut);
-            StreamOutput sysErr = new StreamOutput(System.err, System::setErr);
-            int rc;
-            Map<OutputKind, String> outputMap = new HashMap<>();
-            try {
-                rc = com.sun.tools.javah.Main.run(args.toArray(new String[args.size()]), direct.pw);
-            } finally {
-                outputMap.put(OutputKind.STDOUT, sysOut.close());
-                outputMap.put(OutputKind.STDERR, sysErr.close());
-                outputMap.put(OutputKind.DIRECT, direct.close());
-            }
-            return checkExit(new Result(this, rc, outputMap));
-        }
-    }
-
-    /**
-     * A task to configure and run the disassembler tool, javap.
-     */
-    public class JavapTask extends AbstractTask<JavapTask> {
-        private String classpath;
-        private List<String> options;
-        private List<String> classes;
-
-        /**
-         * Create a task to execute {@code javap} using {@code CMDLINE} mode.
-         */
-        public JavapTask() {
-            super(Mode.CMDLINE);
-        }
-
-        /**
-         * Sets the classpath.
-         * @param classpath the classpath
-         * @return this task object
-         */
-        public JavapTask classpath(String classpath) {
-            this.classpath = classpath;
-            return this;
-        }
-
-        /**
-         * Sets the options.
-         * @param options the options
-         * @return this task object
-         */
-        public JavapTask options(String... options) {
-            this.options = Arrays.asList(options);
-            return this;
-        }
-
-        /**
-         * Sets the classes to be analyzed.
-         * @param classes the classes
-         * @return this task object
-         */
-        public JavapTask classes(String... classes) {
-            this.classes = Arrays.asList(classes);
-            return this;
-        }
-
-        /**
-         * {@inheritDoc}
-         * @return the name "javap"
-         */
-        @Override
-        public String name() {
-            return "javap";
-        }
-
-        /**
-         * Calls the javap tool with the arguments as currently configured.
-         * @return a Result object indicating the outcome of the task
-         * and the content of any output written to stdout, stderr, or the
-         * main stream.
-         * @throws TaskError if the outcome of the task is not as expected.
-         */
-        @Override
-        public Result run() {
-            List<String> args = new ArrayList<>();
-            if (options != null)
-                args.addAll(options);
-            if (classpath != null) {
-                args.add("-classpath");
-                args.add(classpath);
-            }
-            if (classes != null)
-                args.addAll(classes);
-
-            WriterOutput direct = new WriterOutput();
-            // These are to catch output to System.out and System.err,
-            // in case these are used instead of the primary streams
-            StreamOutput sysOut = new StreamOutput(System.out, System::setOut);
-            StreamOutput sysErr = new StreamOutput(System.err, System::setErr);
-
-            int rc;
-            Map<OutputKind, String> outputMap = new HashMap<>();
-            try {
-                rc = com.sun.tools.javap.Main.run(args.toArray(new String[args.size()]), direct.pw);
-            } finally {
-                outputMap.put(OutputKind.STDOUT, sysOut.close());
-                outputMap.put(OutputKind.STDERR, sysErr.close());
-                outputMap.put(OutputKind.DIRECT, direct.close());
-            }
-            return checkExit(new Result(this, rc, outputMap));
-        }
-    }
-
-    /**
-     * A task to configure and run the jar file utility.
-     */
-    public class JarTask extends AbstractTask<JarTask> {
-        private Path jar;
-        private Manifest manifest;
-        private String classpath;
-        private String mainClass;
-        private Path baseDir;
-        private List<Path> paths;
-        private Set<FileObject> fileObjects;
-
-        /**
-         * Creates a task to write jar files, using API mode.
-         */
-        public JarTask() {
-            super(Mode.API);
-            paths = Collections.emptyList();
-            fileObjects = new LinkedHashSet<>();
-        }
-
-        /**
-         * Creates a JarTask for use with a given jar file.
-         * @param path the file
-         */
-        public JarTask(String path) {
-            this();
-            jar = Paths.get(path);
-        }
-
-        /**
-         * Creates a JarTask for use with a given jar file.
-         * @param path the file
-         */
-        public JarTask(Path path) {
-            this();
-            jar = path;
-        }
-
-        /**
-         * Sets a manifest for the jar file.
-         * @param manifest the manifest
-         * @return this task object
-         */
-        public JarTask manifest(Manifest manifest) {
-            this.manifest = manifest;
-            return this;
-        }
-
-        /**
-         * Sets a manifest for the jar file.
-         * @param manifest a string containing the contents of the manifest
-         * @return this task object
-         * @throws IOException if there is a problem creating the manifest
-         */
-        public JarTask manifest(String manifest) throws IOException {
-            this.manifest = new Manifest(new ByteArrayInputStream(manifest.getBytes()));
-            return this;
-        }
-
-        /**
-         * Sets the classpath to be written to the {@code Class-Path}
-         * entry in the manifest.
-         * @param classpath the classpath
-         * @return this task object
-         */
-        public JarTask classpath(String classpath) {
-            this.classpath = classpath;
-            return this;
-        }
-
-        /**
-         * Sets the class to be written to the {@code Main-Class}
-         * entry in the manifest..
-         * @param mainClass the name of the main class
-         * @return this task object
-         */
-        public JarTask mainClass(String mainClass) {
-            this.mainClass = mainClass;
-            return this;
-        }
-
-        /**
-         * Sets the base directory for files to be written into the jar file.
-         * @param baseDir the base directory
-         * @return this task object
-         */
-        public JarTask baseDir(String baseDir) {
-            this.baseDir = Paths.get(baseDir);
-            return this;
-        }
-
-        /**
-         * Sets the base directory for files to be written into the jar file.
-         * @param baseDir the base directory
-         * @return this task object
-         */
-        public JarTask baseDir(Path baseDir) {
-            this.baseDir = baseDir;
-            return this;
-        }
-
-        /**
-         * Sets the files to be written into the jar file.
-         * @param files the files
-         * @return this task object
-         */
-        public JarTask files(String... files) {
-            this.paths = Stream.of(files)
-                    .map(file -> Paths.get(file))
-                    .collect(Collectors.toList());
-            return this;
-        }
-
-        /**
-         * Adds a set of file objects to be written into the jar file, by copying them
-         * from a Location in a JavaFileManager.
-         * The file objects to be written are specified by a series of paths;
-         * each path can be in one of the following forms:
-         * <ul>
-         * <li>The name of a class. For example, java.lang.Object.
-         * In this case, the corresponding .class file will be written to the jar file.
-         * <li>the name of a package followed by {@code .*}. For example, {@code java.lang.*}.
-         * In this case, all the class files in the specified package will be written to
-         * the jar file.
-         * <li>the name of a package followed by {@code .**}. For example, {@code java.lang.**}.
-         * In this case, all the class files in the specified package, and any subpackages
-         * will be written to the jar file.
-         * </ul>
-         *
-         * @param fm the file manager in which to find the file objects
-         * @param l  the location in which to find the file objects
-         * @param paths the paths specifying the file objects to be copied
-         * @return this task object
-         * @throws IOException if errors occur while determining the set of file objects
-         */
-        public JarTask files(JavaFileManager fm, Location l, String... paths)
-                throws IOException {
-            for (String p : paths) {
-                if (p.endsWith(".**"))
-                    addPackage(fm, l, p.substring(0, p.length() - 3), true);
-                else if (p.endsWith(".*"))
-                    addPackage(fm, l, p.substring(0, p.length() - 2), false);
-                else
-                    addFile(fm, l, p);
-            }
-            return this;
-        }
-
-        private void addPackage(JavaFileManager fm, Location l, String pkg, boolean recurse)
-                throws IOException {
-            for (JavaFileObject fo : fm.list(l, pkg, EnumSet.allOf(JavaFileObject.Kind.class), recurse)) {
-                fileObjects.add(fo);
-            }
-        }
-
-        private void addFile(JavaFileManager fm, Location l, String path) throws IOException {
-            JavaFileObject fo = fm.getJavaFileForInput(l, path, Kind.CLASS);
-            fileObjects.add(fo);
-        }
-
-        /**
-         * Provides limited jar command-like functionality.
-         * The supported commands are:
-         * <ul>
-         * <li> jar cf jarfile -C dir files...
-         * <li> jar cfm jarfile manifestfile -C dir files...
-         * </ul>
-         * Any values specified by other configuration methods will be ignored.
-         * @param args arguments in the style of those for the jar command
-         * @return a Result object containing the results of running the task
-         */
-        public Result run(String... args) {
-            if (args.length < 2)
-                throw new IllegalArgumentException();
-
-            ListIterator<String> iter = Arrays.asList(args).listIterator();
-            String first = iter.next();
-            switch (first) {
-                case "cf":
-                    jar = Paths.get(iter.next());
-                    break;
-                case "cfm":
-                    jar = Paths.get(iter.next());
-                    try (InputStream in = Files.newInputStream(Paths.get(iter.next()))) {
-                        manifest = new Manifest(in);
-                    } catch (IOException e) {
-                        throw new IOError(e);
-                    }
-                    break;
-            }
-
-            if (iter.hasNext()) {
-                if (iter.next().equals("-C"))
-                    baseDir = Paths.get(iter.next());
-                else
-                    iter.previous();
-            }
-
-            paths = new ArrayList<>();
-            while (iter.hasNext())
-                paths.add(Paths.get(iter.next()));
-
-            return run();
-        }
-
-        /**
-         * {@inheritDoc}
-         * @return the name "jar"
-         */
-        @Override
-        public String name() {
-            return "jar";
-        }
-
-        /**
-         * Creates a jar file with the arguments as currently configured.
-         * @return a Result object indicating the outcome of the compilation
-         * and the content of any output written to stdout, stderr, or the
-         * main stream by the compiler.
-         * @throws TaskError if the outcome of the task is not as expected.
-         */
-        @Override
-        public Result run() {
-            Manifest m = (manifest == null) ? new Manifest() : manifest;
-            Attributes mainAttrs = m.getMainAttributes();
-            if (mainClass != null)
-                mainAttrs.put(Attributes.Name.MAIN_CLASS, mainClass);
-            if (classpath != null)
-                mainAttrs.put(Attributes.Name.CLASS_PATH, classpath);
-
-            StreamOutput sysOut = new StreamOutput(System.out, System::setOut);
-            StreamOutput sysErr = new StreamOutput(System.err, System::setErr);
-
-            Map<OutputKind, String> outputMap = new HashMap<>();
-
-            try (OutputStream os = Files.newOutputStream(jar);
-                    JarOutputStream jos = openJar(os, m)) {
-                writeFiles(jos);
-                writeFileObjects(jos);
-            } catch (IOException e) {
-                error("Exception while opening " + jar, e);
-            } finally {
-                outputMap.put(OutputKind.STDOUT, sysOut.close());
-                outputMap.put(OutputKind.STDERR, sysErr.close());
-            }
-            return checkExit(new Result(this, (errors == 0) ? 0 : 1, outputMap));
-        }
-
-        private JarOutputStream openJar(OutputStream os, Manifest m) throws IOException {
-            if (m == null || m.getMainAttributes().isEmpty() && m.getEntries().isEmpty()) {
-                return new JarOutputStream(os);
-            } else {
-                if (m.getMainAttributes().get(Attributes.Name.MANIFEST_VERSION) == null)
-                    m.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
-                return new JarOutputStream(os, m);
-            }
-        }
-
-        private void writeFiles(JarOutputStream jos) throws IOException {
-                Path base = (baseDir == null) ? currDir : baseDir;
-                for (Path path : paths) {
-                    Files.walkFileTree(base.resolve(path), new SimpleFileVisitor<Path>() {
-                        @Override
-                        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
-                            try {
-                            String p = base.relativize(file)
-                                    .normalize()
-                                    .toString()
-                                    .replace(File.separatorChar, '/');
-                            JarEntry e = new JarEntry(p);
-                                jos.putNextEntry(e);
-                            try {
-                                jos.write(Files.readAllBytes(file));
-                            } finally {
-                                jos.closeEntry();
-                            }
-                                return FileVisitResult.CONTINUE;
-                            } catch (IOException e) {
-                            error("Exception while adding " + file + " to jar file", e);
-                                return FileVisitResult.TERMINATE;
-                            }
-                        }
-                    });
-                }
-        }
-
-        private void writeFileObjects(JarOutputStream jos) throws IOException {
-            for (FileObject fo : fileObjects) {
-                String p = guessPath(fo);
-                JarEntry e = new JarEntry(p);
-                jos.putNextEntry(e);
-                try {
-                    byte[] buf = new byte[1024];
-                    try (BufferedInputStream in = new BufferedInputStream(fo.openInputStream())) {
-                        int n;
-                        while ((n = in.read(buf)) > 0)
-                            jos.write(buf, 0, n);
-                    } catch (IOException ex) {
-                        error("Exception while adding " + fo.getName() + " to jar file", ex);
-                    }
-            } finally {
-                    jos.closeEntry();
-            }
-            }
-        }
-
-        /*
-         * A jar: URL is of the form  jar:URL!/<entry>  where URL is a URL for the .jar file itself.
-         * In Symbol files (i.e. ct.sym) the underlying entry is prefixed META-INF/sym/<base>.
-         */
-        private final Pattern jarEntry = Pattern.compile(".*!/(?:META-INF/sym/[^/]+/)?(.*)");
-
-        /*
-         * A jrt: URL is of the form  jrt:/modules/<module>/<package>/<file>
-         */
-        private final Pattern jrtEntry = Pattern.compile("/modules/([^/]+)/(.*)");
-
-        /*
-         * A file: URL is of the form  file:/path/to/{modules,patches}/<module>/<package>/<file>
-         */
-        private final Pattern fileEntry = Pattern.compile(".*/(?:modules|patches)/([^/]+)/(.*)");
-
-        private String guessPath(FileObject fo) {
-            URI u = fo.toUri();
-            switch (u.getScheme()) {
-                case "jar": {
-                    Matcher m = jarEntry.matcher(u.getSchemeSpecificPart());
-                    if (m.matches()) {
-                        return m.group(1);
-                    }
-                    break;
-                }
-                case "jrt": {
-                    Matcher m = jrtEntry.matcher(u.getSchemeSpecificPart());
-                    if (m.matches()) {
-                        return m.group(2);
-                    }
-                    break;
-                }
-                case "file": {
-                    Matcher m = fileEntry.matcher(u.getSchemeSpecificPart());
-                    if (m.matches()) {
-                        return m.group(2);
-                    }
-                    break;
-                }
-            }
-            throw new IllegalArgumentException(fo.getName() + "--" + fo.toUri());
-        }
-
-        private void error(String message, Throwable t) {
-            out.println("Error: " + message + ": " + t);
-            errors++;
-        }
-
-        private int errors;
-    }
-
-    /**
-     * A task to configure and run the Java launcher.
-     */
-    public class JavaTask extends AbstractTask<JavaTask> {
-        boolean includeStandardOptions = true;
-        private String classpath;
-        private List<String> vmOptions;
-        private String className;
-        private List<String> classArgs;
-
-        /**
-         * Create a task to run the Java launcher, using {@code EXEC} mode.
-         */
-        public JavaTask() {
-            super(Mode.EXEC);
-        }
-
-        /**
-         * Sets the classpath.
-         * @param classpath the classpath
-         * @return this task object
-         */
-        public JavaTask classpath(String classpath) {
-            this.classpath = classpath;
-            return this;
-        }
-
-        /**
-         * Sets the VM options.
-         * @param vmOptions the options
-         * @return this task object
-         */
-        public JavaTask vmOptions(String... vmOptions) {
-            this.vmOptions = Arrays.asList(vmOptions);
-            return this;
-        }
-
-        /**
-         * Sets the name of the class to be executed.
-         * @param className the name of the class
-         * @return this task object
-         */
-        public JavaTask className(String className) {
-            this.className = className;
-            return this;
-        }
-
-        /**
-         * Sets the arguments for the class to be executed.
-         * @param classArgs the arguments
-         * @return this task object
-         */
-        public JavaTask classArgs(String... classArgs) {
-            this.classArgs = Arrays.asList(classArgs);
-            return this;
-        }
-
-        /**
-         * Sets whether or not the standard VM and java options for the test should be passed
-         * to the new VM instance. If this method is not called, the default behavior is that
-         * the options will be passed to the new VM instance.
-         *
-         * @param includeStandardOptions whether or not the standard VM and java options for
-         *                               the test should be passed to the new VM instance.
-         * @return this task object
-         */
-        public JavaTask includeStandardOptions(boolean includeStandardOptions) {
-            this.includeStandardOptions = includeStandardOptions;
-            return this;
-        }
-
-        /**
-         * {@inheritDoc}
-         * @return the name "java"
-         */
-        @Override
-        public String name() {
-            return "java";
-        }
-
-        /**
-         * Calls the Java launcher with the arguments as currently configured.
-         * @return a Result object indicating the outcome of the task
-         * and the content of any output written to stdout or stderr.
-         * @throws TaskError if the outcome of the task is not as expected.
-         */
-        @Override
-        public Result run() {
-            List<String> args = new ArrayList<>();
-            args.add(getJDKTool("java").toString());
-            if (includeStandardOptions) {
-                args.addAll(split(System.getProperty("test.vm.opts"), " +"));
-                args.addAll(split(System.getProperty("test.java.opts"), " +"));
-            }
-            if (classpath != null) {
-                args.add("-classpath");
-                args.add(classpath);
-            }
-            if (vmOptions != null)
-                args.addAll(vmOptions);
-            if (className != null)
-                args.add(className);
-            if (classArgs != null)
-                args.addAll(classArgs);
-            ProcessBuilder pb = getProcessBuilder();
-            pb.command(args);
-            try {
-                return runProcess(ToolBox.this, this, pb.start());
-            } catch (IOException | InterruptedException e) {
-                throw new Error(e);
-            }
-        }
-    }
-
-    /**
-     * A task to configure and run a general command.
-     */
-    public class ExecTask extends AbstractTask<ExecTask> {
-        private final String command;
-        private List<String> args;
-
-        /**
-         * Create a task to execute a given command, to be run using {@code EXEC} mode.
-         * @param command the command to be executed
-         */
-        public ExecTask(String command) {
-            super(Mode.EXEC);
-            this.command = command;
-        }
-
-        /**
-         * Create a task to execute a given command, to be run using {@code EXEC} mode.
-         * @param command the command to be executed
-         */
-        public ExecTask(Path command) {
-            super(Mode.EXEC);
-            this.command = command.toString();
-        }
-
-        /**
-         * Sets the arguments for the command to be executed
-         * @param args the arguments
-         * @return this task object
-         */
-        public ExecTask args(String... args) {
-            this.args = Arrays.asList(args);
-            return this;
-        }
-
-        /**
-         * {@inheritDoc}
-         * @return the name "exec"
-         */
-        @Override
-        public String name() {
-            return "exec";
-        }
-
-        /**
-         * Calls the command with the arguments as currently configured.
-         * @return a Result object indicating the outcome of the task
-         * and the content of any output written to stdout or stderr.
-         * @throws TaskError if the outcome of the task is not as expected.
-         */
-        @Override
-        public Result run() {
-            List<String> cmdArgs = new ArrayList<>();
-            cmdArgs.add(command);
-            if (args != null)
-                cmdArgs.addAll(args);
-            ProcessBuilder pb = getProcessBuilder();
-            pb.command(cmdArgs);
-            try {
-                return runProcess(ToolBox.this, this, pb.start());
-            } catch (IOException | InterruptedException e) {
-                throw new Error(e);
-            }
-        }
-    }
-
-    /**
-     * An in-memory Java source file.
-     * It is able to extract the file name from simple source text using
-     * regular expressions.
-     */
-    public static class JavaSource extends SimpleJavaFileObject {
-        private final String source;
-
-        /**
-         * Creates a in-memory file object for Java source code.
-         * @param className the name of the class
-         * @param source the source text
-         */
-        public JavaSource(String className, String source) {
-            super(URI.create(className), JavaFileObject.Kind.SOURCE);
-            this.source = source;
-        }
-
-        /**
-         * Creates a in-memory file object for Java source code.
-         * The name of the class will be inferred from the source code.
-         * @param source the source text
-         */
-        public JavaSource(String source) {
-            super(URI.create(getJavaFileNameFromSource(source)),
-                    JavaFileObject.Kind.SOURCE);
-            this.source = source;
-        }
-
-        /**
-         * Writes the source code to a file in the current directory.
-         * @throws IOException if there is a problem writing the file
-         */
-        public void write() throws IOException {
-            write(currDir);
-        }
-
-        /**
-         * Writes the source code to a file in a specified directory.
-         * @param dir the directory
-         * @throws IOException if there is a problem writing the file
-         */
-        public void write(Path dir) throws IOException {
-            Path file = dir.resolve(getJavaFileNameFromSource(source));
-            Files.createDirectories(file.getParent());
-            try (BufferedWriter out = Files.newBufferedWriter(file)) {
-                out.write(source.replace("\n", lineSeparator));
-            }
-        }
-
-        @Override
-        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
-            return source;
-        }
-
-        private static Pattern modulePattern =
-                Pattern.compile("module\\s+((?:\\w+\\.)*)");
-        private static Pattern packagePattern =
-                Pattern.compile("package\\s+(((?:\\w+\\.)*)(?:\\w+))");
-        private static Pattern classPattern =
-                Pattern.compile("(?:public\\s+)?(?:class|enum|interface)\\s+(\\w+)");
-
-        /**
-         * Extracts the Java file name from the class declaration.
-         * This method is intended for simple files and uses regular expressions,
-         * so comments matching the pattern can make the method fail.
-         */
-        static String getJavaFileNameFromSource(String source) {
-            String packageName = null;
-
-            Matcher matcher = modulePattern.matcher(source);
-            if (matcher.find())
-                return "module-info.java";
-
-            matcher = packagePattern.matcher(source);
-            if (matcher.find())
-                packageName = matcher.group(1).replace(".", "/");
-
-            matcher = classPattern.matcher(source);
-            if (matcher.find()) {
-                String className = matcher.group(1) + ".java";
-                return (packageName == null) ? className : packageName + "/" + className;
-            } else if (packageName != null) {
-                return packageName + "/package-info.java";
-            } else {
-                throw new Error("Could not extract the java class " +
-                        "name from the provided source");
-            }
-        }
-    }
-
-    /**
-     * Extracts the Java file name from the class declaration.
-     * This method is intended for simple files and uses regular expressions,
-     * so comments matching the pattern can make the method fail.
-     * @deprecated This is a legacy method for compatibility with ToolBox v1.
-     *      Use {@link JavaSource#getName JavaSource.getName} instead.
-     * @param source the source text
-     * @return the Java file name inferred from the source
-     */
-    @Deprecated
-    public static String getJavaFileNameFromSource(String source) {
-        return JavaSource.getJavaFileNameFromSource(source);
-    }
-
-    /**
-     * A memory file manager, for saving generated files in memory.
-     * The file manager delegates to a separate file manager for listing and
-     * reading input files.
-     */
-    public static class MemoryFileManager extends ForwardingJavaFileManager {
-        private interface Content {
-            byte[] getBytes();
-            String getString();
-        }
-
-        /**
-         * Maps binary class names to generated content.
-         */
-        final Map<Location, Map<String, Content>> files;
-
-        /**
-         * Construct a memory file manager which stores output files in memory,
-         * and delegates to a default file manager for input files.
-         */
-        public MemoryFileManager() {
-            this(JavacTool.create().getStandardFileManager(null, null, null));
-        }
-
-        /**
-         * Construct a memory file manager which stores output files in memory,
-         * and delegates to a specified file manager for input files.
-         * @param fileManager the file manager to be used for input files
-         */
-        public MemoryFileManager(JavaFileManager fileManager) {
-            super(fileManager);
-            files = new HashMap<>();
-        }
-
-        @Override
-        public JavaFileObject getJavaFileForOutput(Location location,
-                                                   String name,
-                                                   JavaFileObject.Kind kind,
-                                                   FileObject sibling)
-        {
-            return new MemoryFileObject(location, name, kind);
-        }
-
-        /**
-         * Returns the content written to a file in a given location,
-         * or null if no such file has been written.
-         * @param location the location
-         * @param name the name of the file
-         * @return the content as an array of bytes
-         */
-        public byte[] getFileBytes(Location location, String name) {
-            Content content = getFile(location, name);
-            return (content == null) ? null : content.getBytes();
-        }
-
-        /**
-         * Returns the content written to a file in a given location,
-         * or null if no such file has been written.
-         * @param location the location
-         * @param name the name of the file
-         * @return the content as a string
-         */
-        public String getFileString(Location location, String name) {
-            Content content = getFile(location, name);
-            return (content == null) ? null : content.getString();
-        }
-
-        private Content getFile(Location location, String name) {
-            Map<String, Content> filesForLocation = files.get(location);
-            return (filesForLocation == null) ? null : filesForLocation.get(name);
-        }
-
-        private void save(Location location, String name, Content content) {
-            Map<String, Content> filesForLocation = files.get(location);
-            if (filesForLocation == null)
-                files.put(location, filesForLocation = new HashMap<>());
-            filesForLocation.put(name, content);
-        }
-
-        /**
-         * A writable file object stored in memory.
-         */
-        private class MemoryFileObject extends SimpleJavaFileObject {
-            private final Location location;
-            private final String name;
-
-            /**
-             * Constructs a memory file object.
-             * @param name binary name of the class to be stored in this file object
-             */
-            MemoryFileObject(Location location, String name, JavaFileObject.Kind kind) {
-                super(URI.create("mfm:///" + name.replace('.','/') + kind.extension),
-                      Kind.CLASS);
-                this.location = location;
-                this.name = name;
-            }
-
-            @Override
-            public OutputStream openOutputStream() {
-                return new FilterOutputStream(new ByteArrayOutputStream()) {
-                    @Override
-                    public void close() throws IOException {
-                        out.close();
-                        byte[] bytes = ((ByteArrayOutputStream) out).toByteArray();
-                        save(location, name, new Content() {
-                            @Override
-                            public byte[] getBytes() {
-                                return bytes;
-                            }
-                            @Override
-                            public String getString() {
-                                return new String(bytes);
-                            }
-
-                        });
-                    }
-                };
-            }
-
-            @Override
-            public Writer openWriter() {
-                return new FilterWriter(new StringWriter()) {
-                    @Override
-                    public void close() throws IOException {
-                        out.close();
-                        String text = ((StringWriter) out).toString();
-                        save(location, name, new Content() {
-                            @Override
-                            public byte[] getBytes() {
-                                return text.getBytes();
-                            }
-                            @Override
-                            public String getString() {
-                                return text;
-                            }
-
-                        });
-                    }
-                };
-            }
-        }
-
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/lib/toolbox/AbstractTask.java	Thu Mar 31 15:20:50 2016 -0700
@@ -0,0 +1,300 @@
+/*
+ * 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.
+ */
+
+package toolbox;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.Map;
+import static toolbox.ToolBox.lineSeparator;
+
+/**
+ * A utility base class to simplify the implementation of tasks.
+ * Provides support for running the task in a process and for
+ * capturing output written by the task to stdout, stderr and
+ * other writers where applicable.
+ * @param <T> the implementing subclass
+ */
+abstract class AbstractTask<T extends AbstractTask<T>> implements Task {
+    protected final ToolBox toolBox;
+    protected final Mode mode;
+    private final Map<OutputKind, String> redirects = new EnumMap<>(OutputKind.class);
+    private final Map<String, String> envVars = new HashMap<>();
+    private Expect expect = Expect.SUCCESS;
+    int expectedExitCode = 0;
+
+    /**
+     * Create a task that will execute in the specified mode.
+     * @param mode the mode
+     */
+    protected AbstractTask(ToolBox tb, Mode mode) {
+        toolBox = tb;
+        this.mode = mode;
+    }
+
+    /**
+     * Sets the expected outcome of the task and calls {@code run()}.
+     * @param expect the expected outcome
+     * @return the result of calling {@code run()}
+     */
+    public Result run(Expect expect) {
+        expect(expect, Integer.MIN_VALUE);
+        return run();
+    }
+
+    /**
+     * Sets the expected outcome of the task and calls {@code run()}.
+     * @param expect the expected outcome
+     * @param exitCode the expected exit code if the expected outcome
+     *      is {@code FAIL}
+     * @return the result of calling {@code run()}
+     */
+    public Result run(Expect expect, int exitCode) {
+        expect(expect, exitCode);
+        return run();
+    }
+
+    /**
+     * Sets the expected outcome and expected exit code of the task.
+     * The exit code will not be checked if the outcome is
+     * {@code Expect.SUCCESS} or if the exit code is set to
+     * {@code Integer.MIN_VALUE}.
+     * @param expect the expected outcome
+     * @param exitCode the expected exit code
+     */
+    protected void expect(Expect expect, int exitCode) {
+        this.expect = expect;
+        this.expectedExitCode = exitCode;
+    }
+
+    /**
+     * Checks the exit code contained in a {@code Result} against the
+     * expected outcome and exit value
+     * @param result the result object
+     * @return the result object
+     * @throws TaskError if the exit code stored in the result object
+     *      does not match the expected outcome and exit code.
+     */
+    protected Result checkExit(Result result) throws TaskError {
+        switch (expect) {
+            case SUCCESS:
+                if (result.exitCode != 0) {
+                    result.writeAll();
+                    throw new TaskError("Task " + name() + " failed: rc=" + result.exitCode);
+                }
+                break;
+
+            case FAIL:
+                if (result.exitCode == 0) {
+                    result.writeAll();
+                    throw new TaskError("Task " + name() + " succeeded unexpectedly");
+                }
+
+                if (expectedExitCode != Integer.MIN_VALUE
+                        && result.exitCode != expectedExitCode) {
+                    result.writeAll();
+                    throw new TaskError("Task " + name() + "failed with unexpected exit code "
+                        + result.exitCode + ", expected " + expectedExitCode);
+                }
+                break;
+        }
+        return result;
+    }
+
+    /**
+     * Sets an environment variable to be used by this task.
+     * @param name the name of the environment variable
+     * @param value the value for the environment variable
+     * @return this task object
+     * @throws IllegalStateException if the task mode is not {@code EXEC}
+     */
+    public T envVar(String name, String value) {
+        if (mode != Mode.EXEC)
+            throw new IllegalStateException();
+        envVars.put(name, value);
+        return (T) this;
+    }
+
+    /**
+     * Redirects output from an output stream to a file.
+     * @param outputKind the name of the stream to be redirected.
+     * @param path the file
+     * @return this task object
+     * @throws IllegalStateException if the task mode is not {@code EXEC}
+     */
+    public T redirect(OutputKind outputKind, String path) {
+        if (mode != Mode.EXEC)
+            throw new IllegalStateException();
+        redirects.put(outputKind, path);
+        return (T) this;
+    }
+
+    /**
+     * Returns a {@code ProcessBuilder} initialized with any
+     * redirects and environment variables that have been set.
+     * @return a {@code ProcessBuilder}
+     */
+    protected ProcessBuilder getProcessBuilder() {
+        if (mode != Mode.EXEC)
+            throw new IllegalStateException();
+        ProcessBuilder pb = new ProcessBuilder();
+        if (redirects.get(OutputKind.STDOUT) != null)
+            pb.redirectOutput(new File(redirects.get(OutputKind.STDOUT)));
+        if (redirects.get(OutputKind.STDERR) != null)
+            pb.redirectError(new File(redirects.get(OutputKind.STDERR)));
+        pb.environment().putAll(envVars);
+        return pb;
+    }
+
+    /**
+     * Collects the output from a process and saves it in a {@code Result}.
+     * @param tb the {@code ToolBox} containing the task {@code t}
+     * @param t the task initiating the process
+     * @param p the process
+     * @return a Result object containing the output from the process and its
+     *      exit value.
+     * @throws InterruptedException if the thread is interrupted
+     */
+    protected Result runProcess(ToolBox tb, Task t, Process p) throws InterruptedException {
+        if (mode != Mode.EXEC)
+            throw new IllegalStateException();
+        ProcessOutput sysOut = new ProcessOutput(p.getInputStream()).start();
+        ProcessOutput sysErr = new ProcessOutput(p.getErrorStream()).start();
+        sysOut.waitUntilDone();
+        sysErr.waitUntilDone();
+        int rc = p.waitFor();
+        Map<OutputKind, String> outputMap = new EnumMap<>(OutputKind.class);
+        outputMap.put(OutputKind.STDOUT, sysOut.getOutput());
+        outputMap.put(OutputKind.STDERR, sysErr.getOutput());
+        return checkExit(new Result(toolBox, t, rc, outputMap));
+    }
+
+    /**
+     * Thread-friendly class to read the output from a process until the stream
+     * is exhausted.
+     */
+    static class ProcessOutput implements Runnable {
+        ProcessOutput(InputStream from) {
+            in = new BufferedReader(new InputStreamReader(from));
+            out = new StringBuilder();
+        }
+
+        ProcessOutput start() {
+            new Thread(this).start();
+            return this;
+        }
+
+        @Override
+        public void run() {
+            try {
+                String line;
+                while ((line = in.readLine()) != null) {
+                    out.append(line).append(lineSeparator);
+                }
+            } catch (IOException e) {
+            }
+            synchronized (this) {
+                done = true;
+                notifyAll();
+            }
+        }
+
+        synchronized void waitUntilDone() throws InterruptedException {
+            boolean interrupted = false;
+
+            // poll interrupted flag, while waiting for copy to complete
+            while (!(interrupted = Thread.interrupted()) && !done)
+                wait(1000);
+
+            if (interrupted)
+                throw new InterruptedException();
+        }
+
+        String getOutput() {
+            return out.toString();
+        }
+
+        private final BufferedReader in;
+        private final StringBuilder out;
+        private boolean done;
+    }
+
+    /**
+     * Utility class to simplify the handling of temporarily setting a
+     * new stream for System.out or System.err.
+     */
+    static class StreamOutput {
+        // Functional interface to set a stream.
+        // Expected use: System::setOut, System::setErr
+        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;
+        }
+
+        /**
+         * Closes the stream and returns the contents that were written to it.
+         * @return the contents that were written to it.
+         */
+        String close() {
+            init.set(prev);
+            ps.close();
+            return baos.toString();
+        }
+    }
+
+    /**
+     * Utility class to simplify the handling of creating an in-memory PrintWriter.
+     */
+    static class WriterOutput {
+        private final StringWriter sw = new StringWriter();
+        final PrintWriter pw = new PrintWriter(sw);
+
+        /**
+         * Closes the stream and returns the contents that were written to it.
+         * @return the contents that were written to it.
+         */
+        String close() {
+            pw.close();
+            return sw.toString();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/lib/toolbox/ExecTask.java	Thu Mar 31 15:20:50 2016 -0700
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ */
+
+package toolbox;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * A task to configure and run a general command.
+ */
+public class ExecTask extends AbstractTask<ExecTask> {
+    private final String command;
+    private List<String> args;
+
+    /**
+     * Create a task to execute a given command, to be run using {@code EXEC} mode.
+     * @param toolBox the {@code ToolBox} to use
+     * @param command the command to be executed
+     */
+    public ExecTask(ToolBox toolBox, String command) {
+        super(toolBox, Task.Mode.EXEC);
+        this.command = command;
+    }
+
+    /**
+     * Create a task to execute a given command, to be run using {@code EXEC} mode.
+     * @param toolBox the {@code ToolBox} to use
+     * @param command the command to be executed
+     */
+    public ExecTask(ToolBox toolBox, Path command) {
+        super(toolBox, Task.Mode.EXEC);
+        this.command = command.toString();
+    }
+
+    /**
+     * Sets the arguments for the command to be executed
+     * @param args the arguments
+     * @return this task object
+     */
+    public ExecTask args(String... args) {
+        this.args = Arrays.asList(args);
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     * @return the name "exec"
+     */
+    @Override
+    public String name() {
+        return "exec";
+    }
+
+    /**
+     * Calls the command with the arguments as currently configured.
+     * @return a Result object indicating the outcome of the task
+     * and the content of any output written to stdout or stderr.
+     * @throws TaskError if the outcome of the task is not as expected.
+     */
+    @Override
+    public Task.Result run() {
+        List<String> cmdArgs = new ArrayList<>();
+        cmdArgs.add(command);
+        if (args != null)
+            cmdArgs.addAll(args);
+        ProcessBuilder pb = getProcessBuilder();
+        pb.command(cmdArgs);
+        try {
+            return runProcess(toolBox, this, pb.start());
+        } catch (IOException | InterruptedException e) {
+            throw new Error(e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/lib/toolbox/JarTask.java	Thu Mar 31 15:20:50 2016 -0700
@@ -0,0 +1,423 @@
+/*
+ * 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.
+ */
+
+package toolbox;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOError;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import javax.tools.FileObject;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import static toolbox.ToolBox.currDir;
+
+/**
+ * A task to configure and run the jar file utility.
+ */
+public class JarTask extends AbstractTask<JarTask> {
+    private Path jar;
+    private Manifest manifest;
+    private String classpath;
+    private String mainClass;
+    private Path baseDir;
+    private List<Path> paths;
+    private Set<FileObject> fileObjects;
+
+    /**
+     * Creates a task to write jar files, using API mode.
+     * @param toolBox the {@code ToolBox} to use
+     */
+    public JarTask(ToolBox toolBox) {
+        super(toolBox, Task.Mode.API);
+        paths = Collections.emptyList();
+        fileObjects = new LinkedHashSet<>();
+    }
+
+    /**
+     * Creates a JarTask for use with a given jar file.
+     * @param toolBox the {@code ToolBox} to use
+     * @param path the file
+     */
+    public JarTask(ToolBox toolBox, String path) {
+        this(toolBox);
+        jar = Paths.get(path);
+    }
+
+    /**
+     * Creates a JarTask for use with a given jar file.
+     * @param toolBox the {@code ToolBox} to use
+     * @param path the file
+     */
+    public JarTask(ToolBox toolBox, Path path) {
+        this(toolBox);
+        jar = path;
+    }
+
+    /**
+     * Sets a manifest for the jar file.
+     * @param manifest the manifest
+     * @return this task object
+     */
+    public JarTask manifest(Manifest manifest) {
+        this.manifest = manifest;
+        return this;
+    }
+
+    /**
+     * Sets a manifest for the jar file.
+     * @param manifest a string containing the contents of the manifest
+     * @return this task object
+     * @throws IOException if there is a problem creating the manifest
+     */
+    public JarTask manifest(String manifest) throws IOException {
+        this.manifest = new Manifest(new ByteArrayInputStream(manifest.getBytes()));
+        return this;
+    }
+
+    /**
+     * Sets the classpath to be written to the {@code Class-Path}
+     * entry in the manifest.
+     * @param classpath the classpath
+     * @return this task object
+     */
+    public JarTask classpath(String classpath) {
+        this.classpath = classpath;
+        return this;
+    }
+
+    /**
+     * Sets the class to be written to the {@code Main-Class}
+     * entry in the manifest..
+     * @param mainClass the name of the main class
+     * @return this task object
+     */
+    public JarTask mainClass(String mainClass) {
+        this.mainClass = mainClass;
+        return this;
+    }
+
+    /**
+     * Sets the base directory for files to be written into the jar file.
+     * @param baseDir the base directory
+     * @return this task object
+     */
+    public JarTask baseDir(String baseDir) {
+        this.baseDir = Paths.get(baseDir);
+        return this;
+    }
+
+    /**
+     * Sets the base directory for files to be written into the jar file.
+     * @param baseDir the base directory
+     * @return this task object
+     */
+    public JarTask baseDir(Path baseDir) {
+        this.baseDir = baseDir;
+        return this;
+    }
+
+    /**
+     * Sets the files to be written into the jar file.
+     * @param files the files
+     * @return this task object
+     */
+    public JarTask files(String... files) {
+        this.paths = Stream.of(files)
+                .map(file -> Paths.get(file))
+                .collect(Collectors.toList());
+        return this;
+    }
+
+    /**
+     * Adds a set of file objects to be written into the jar file, by copying them
+     * from a Location in a JavaFileManager.
+     * The file objects to be written are specified by a series of paths;
+     * each path can be in one of the following forms:
+     * <ul>
+     * <li>The name of a class. For example, java.lang.Object.
+     * In this case, the corresponding .class file will be written to the jar file.
+     * <li>the name of a package followed by {@code .*}. For example, {@code java.lang.*}.
+     * In this case, all the class files in the specified package will be written to
+     * the jar file.
+     * <li>the name of a package followed by {@code .**}. For example, {@code java.lang.**}.
+     * In this case, all the class files in the specified package, and any subpackages
+     * will be written to the jar file.
+     * </ul>
+     *
+     * @param fm the file manager in which to find the file objects
+     * @param l  the location in which to find the file objects
+     * @param paths the paths specifying the file objects to be copied
+     * @return this task object
+     * @throws IOException if errors occur while determining the set of file objects
+     */
+    public JarTask files(JavaFileManager fm, JavaFileManager.Location l, String... paths)
+            throws IOException {
+        for (String p : paths) {
+            if (p.endsWith(".**"))
+                addPackage(fm, l, p.substring(0, p.length() - 3), true);
+            else if (p.endsWith(".*"))
+                addPackage(fm, l, p.substring(0, p.length() - 2), false);
+            else
+                addFile(fm, l, p);
+        }
+        return this;
+    }
+
+    private void addPackage(JavaFileManager fm, JavaFileManager.Location l, String pkg, boolean recurse)
+            throws IOException {
+        for (JavaFileObject fo : fm.list(l, pkg, EnumSet.allOf(JavaFileObject.Kind.class), recurse)) {
+            fileObjects.add(fo);
+        }
+    }
+
+    private void addFile(JavaFileManager fm, JavaFileManager.Location l, String path) throws IOException {
+        JavaFileObject fo = fm.getJavaFileForInput(l, path, JavaFileObject.Kind.CLASS);
+        fileObjects.add(fo);
+    }
+
+    /**
+     * Provides limited jar command-like functionality.
+     * The supported commands are:
+     * <ul>
+     * <li> jar cf jarfile -C dir files...
+     * <li> jar cfm jarfile manifestfile -C dir files...
+     * </ul>
+     * Any values specified by other configuration methods will be ignored.
+     * @param args arguments in the style of those for the jar command
+     * @return a Result object containing the results of running the task
+     */
+    public Task.Result run(String... args) {
+        if (args.length < 2)
+            throw new IllegalArgumentException();
+
+        ListIterator<String> iter = Arrays.asList(args).listIterator();
+        String first = iter.next();
+        switch (first) {
+            case "cf":
+                jar = Paths.get(iter.next());
+                break;
+            case "cfm":
+                jar = Paths.get(iter.next());
+                try (InputStream in = Files.newInputStream(Paths.get(iter.next()))) {
+                    manifest = new Manifest(in);
+                } catch (IOException e) {
+                    throw new IOError(e);
+                }
+                break;
+        }
+
+        if (iter.hasNext()) {
+            if (iter.next().equals("-C"))
+                baseDir = Paths.get(iter.next());
+            else
+                iter.previous();
+        }
+
+        paths = new ArrayList<>();
+        while (iter.hasNext())
+            paths.add(Paths.get(iter.next()));
+
+        return run();
+    }
+
+    /**
+     * {@inheritDoc}
+     * @return the name "jar"
+     */
+    @Override
+    public String name() {
+        return "jar";
+    }
+
+    /**
+     * Creates a jar file with the arguments as currently configured.
+     * @return a Result object indicating the outcome of the compilation
+     * and the content of any output written to stdout, stderr, or the
+     * main stream by the compiler.
+     * @throws TaskError if the outcome of the task is not as expected.
+     */
+    @Override
+    public Task.Result run() {
+        Manifest m = (manifest == null) ? new Manifest() : manifest;
+        Attributes mainAttrs = m.getMainAttributes();
+        if (mainClass != null)
+            mainAttrs.put(Attributes.Name.MAIN_CLASS, mainClass);
+        if (classpath != null)
+            mainAttrs.put(Attributes.Name.CLASS_PATH, classpath);
+
+        AbstractTask.StreamOutput sysOut = new AbstractTask.StreamOutput(System.out, System::setOut);
+        AbstractTask.StreamOutput sysErr = new AbstractTask.StreamOutput(System.err, System::setErr);
+
+        Map<Task.OutputKind, String> outputMap = new HashMap<>();
+
+        try (OutputStream os = Files.newOutputStream(jar);
+                JarOutputStream jos = openJar(os, m)) {
+            writeFiles(jos);
+            writeFileObjects(jos);
+        } catch (IOException e) {
+            error("Exception while opening " + jar, e);
+        } finally {
+            outputMap.put(Task.OutputKind.STDOUT, sysOut.close());
+            outputMap.put(Task.OutputKind.STDERR, sysErr.close());
+        }
+        return checkExit(new Task.Result(toolBox, this, (errors == 0) ? 0 : 1, outputMap));
+    }
+
+    private JarOutputStream openJar(OutputStream os, Manifest m) throws IOException {
+        if (m == null || m.getMainAttributes().isEmpty() && m.getEntries().isEmpty()) {
+            return new JarOutputStream(os);
+        } else {
+            if (m.getMainAttributes().get(Attributes.Name.MANIFEST_VERSION) == null)
+                m.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
+            return new JarOutputStream(os, m);
+        }
+    }
+
+    private void writeFiles(JarOutputStream jos) throws IOException {
+            Path base = (baseDir == null) ? currDir : baseDir;
+            for (Path path : paths) {
+                Files.walkFileTree(base.resolve(path), new SimpleFileVisitor<Path>() {
+                    @Override
+                    public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
+                        try {
+                        String p = base.relativize(file)
+                                .normalize()
+                                .toString()
+                                .replace(File.separatorChar, '/');
+                        JarEntry e = new JarEntry(p);
+                            jos.putNextEntry(e);
+                        try {
+                            jos.write(Files.readAllBytes(file));
+                        } finally {
+                            jos.closeEntry();
+                        }
+                            return FileVisitResult.CONTINUE;
+                        } catch (IOException e) {
+                        error("Exception while adding " + file + " to jar file", e);
+                            return FileVisitResult.TERMINATE;
+                        }
+                    }
+                });
+            }
+    }
+
+    private void writeFileObjects(JarOutputStream jos) throws IOException {
+        for (FileObject fo : fileObjects) {
+            String p = guessPath(fo);
+            JarEntry e = new JarEntry(p);
+            jos.putNextEntry(e);
+            try {
+                byte[] buf = new byte[1024];
+                try (BufferedInputStream in = new BufferedInputStream(fo.openInputStream())) {
+                    int n;
+                    while ((n = in.read(buf)) > 0)
+                        jos.write(buf, 0, n);
+                } catch (IOException ex) {
+                    error("Exception while adding " + fo.getName() + " to jar file", ex);
+                }
+        } finally {
+                jos.closeEntry();
+        }
+        }
+    }
+
+    /*
+     * A jar: URL is of the form  jar:URL!/<entry>  where URL is a URL for the .jar file itself.
+     * In Symbol files (i.e. ct.sym) the underlying entry is prefixed META-INF/sym/<base>.
+     */
+    private final Pattern jarEntry = Pattern.compile(".*!/(?:META-INF/sym/[^/]+/)?(.*)");
+
+    /*
+     * A jrt: URL is of the form  jrt:/modules/<module>/<package>/<file>
+     */
+    private final Pattern jrtEntry = Pattern.compile("/modules/([^/]+)/(.*)");
+
+    /*
+     * A file: URL is of the form  file:/path/to/{modules,patches}/<module>/<package>/<file>
+     */
+    private final Pattern fileEntry = Pattern.compile(".*/(?:modules|patches)/([^/]+)/(.*)");
+
+    private String guessPath(FileObject fo) {
+        URI u = fo.toUri();
+        switch (u.getScheme()) {
+            case "jar": {
+                Matcher m = jarEntry.matcher(u.getSchemeSpecificPart());
+                if (m.matches()) {
+                    return m.group(1);
+                }
+                break;
+            }
+            case "jrt": {
+                Matcher m = jrtEntry.matcher(u.getSchemeSpecificPart());
+                if (m.matches()) {
+                    return m.group(2);
+                }
+                break;
+            }
+            case "file": {
+                Matcher m = fileEntry.matcher(u.getSchemeSpecificPart());
+                if (m.matches()) {
+                    return m.group(2);
+                }
+                break;
+            }
+        }
+        throw new IllegalArgumentException(fo.getName() + "--" + fo.toUri());
+    }
+
+    private void error(String message, Throwable t) {
+        toolBox.out.println("Error: " + message + ": " + t);
+        errors++;
+    }
+
+    private int errors;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/lib/toolbox/JavaTask.java	Thu Mar 31 15:20:50 2016 -0700
@@ -0,0 +1,144 @@
+/*
+ * 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.
+ */
+
+package toolbox;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * A task to configure and run the Java launcher.
+ */
+public class JavaTask extends AbstractTask<JavaTask> {
+    boolean includeStandardOptions = true;
+    private String classpath;
+    private List<String> vmOptions;
+    private String className;
+    private List<String> classArgs;
+
+    /**
+     * Create a task to run the Java launcher, using {@code EXEC} mode.
+     * @param toolBox the {@code ToolBox} to use
+     */
+    public JavaTask(ToolBox toolBox) {
+        super(toolBox, Task.Mode.EXEC);
+    }
+
+    /**
+     * Sets the classpath.
+     * @param classpath the classpath
+     * @return this task object
+     */
+    public JavaTask classpath(String classpath) {
+        this.classpath = classpath;
+        return this;
+    }
+
+    /**
+     * Sets the VM options.
+     * @param vmOptions the options
+     * @return this task object
+     */
+    public JavaTask vmOptions(String... vmOptions) {
+        this.vmOptions = Arrays.asList(vmOptions);
+        return this;
+    }
+
+    /**
+     * Sets the name of the class to be executed.
+     * @param className the name of the class
+     * @return this task object
+     */
+    public JavaTask className(String className) {
+        this.className = className;
+        return this;
+    }
+
+    /**
+     * Sets the arguments for the class to be executed.
+     * @param classArgs the arguments
+     * @return this task object
+     */
+    public JavaTask classArgs(String... classArgs) {
+        this.classArgs = Arrays.asList(classArgs);
+        return this;
+    }
+
+    /**
+     * Sets whether or not the standard VM and java options for the test should be passed
+     * to the new VM instance. If this method is not called, the default behavior is that
+     * the options will be passed to the new VM instance.
+     *
+     * @param includeStandardOptions whether or not the standard VM and java options for
+     *                               the test should be passed to the new VM instance.
+     * @return this task object
+     */
+    public JavaTask includeStandardOptions(boolean includeStandardOptions) {
+        this.includeStandardOptions = includeStandardOptions;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     * @return the name "java"
+     */
+    @Override
+    public String name() {
+        return "java";
+    }
+
+    /**
+     * Calls the Java launcher with the arguments as currently configured.
+     * @return a Result object indicating the outcome of the task
+     * and the content of any output written to stdout or stderr.
+     * @throws TaskError if the outcome of the task is not as expected.
+     */
+    @Override
+    public Task.Result run() {
+        List<String> args = new ArrayList<>();
+        args.add(toolBox.getJDKTool("java").toString());
+        if (includeStandardOptions) {
+            args.addAll(toolBox.split(System.getProperty("test.vm.opts"), " +"));
+            args.addAll(toolBox.split(System.getProperty("test.java.opts"), " +"));
+        }
+        if (classpath != null) {
+            args.add("-classpath");
+            args.add(classpath);
+        }
+        if (vmOptions != null)
+            args.addAll(vmOptions);
+        if (className != null)
+            args.add(className);
+        if (classArgs != null)
+            args.addAll(classArgs);
+        ProcessBuilder pb = getProcessBuilder();
+        pb.command(args);
+        try {
+            return runProcess(toolBox, this, pb.start());
+        } catch (IOException | InterruptedException e) {
+            throw new Error(e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/lib/toolbox/JavacTask.java	Thu Mar 31 15:20:50 2016 -0700
@@ -0,0 +1,376 @@
+/*
+ * 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.
+ */
+
+package toolbox;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.api.JavacTool;
+
+/**
+ * A task to configure and run the Java compiler, javac.
+ */
+public class JavacTask extends AbstractTask<JavacTask> {
+    private boolean includeStandardOptions;
+    private List<Path> classpath;
+    private List<Path> sourcepath;
+    private Path outdir;
+    private List<String> options;
+    private List<String> classes;
+    private List<String> files;
+    private List<JavaFileObject> fileObjects;
+    private JavaFileManager fileManager;
+
+    private JavaCompiler compiler;
+    private StandardJavaFileManager internalFileManager;
+
+    /**
+     * Creates a task to execute {@code javac} using API mode.
+     * @param toolBox the {@code ToolBox} to use
+     */
+    public JavacTask(ToolBox toolBox) {
+        super(toolBox, Task.Mode.API);
+    }
+
+    /**
+     * Creates a task to execute {@code javac} in a specified mode.
+     * @param toolBox the {@code ToolBox} to use
+     * @param mode the mode to be used
+     */
+    public JavacTask(ToolBox toolBox, Task.Mode mode) {
+        super(toolBox, mode);
+    }
+
+    /**
+     * Sets the classpath.
+     * @param classpath the classpath
+     * @return this task object
+     */
+    public JavacTask classpath(String classpath) {
+        this.classpath = Stream.of(classpath.split(File.pathSeparator))
+                .filter(s -> !s.isEmpty())
+                .map(s -> Paths.get(s))
+                .collect(Collectors.toList());
+        return this;
+    }
+
+    /**
+     * Sets the classpath.
+     * @param classpath the classpath
+     * @return this task object
+     */
+    public JavacTask classpath(Path... classpath) {
+        this.classpath = Arrays.asList(classpath);
+        return this;
+    }
+
+    /**
+     * Sets the sourcepath.
+     * @param sourcepath the sourcepath
+     * @return this task object
+     */
+    public JavacTask sourcepath(String sourcepath) {
+        this.sourcepath = Stream.of(sourcepath.split(File.pathSeparator))
+                .filter(s -> !s.isEmpty())
+                .map(s -> Paths.get(s))
+                .collect(Collectors.toList());
+        return this;
+    }
+
+    /**
+     * Sets the sourcepath.
+     * @param sourcepath the sourcepath
+     * @return this task object
+     */
+    public JavacTask sourcepath(Path... sourcepath) {
+        this.sourcepath = Arrays.asList(sourcepath);
+        return this;
+    }
+
+    /**
+     * Sets the output directory.
+     * @param outdir the output directory
+     * @return this task object
+     */
+    public JavacTask outdir(String outdir) {
+        this.outdir = Paths.get(outdir);
+        return this;
+    }
+
+    /**
+     * Sets the output directory.
+     * @param outdir the output directory
+     * @return this task object
+     */
+    public JavacTask outdir(Path outdir) {
+        this.outdir = outdir;
+        return this;
+    }
+
+    /**
+     * Sets the options.
+     * @param options the options
+     * @return this task object
+     */
+    public JavacTask options(String... options) {
+        this.options = Arrays.asList(options);
+        return this;
+    }
+
+    /**
+     * Sets the classes to be analyzed.
+     * @param classes the classes
+     * @return this task object
+     */
+    public JavacTask classes(String... classes) {
+        this.classes = Arrays.asList(classes);
+        return this;
+    }
+
+    /**
+     * Sets the files to be compiled or analyzed.
+     * @param files the files
+     * @return this task object
+     */
+    public JavacTask files(String... files) {
+        this.files = Arrays.asList(files);
+        return this;
+    }
+
+    /**
+     * Sets the files to be compiled or analyzed.
+     * @param files the files
+     * @return this task object
+     */
+    public JavacTask files(Path... files) {
+        this.files = Stream.of(files)
+                .map(Path::toString)
+                .collect(Collectors.toList());
+        return this;
+    }
+
+    /**
+     * Sets the sources to be compiled or analyzed.
+     * Each source string is converted into an in-memory object that
+     * can be passed directly to the compiler.
+     * @param sources the sources
+     * @return this task object
+     */
+    public JavacTask sources(String... sources) {
+        fileObjects = Stream.of(sources)
+                .map(s -> new ToolBox.JavaSource(s))
+                .collect(Collectors.toList());
+        return this;
+    }
+
+    /**
+     * Sets the file manager to be used by this task.
+     * @param fileManager the file manager
+     * @return this task object
+     */
+    public JavacTask fileManager(JavaFileManager fileManager) {
+        this.fileManager = fileManager;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     * @return the name "javac"
+     */
+    @Override
+    public String name() {
+        return "javac";
+    }
+
+    /**
+     * Calls the compiler with the arguments as currently configured.
+     * @return a Result object indicating the outcome of the compilation
+     * and the content of any output written to stdout, stderr, or the
+     * main stream by the compiler.
+     * @throws TaskError if the outcome of the task is not as expected.
+     */
+    @Override
+    public Task.Result run() {
+        if (mode == Task.Mode.EXEC)
+            return runExec();
+
+        AbstractTask.WriterOutput direct = new AbstractTask.WriterOutput();
+        // The following are to catch output to System.out and System.err,
+        // in case these are used instead of the primary (main) stream
+        AbstractTask.StreamOutput sysOut = new AbstractTask.StreamOutput(System.out, System::setOut);
+        AbstractTask.StreamOutput sysErr = new AbstractTask.StreamOutput(System.err, System::setErr);
+        int rc;
+        Map<Task.OutputKind, String> outputMap = new HashMap<>();
+        try {
+            switch (mode == null ? Task.Mode.API : mode) {
+                case API:
+                    rc = runAPI(direct.pw);
+                    break;
+                case CMDLINE:
+                    rc = runCommand(direct.pw);
+                    break;
+                default:
+                    throw new IllegalStateException();
+            }
+        } catch (IOException e) {
+            toolBox.out.println("Exception occurred: " + e);
+            rc = 99;
+        } finally {
+            outputMap.put(Task.OutputKind.STDOUT, sysOut.close());
+            outputMap.put(Task.OutputKind.STDERR, sysErr.close());
+            outputMap.put(Task.OutputKind.DIRECT, direct.close());
+        }
+        return checkExit(new Task.Result(toolBox, this, rc, outputMap));
+    }
+
+    private int runAPI(PrintWriter pw) throws IOException {
+        try {
+//                if (compiler == null) {
+                // TODO: allow this to be set externally
+//                    compiler = ToolProvider.getSystemJavaCompiler();
+                compiler = JavacTool.create();
+//                }
+
+            if (fileManager == null)
+                fileManager = internalFileManager = compiler.getStandardFileManager(null, null, null);
+            if (outdir != null)
+                setLocationFromPaths(StandardLocation.CLASS_OUTPUT, Collections.singletonList(outdir));
+            if (classpath != null)
+                setLocationFromPaths(StandardLocation.CLASS_PATH, classpath);
+            if (sourcepath != null)
+                setLocationFromPaths(StandardLocation.SOURCE_PATH, sourcepath);
+            List<String> allOpts = new ArrayList<>();
+            if (options != null)
+                allOpts.addAll(options);
+
+            Iterable<? extends JavaFileObject> allFiles = joinFiles(files, fileObjects);
+            JavaCompiler.CompilationTask task = compiler.getTask(pw,
+                    fileManager,
+                    null,  // diagnostic listener; should optionally collect diags
+                    allOpts,
+                    classes,
+                    allFiles);
+            return ((JavacTaskImpl) task).doCall().exitCode;
+        } finally {
+            if (internalFileManager != null)
+                internalFileManager.close();
+        }
+    }
+
+    private void setLocationFromPaths(StandardLocation location, List<Path> files) throws IOException {
+        if (!(fileManager instanceof StandardJavaFileManager))
+            throw new IllegalStateException("not a StandardJavaFileManager");
+        ((StandardJavaFileManager) fileManager).setLocationFromPaths(location, files);
+    }
+
+    private int runCommand(PrintWriter pw) {
+        List<String> args = getAllArgs();
+        String[] argsArray = args.toArray(new String[args.size()]);
+        return com.sun.tools.javac.Main.compile(argsArray, pw);
+    }
+
+    private Task.Result runExec() {
+        List<String> args = new ArrayList<>();
+        Path javac = toolBox.getJDKTool("javac");
+        args.add(javac.toString());
+        if (includeStandardOptions) {
+            args.addAll(toolBox.split(System.getProperty("test.tool.vm.opts"), " +"));
+            args.addAll(toolBox.split(System.getProperty("test.compiler.opts"), " +"));
+        }
+        args.addAll(getAllArgs());
+
+        String[] argsArray = args.toArray(new String[args.size()]);
+        ProcessBuilder pb = getProcessBuilder();
+        pb.command(argsArray);
+        try {
+            return runProcess(toolBox, this, pb.start());
+        } catch (IOException | InterruptedException e) {
+            throw new Error(e);
+        }
+    }
+
+    private List<String> getAllArgs() {
+        List<String> args = new ArrayList<>();
+        if (options != null)
+            args.addAll(options);
+        if (outdir != null) {
+            args.add("-d");
+            args.add(outdir.toString());
+        }
+        if (classpath != null) {
+            args.add("-classpath");
+            args.add(toSearchPath(classpath));
+        }
+        if (sourcepath != null) {
+            args.add("-sourcepath");
+            args.add(toSearchPath(sourcepath));
+        }
+        if (classes != null)
+            args.addAll(classes);
+        if (files != null)
+            args.addAll(files);
+
+        return args;
+    }
+
+    private String toSearchPath(List<Path> files) {
+        return files.stream()
+            .map(Path::toString)
+            .collect(Collectors.joining(File.pathSeparator));
+    }
+
+    private Iterable<? extends JavaFileObject> joinFiles(
+            List<String> files, List<JavaFileObject> fileObjects) {
+        if (files == null)
+            return fileObjects;
+        if (internalFileManager == null)
+            internalFileManager = compiler.getStandardFileManager(null, null, null);
+        Iterable<? extends JavaFileObject> filesAsFileObjects =
+                internalFileManager.getJavaFileObjectsFromStrings(files);
+        if (fileObjects == null)
+            return filesAsFileObjects;
+        List<JavaFileObject> combinedList = new ArrayList<>();
+        for (JavaFileObject o : filesAsFileObjects)
+            combinedList.add(o);
+        combinedList.addAll(fileObjects);
+        return combinedList;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/lib/toolbox/JavahTask.java	Thu Mar 31 15:20:50 2016 -0700
@@ -0,0 +1,122 @@
+/*
+ * 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.
+ */
+
+package toolbox;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A task to configure and run the native header tool, javah.
+ */
+public class JavahTask extends AbstractTask<JavahTask> {
+    private String classpath;
+    private List<String> options;
+    private List<String> classes;
+
+    /**
+     * Create a task to execute {@code javah} using {@code CMDLINE} mode.
+     * @param toolBox the {@code ToolBox} to use
+     */
+    public JavahTask(ToolBox toolBox) {
+        super(toolBox, Task.Mode.CMDLINE);
+    }
+
+    /**
+     * Sets the classpath.
+     * @param classpath the classpath
+     * @return this task object
+     */
+    public JavahTask classpath(String classpath) {
+        this.classpath = classpath;
+        return this;
+    }
+
+    /**
+     * Sets the options.
+     * @param options the options
+     * @return this task object
+     */
+    public JavahTask options(String... options) {
+        this.options = Arrays.asList(options);
+        return this;
+    }
+
+    /**
+     * Sets the classes to be analyzed.
+     * @param classes the classes
+     * @return this task object
+     */
+    public JavahTask classes(String... classes) {
+        this.classes = Arrays.asList(classes);
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     * @return the name "javah"
+     */
+    @Override
+    public String name() {
+        return "javah";
+    }
+
+    /**
+     * Calls the javah tool with the arguments as currently configured.
+     * @return a Result object indicating the outcome of the task
+     * and the content of any output written to stdout, stderr, or the
+     * main stream provided to the task.
+     * @throws TaskError if the outcome of the task is not as expected.
+     */
+    @Override
+    public Task.Result run() {
+        List<String> args = new ArrayList<>();
+        if (options != null)
+            args.addAll(options);
+        if (classpath != null) {
+            args.add("-classpath");
+            args.add(classpath);
+        }
+        if (classes != null)
+            args.addAll(classes);
+
+        AbstractTask.WriterOutput direct = new AbstractTask.WriterOutput();
+        // These are to catch output to System.out and System.err,
+        // in case these are used instead of the primary streams
+        AbstractTask.StreamOutput sysOut = new AbstractTask.StreamOutput(System.out, System::setOut);
+        AbstractTask.StreamOutput sysErr = new AbstractTask.StreamOutput(System.err, System::setErr);
+        int rc;
+        Map<Task.OutputKind, String> outputMap = new HashMap<>();
+        try {
+            rc = com.sun.tools.javah.Main.run(args.toArray(new String[args.size()]), direct.pw);
+        } finally {
+            outputMap.put(Task.OutputKind.STDOUT, sysOut.close());
+            outputMap.put(Task.OutputKind.STDERR, sysErr.close());
+            outputMap.put(Task.OutputKind.DIRECT, direct.close());
+        }
+        return checkExit(new Task.Result(toolBox, this, rc, outputMap));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/lib/toolbox/JavapTask.java	Thu Mar 31 15:20:50 2016 -0700
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+
+package toolbox;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A task to configure and run the disassembler tool, javap.
+ */
+public class JavapTask extends AbstractTask<JavapTask> {
+    private String classpath;
+    private List<String> options;
+    private List<String> classes;
+
+    /**
+     * Create a task to execute {@code javap} using {@code CMDLINE} mode.
+     * @param toolBox the {@code ToolBox} to use
+     */
+    public JavapTask(ToolBox toolBox) {
+        super(toolBox, Task.Mode.CMDLINE);
+    }
+
+    /**
+     * Sets the classpath.
+     * @param classpath the classpath
+     * @return this task object
+     */
+    public JavapTask classpath(String classpath) {
+        this.classpath = classpath;
+        return this;
+    }
+
+    /**
+     * Sets the options.
+     * @param options the options
+     * @return this task object
+     */
+    public JavapTask options(String... options) {
+        this.options = Arrays.asList(options);
+        return this;
+    }
+
+    /**
+     * Sets the classes to be analyzed.
+     * @param classes the classes
+     * @return this task object
+     */
+    public JavapTask classes(String... classes) {
+        this.classes = Arrays.asList(classes);
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     * @return the name "javap"
+     */
+    @Override
+    public String name() {
+        return "javap";
+    }
+
+    /**
+     * Calls the javap tool with the arguments as currently configured.
+     * @return a Result object indicating the outcome of the task
+     * and the content of any output written to stdout, stderr, or the
+     * main stream.
+     * @throws TaskError if the outcome of the task is not as expected.
+     */
+    @Override
+    public Task.Result run() {
+        List<String> args = new ArrayList<>();
+        if (options != null)
+            args.addAll(options);
+        if (classpath != null) {
+            args.add("-classpath");
+            args.add(classpath);
+        }
+        if (classes != null)
+            args.addAll(classes);
+
+        AbstractTask.WriterOutput direct = new AbstractTask.WriterOutput();
+        // These are to catch output to System.out and System.err,
+        // in case these are used instead of the primary streams
+        AbstractTask.StreamOutput sysOut = new AbstractTask.StreamOutput(System.out, System::setOut);
+        AbstractTask.StreamOutput sysErr = new AbstractTask.StreamOutput(System.err, System::setErr);
+
+        int rc;
+        Map<Task.OutputKind, String> outputMap = new HashMap<>();
+        try {
+            rc = com.sun.tools.javap.Main.run(args.toArray(new String[args.size()]), direct.pw);
+        } finally {
+            outputMap.put(Task.OutputKind.STDOUT, sysOut.close());
+            outputMap.put(Task.OutputKind.STDERR, sysErr.close());
+            outputMap.put(Task.OutputKind.DIRECT, direct.close());
+        }
+        return checkExit(new Task.Result(toolBox, this, rc, outputMap));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/lib/toolbox/Task.java	Thu Mar 31 15:20:50 2016 -0700
@@ -0,0 +1,189 @@
+/*
+ * 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.
+ */
+
+package toolbox;
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import static toolbox.ToolBox.lineSeparator;
+
+/**
+ * The supertype for tasks.
+ * Complex operations are modeled by building and running a "Task" object.
+ * Tasks are typically configured in a fluent series of calls.
+ */
+public interface Task {
+    /**
+     * Returns the name of the task.
+     * @return the name of the task
+     */
+    String name();
+
+    /**
+     * Executes the task as currently configured.
+     * @return a Result object containing the results of running the task
+     * @throws TaskError if the outcome of the task was not as expected
+     */
+    Result run() throws TaskError;
+
+    /**
+     * Exception thrown by {@code Task.run} when the outcome is not as
+     * expected.
+     */
+    public static class TaskError extends Error {
+        /**
+         * Creates a TaskError object with the given message.
+         * @param message the message
+         */
+        public TaskError(String message) {
+            super(message);
+        }
+    }
+
+    /**
+     * An enum to indicate the mode a task should use it is when executed.
+     */
+    public enum Mode {
+        /**
+         * The task should use the interface used by the command
+         * line launcher for the task.
+         * For example, for javac: com.sun.tools.javac.Main.compile
+         */
+        CMDLINE,
+        /**
+         * The task should use a publicly defined API for the task.
+         * For example, for javac: javax.tools.JavaCompiler
+         */
+        API,
+        /**
+         * The task should use the standard launcher for the task.
+         * For example, $JAVA_HOME/bin/javac
+         */
+        EXEC
+    }
+
+    /**
+     * An enum to indicate the expected success or failure of executing a task.
+     */
+    public enum Expect {
+        /** It is expected that the task will complete successfully. */
+        SUCCESS,
+        /** It is expected that the task will not complete successfully. */
+        FAIL
+    }
+
+    /**
+     * An enum to identify the streams that may be written by a {@code Task}.
+     */
+    public enum OutputKind {
+        /** Identifies output written to {@code System.out} or {@code stdout}. */
+        STDOUT,
+        /** Identifies output written to {@code System.err} or {@code stderr}. */
+        STDERR,
+        /** Identifies output written to a stream provided directly to the task. */
+        DIRECT
+    };
+
+    /**
+     * The results from running a {@link Task}.
+     * The results contain the exit code returned when the tool was invoked,
+     * and a map containing the output written to any streams during the
+     * execution of the tool.
+     * All tools support "stdout" and "stderr".
+     * Tools that take an explicit PrintWriter save output written to that
+     * stream as "main".
+     */
+    public static class Result {
+        final ToolBox toolBox;
+        final Task task;
+        final int exitCode;
+        final Map<OutputKind, String> outputMap;
+
+        Result(ToolBox toolBox, Task task, int exitCode, Map<OutputKind, String> outputMap) {
+            this.toolBox = toolBox;
+            this.task = task;
+            this.exitCode = exitCode;
+            this.outputMap = outputMap;
+        }
+
+        /**
+         * Returns the content of a specified stream.
+         * @param outputKind the kind of the selected stream
+         * @return the content that was written to that stream when the tool
+         *  was executed.
+         */
+        public String getOutput(OutputKind outputKind) {
+            return outputMap.get(outputKind);
+        }
+
+        /**
+         * Returns the content of named streams as a list of lines.
+         * @param outputKinds the kinds of the selected streams
+         * @return the content that was written to the given streams when the tool
+         *  was executed.
+         */
+        public List<String> getOutputLines(OutputKind... outputKinds) {
+            List<String> result = new ArrayList<>();
+            for (OutputKind outputKind : outputKinds) {
+                result.addAll(Arrays.asList(outputMap.get(outputKind).split(lineSeparator)));
+            }
+            return result;
+        }
+
+        /**
+         * Writes the content of the specified stream to the log.
+         * @param kind the kind of the selected stream
+         * @return this Result object
+         */
+        public Result write(OutputKind kind) {
+            PrintStream out = toolBox.out;
+            String text = getOutput(kind);
+            if (text == null || text.isEmpty())
+                out.println("[" + task.name() + ":" + kind + "]: empty");
+            else {
+                out.println("[" + task.name() + ":" + kind + "]:");
+                out.print(text);
+            }
+            return this;
+        }
+
+        /**
+         * Writes the content of all streams with any content to the log.
+         * @return this Result object
+         */
+        public Result writeAll() {
+            PrintStream out = toolBox.out;
+            outputMap.forEach((name, text) -> {
+                if (!text.isEmpty()) {
+                    out.println("[" + name + "]:");
+                    out.print(text);
+                }
+            });
+            return this;
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/lib/toolbox/ToolBox.java	Thu Mar 31 15:20:50 2016 -0700
@@ -0,0 +1,694 @@
+/*
+ * 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.
+ */
+
+package toolbox;
+
+import java.io.BufferedWriter;
+import java.io.ByteArrayOutputStream;
+import java.io.FilterOutputStream;
+import java.io.FilterWriter;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.URI;
+import java.nio.charset.Charset;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.StandardCopyOption;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
+
+import javax.tools.FileObject;
+import javax.tools.ForwardingJavaFileManager;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.tools.JavaFileObject.Kind;
+import javax.tools.JavaFileManager.Location;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+/**
+ * Utility methods and classes for writing jtreg tests for
+ * javac, javah, javap, and sjavac. (For javadoc support,
+ * see JavadocTester.)
+ *
+ * <p>There is support for common file operations similar to
+ * shell commands like cat, cp, diff, mv, rm, grep.
+ *
+ * <p>There is also support for invoking various tools, like
+ * javac, javah, javap, jar, java and other JDK tools.
+ *
+ * <p><em>File separators</em>: for convenience, many operations accept strings
+ * to represent filenames. On all platforms on which JDK is supported,
+ * "/" is a legal filename component separator. In particular, even
+ * on Windows, where the official file separator is "\", "/" is a legal
+ * alternative. It is therefore recommended that any client code using
+ * strings to specify filenames should use "/".
+ *
+ * @author Vicente Romero (original)
+ * @author Jonathan Gibbons (revised)
+ */
+public class ToolBox {
+    /** The platform line separator. */
+    public static final String lineSeparator = System.getProperty("line.separator");
+    /** The platform OS name. */
+    public static final String osName = System.getProperty("os.name");
+
+    /** The location of the class files for this test, or null if not set. */
+    public static final String testClasses = System.getProperty("test.classes");
+    /** The location of the source files for this test, or null if not set. */
+    public static final String testSrc = System.getProperty("test.src");
+    /** The location of the test JDK for this test, or null if not set. */
+    public static final String testJDK = System.getProperty("test.jdk");
+
+    /** The current directory. */
+    public static final Path currDir = Paths.get(".");
+
+    /** The stream used for logging output. */
+    public PrintStream out = System.err;
+
+    /**
+     * Checks if the host OS is some version of Windows.
+     * @return true if the host OS is some version of Windows
+     */
+    public boolean isWindows() {
+        return osName.toLowerCase(Locale.ENGLISH).startsWith("windows");
+    }
+
+    /**
+     * Splits a string around matches of the given regular expression.
+     * If the string is empty, an empty list will be returned.
+     * @param text the string to be split
+     * @param sep  the delimiting regular expression
+     * @return the strings between the separators
+     */
+    public List<String> split(String text, String sep) {
+        if (text.isEmpty())
+            return Collections.emptyList();
+        return Arrays.asList(text.split(sep));
+    }
+
+    /**
+     * Checks if two lists of strings are equal.
+     * @param l1 the first list of strings to be compared
+     * @param l2 the second list of strings to be compared
+     * @throws Error if the lists are not equal
+     */
+    public void checkEqual(List<String> l1, List<String> l2) throws Error {
+        if (!Objects.equals(l1, l2)) {
+            // l1 and l2 cannot both be null
+            if (l1 == null)
+                throw new Error("comparison failed: l1 is null");
+            if (l2 == null)
+                throw new Error("comparison failed: l2 is null");
+            // report first difference
+            for (int i = 0; i < Math.min(l1.size(), l2.size()); i++) {
+                String s1 = l1.get(i);
+                String s2 = l1.get(i);
+                if (!Objects.equals(s1, s2)) {
+                    throw new Error("comparison failed, index " + i +
+                            ", (" + s1 + ":" + s2 + ")");
+                }
+            }
+            throw new Error("comparison failed: l1.size=" + l1.size() + ", l2.size=" + l2.size());
+        }
+    }
+
+    /**
+     * Filters a list of strings according to the given regular expression.
+     * @param regex the regular expression
+     * @param lines the strings to be filtered
+     * @return the strings matching the regular expression
+     */
+    public List<String> grep(String regex, List<String> lines) {
+        return grep(Pattern.compile(regex), lines);
+    }
+
+    /**
+     * Filters a list of strings according to the given regular expression.
+     * @param pattern the regular expression
+     * @param lines the strings to be filtered
+     * @return the strings matching the regular expression
+     */
+    public List<String> grep(Pattern pattern, List<String> lines) {
+        return lines.stream()
+                .filter(s -> pattern.matcher(s).find())
+                .collect(Collectors.toList());
+    }
+
+    /**
+     * Copies a file.
+     * If the given destination exists and is a directory, the copy is created
+     * in that directory.  Otherwise, the copy will be placed at the destination,
+     * possibly overwriting any existing file.
+     * <p>Similar to the shell "cp" command: {@code cp from to}.
+     * @param from the file to be copied
+     * @param to where to copy the file
+     * @throws IOException if any error occurred while copying the file
+     */
+    public void copyFile(String from, String to) throws IOException {
+        copyFile(Paths.get(from), Paths.get(to));
+    }
+
+    /**
+     * Copies a file.
+     * If the given destination exists and is a directory, the copy is created
+     * in that directory.  Otherwise, the copy will be placed at the destination,
+     * possibly overwriting any existing file.
+     * <p>Similar to the shell "cp" command: {@code cp from to}.
+     * @param from the file to be copied
+     * @param to where to copy the file
+     * @throws IOException if an error occurred while copying the file
+     */
+    public void copyFile(Path from, Path to) throws IOException {
+        if (Files.isDirectory(to)) {
+            to = to.resolve(from.getFileName());
+        } else {
+            Files.createDirectories(to.getParent());
+        }
+        Files.copy(from, to, StandardCopyOption.REPLACE_EXISTING);
+    }
+
+    /**
+     * Creates one of more directories.
+     * For each of the series of paths, a directory will be created,
+     * including any necessary parent directories.
+     * <p>Similar to the shell command: {@code mkdir -p paths}.
+     * @param paths the directories to be created
+     * @throws IOException if an error occurred while creating the directories
+     */
+    public void createDirectories(String... paths) throws IOException {
+        if (paths.length == 0)
+            throw new IllegalArgumentException("no directories specified");
+        for (String p : paths)
+            Files.createDirectories(Paths.get(p));
+    }
+
+    /**
+     * Creates one or more directories.
+     * For each of the series of paths, a directory will be created,
+     * including any necessary parent directories.
+     * <p>Similar to the shell command: {@code mkdir -p paths}.
+     * @param paths the directories to be created
+     * @throws IOException if an error occurred while creating the directories
+     */
+    public void createDirectories(Path... paths) throws IOException {
+        if (paths.length == 0)
+            throw new IllegalArgumentException("no directories specified");
+        for (Path p : paths)
+            Files.createDirectories(p);
+    }
+
+    /**
+     * Deletes one or more files.
+     * Any directories to be deleted must be empty.
+     * <p>Similar to the shell command: {@code rm files}.
+     * @param files the files to be deleted
+     * @throws IOException if an error occurred while deleting the files
+     */
+    public void deleteFiles(String... files) throws IOException {
+        if (files.length == 0)
+            throw new IllegalArgumentException("no files specified");
+        for (String file : files)
+            Files.delete(Paths.get(file));
+    }
+
+    /**
+     * Deletes all content of a directory (but not the directory itself).
+     * @param root the directory to be cleaned
+     * @throws IOException if an error occurs while cleaning the directory
+     */
+    public void cleanDirectory(Path root) throws IOException {
+        if (!Files.isDirectory(root)) {
+            throw new IOException(root + " is not a directory");
+        }
+        Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
+            @Override
+            public FileVisitResult visitFile(Path file, BasicFileAttributes a) throws IOException {
+                Files.delete(file);
+                return FileVisitResult.CONTINUE;
+            }
+
+            @Override
+            public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException {
+                if (e != null) {
+                    throw e;
+                }
+                if (!dir.equals(root)) {
+                    Files.delete(dir);
+                }
+                return FileVisitResult.CONTINUE;
+            }
+        });
+    }
+
+    /**
+     * Moves a file.
+     * If the given destination exists and is a directory, the file will be moved
+     * to that directory.  Otherwise, the file will be moved to the destination,
+     * possibly overwriting any existing file.
+     * <p>Similar to the shell "mv" command: {@code mv from to}.
+     * @param from the file to be moved
+     * @param to where to move the file
+     * @throws IOException if an error occurred while moving the file
+     */
+    public void moveFile(String from, String to) throws IOException {
+        moveFile(Paths.get(from), Paths.get(to));
+    }
+
+    /**
+     * Moves a file.
+     * If the given destination exists and is a directory, the file will be moved
+     * to that directory.  Otherwise, the file will be moved to the destination,
+     * possibly overwriting any existing file.
+     * <p>Similar to the shell "mv" command: {@code mv from to}.
+     * @param from the file to be moved
+     * @param to where to move the file
+     * @throws IOException if an error occurred while moving the file
+     */
+    public void moveFile(Path from, Path to) throws IOException {
+        if (Files.isDirectory(to)) {
+            to = to.resolve(from.getFileName());
+        } else {
+            Files.createDirectories(to.getParent());
+        }
+        Files.move(from, to, StandardCopyOption.REPLACE_EXISTING);
+    }
+
+    /**
+     * Reads the lines of a file.
+     * The file is read using the default character encoding.
+     * @param path the file to be read
+     * @return the lines of the file.
+     * @throws IOException if an error occurred while reading the file
+     */
+    public List<String> readAllLines(String path) throws IOException {
+        return readAllLines(path, null);
+    }
+
+    /**
+     * Reads the lines of a file.
+     * The file is read using the default character encoding.
+     * @param path the file to be read
+     * @return the lines of the file.
+     * @throws IOException if an error occurred while reading the file
+     */
+    public List<String> readAllLines(Path path) throws IOException {
+        return readAllLines(path, null);
+    }
+
+    /**
+     * Reads the lines of a file using the given encoding.
+     * @param path the file to be read
+     * @param encoding the encoding to be used to read the file
+     * @return the lines of the file.
+     * @throws IOException if an error occurred while reading the file
+     */
+    public List<String> readAllLines(String path, String encoding) throws IOException {
+        return readAllLines(Paths.get(path), encoding);
+    }
+
+    /**
+     * Reads the lines of a file using the given encoding.
+     * @param path the file to be read
+     * @param encoding the encoding to be used to read the file
+     * @return the lines of the file.
+     * @throws IOException if an error occurred while reading the file
+     */
+    public List<String> readAllLines(Path path, String encoding) throws IOException {
+        return Files.readAllLines(path, getCharset(encoding));
+    }
+
+    private Charset getCharset(String encoding) {
+        return (encoding == null) ? Charset.defaultCharset() : Charset.forName(encoding);
+    }
+
+    /**
+     * Writes a file containing the given content.
+     * Any necessary directories for the file will be created.
+     * @param path where to write the file
+     * @param content the content for the file
+     * @throws IOException if an error occurred while writing the file
+     */
+    public void writeFile(String path, String content) throws IOException {
+        writeFile(Paths.get(path), content);
+    }
+
+    /**
+     * Writes a file containing the given content.
+     * Any necessary directories for the file will be created.
+     * @param path where to write the file
+     * @param content the content for the file
+     * @throws IOException if an error occurred while writing the file
+     */
+    public void writeFile(Path path, String content) throws IOException {
+        Path dir = path.getParent();
+        if (dir != null)
+            Files.createDirectories(dir);
+        try (BufferedWriter w = Files.newBufferedWriter(path)) {
+            w.write(content);
+        }
+    }
+
+    /**
+     * Writes one or more files containing Java source code.
+     * For each file to be written, the filename will be inferred from the
+     * given base directory, the package declaration (if present) and from the
+     * the name of the first class, interface or enum declared in the file.
+     * <p>For example, if the base directory is /my/dir/ and the content
+     * contains "package p; class C { }", the file will be written to
+     * /my/dir/p/C.java.
+     * <p>Note: the content is analyzed using regular expressions;
+     * errors can occur if any contents have initial comments that might trip
+     * up the analysis.
+     * @param dir the base directory
+     * @param contents the contents of the files to be written
+     * @throws IOException if an error occurred while writing any of the files.
+     */
+    public void writeJavaFiles(Path dir, String... contents) throws IOException {
+        if (contents.length == 0)
+            throw new IllegalArgumentException("no content specified for any files");
+        for (String c : contents) {
+            new JavaSource(c).write(dir);
+        }
+    }
+
+    /**
+     * Returns the path for the binary of a JDK tool within {@link testJDK}.
+     * @param tool the name of the tool
+     * @return the path of the tool
+     */
+    public Path getJDKTool(String tool) {
+        return Paths.get(testJDK, "bin", tool);
+    }
+
+    /**
+     * Returns a string representing the contents of an {@code Iterable} as a list.
+     * @param <T> the type parameter of the {@code Iterable}
+     * @param items the iterable
+     * @return the string
+     */
+    <T> String toString(Iterable<T> items) {
+        return StreamSupport.stream(items.spliterator(), false)
+                .map(Objects::toString)
+                .collect(Collectors.joining(",", "[", "]"));
+    }
+
+
+    /**
+     * An in-memory Java source file.
+     * It is able to extract the file name from simple source text using
+     * regular expressions.
+     */
+    public static class JavaSource extends SimpleJavaFileObject {
+        private final String source;
+
+        /**
+         * Creates a in-memory file object for Java source code.
+         * @param className the name of the class
+         * @param source the source text
+         */
+        public JavaSource(String className, String source) {
+            super(URI.create(className), JavaFileObject.Kind.SOURCE);
+            this.source = source;
+        }
+
+        /**
+         * Creates a in-memory file object for Java source code.
+         * The name of the class will be inferred from the source code.
+         * @param source the source text
+         */
+        public JavaSource(String source) {
+            super(URI.create(getJavaFileNameFromSource(source)),
+                    JavaFileObject.Kind.SOURCE);
+            this.source = source;
+        }
+
+        /**
+         * Writes the source code to a file in the current directory.
+         * @throws IOException if there is a problem writing the file
+         */
+        public void write() throws IOException {
+            write(currDir);
+        }
+
+        /**
+         * Writes the source code to a file in a specified directory.
+         * @param dir the directory
+         * @throws IOException if there is a problem writing the file
+         */
+        public void write(Path dir) throws IOException {
+            Path file = dir.resolve(getJavaFileNameFromSource(source));
+            Files.createDirectories(file.getParent());
+            try (BufferedWriter out = Files.newBufferedWriter(file)) {
+                out.write(source.replace("\n", lineSeparator));
+            }
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+
+        private static Pattern modulePattern =
+                Pattern.compile("module\\s+((?:\\w+\\.)*)");
+        private static Pattern packagePattern =
+                Pattern.compile("package\\s+(((?:\\w+\\.)*)(?:\\w+))");
+        private static Pattern classPattern =
+                Pattern.compile("(?:public\\s+)?(?:class|enum|interface)\\s+(\\w+)");
+
+        /**
+         * Extracts the Java file name from the class declaration.
+         * This method is intended for simple files and uses regular expressions,
+         * so comments matching the pattern can make the method fail.
+         */
+        static String getJavaFileNameFromSource(String source) {
+            String packageName = null;
+
+            Matcher matcher = modulePattern.matcher(source);
+            if (matcher.find())
+                return "module-info.java";
+
+            matcher = packagePattern.matcher(source);
+            if (matcher.find())
+                packageName = matcher.group(1).replace(".", "/");
+
+            matcher = classPattern.matcher(source);
+            if (matcher.find()) {
+                String className = matcher.group(1) + ".java";
+                return (packageName == null) ? className : packageName + "/" + className;
+            } else if (packageName != null) {
+                return packageName + "/package-info.java";
+            } else {
+                throw new Error("Could not extract the java class " +
+                        "name from the provided source");
+            }
+        }
+    }
+
+    /**
+     * Extracts the Java file name from the class declaration.
+     * This method is intended for simple files and uses regular expressions,
+     * so comments matching the pattern can make the method fail.
+     * @deprecated This is a legacy method for compatibility with ToolBox v1.
+     *      Use {@link JavaSource#getName JavaSource.getName} instead.
+     * @param source the source text
+     * @return the Java file name inferred from the source
+     */
+    @Deprecated
+    public static String getJavaFileNameFromSource(String source) {
+        return JavaSource.getJavaFileNameFromSource(source);
+    }
+
+    /**
+     * A memory file manager, for saving generated files in memory.
+     * The file manager delegates to a separate file manager for listing and
+     * reading input files.
+     */
+    public static class MemoryFileManager extends ForwardingJavaFileManager {
+        private interface Content {
+            byte[] getBytes();
+            String getString();
+        }
+
+        /**
+         * Maps binary class names to generated content.
+         */
+        private final Map<Location, Map<String, Content>> files;
+
+        /**
+         * Construct a memory file manager which stores output files in memory,
+         * and delegates to a default file manager for input files.
+         */
+        public MemoryFileManager() {
+            this(ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null));
+        }
+
+        /**
+         * Construct a memory file manager which stores output files in memory,
+         * and delegates to a specified file manager for input files.
+         * @param fileManager the file manager to be used for input files
+         */
+        public MemoryFileManager(JavaFileManager fileManager) {
+            super(fileManager);
+            files = new HashMap<>();
+        }
+
+        @Override
+        public JavaFileObject getJavaFileForOutput(Location location,
+                                                   String name,
+                                                   JavaFileObject.Kind kind,
+                                                   FileObject sibling)
+        {
+            return new MemoryFileObject(location, name, kind);
+        }
+
+        /**
+         * Returns the set of names of files that have been written to a given
+         * location.
+         * @param location the location
+         * @return the set of file names
+         */
+        public Set<String> getFileNames(Location location) {
+            Map<String, Content> filesForLocation = files.get(location);
+            return (filesForLocation == null)
+                ? Collections.emptySet() : filesForLocation.keySet();
+        }
+
+        /**
+         * Returns the content written to a file in a given location,
+         * or null if no such file has been written.
+         * @param location the location
+         * @param name the name of the file
+         * @return the content as an array of bytes
+         */
+        public byte[] getFileBytes(Location location, String name) {
+            Content content = getFile(location, name);
+            return (content == null) ? null : content.getBytes();
+        }
+
+        /**
+         * Returns the content written to a file in a given location,
+         * or null if no such file has been written.
+         * @param location the location
+         * @param name the name of the file
+         * @return the content as a string
+         */
+        public String getFileString(Location location, String name) {
+            Content content = getFile(location, name);
+            return (content == null) ? null : content.getString();
+        }
+
+        private Content getFile(Location location, String name) {
+            Map<String, Content> filesForLocation = files.get(location);
+            return (filesForLocation == null) ? null : filesForLocation.get(name);
+        }
+
+        private void save(Location location, String name, Content content) {
+            Map<String, Content> filesForLocation = files.get(location);
+            if (filesForLocation == null)
+                files.put(location, filesForLocation = new HashMap<>());
+            filesForLocation.put(name, content);
+        }
+
+        /**
+         * A writable file object stored in memory.
+         */
+        private class MemoryFileObject extends SimpleJavaFileObject {
+            private final Location location;
+            private final String name;
+
+            /**
+             * Constructs a memory file object.
+             * @param name binary name of the class to be stored in this file object
+             */
+            MemoryFileObject(Location location, String name, JavaFileObject.Kind kind) {
+                super(URI.create("mfm:///" + name.replace('.','/') + kind.extension),
+                      Kind.CLASS);
+                this.location = location;
+                this.name = name;
+            }
+
+            @Override
+            public OutputStream openOutputStream() {
+                return new FilterOutputStream(new ByteArrayOutputStream()) {
+                    @Override
+                    public void close() throws IOException {
+                        out.close();
+                        byte[] bytes = ((ByteArrayOutputStream) out).toByteArray();
+                        save(location, name, new Content() {
+                            @Override
+                            public byte[] getBytes() {
+                                return bytes;
+                            }
+                            @Override
+                            public String getString() {
+                                return new String(bytes);
+                            }
+
+                        });
+                    }
+                };
+            }
+
+            @Override
+            public Writer openWriter() {
+                return new FilterWriter(new StringWriter()) {
+                    @Override
+                    public void close() throws IOException {
+                        out.close();
+                        String text = ((StringWriter) out).toString();
+                        save(location, name, new Content() {
+                            @Override
+                            public byte[] getBytes() {
+                                return text.getBytes();
+                            }
+                            @Override
+                            public String getString() {
+                                return text;
+                            }
+
+                        });
+                    }
+                };
+            }
+        }
+    }
+}
+
--- a/langtools/test/tools/sjavac/ApiExtraction.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/ApiExtraction.java	Thu Mar 31 15:20:50 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,11 +27,10 @@
  * @summary Make sure extraction of non-private APIs work as expected.
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper ApiExtraction
  */
 import static java.util.Arrays.asList;
--- a/langtools/test/tools/sjavac/ClasspathDependencies.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/ClasspathDependencies.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,11 +27,10 @@
  * @summary Make sure changes of public API on classpath triggers recompilation
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper ClasspathDependencies
  */
 
--- a/langtools/test/tools/sjavac/CompileCircularSources.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/CompileCircularSources.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,11 +29,10 @@
  * @author sogoel (rewrite)
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper CompileCircularSources
  */
 
--- a/langtools/test/tools/sjavac/CompileExcludingDependency.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/CompileExcludingDependency.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,11 +29,10 @@
  * @author sogoel (rewrite)
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper CompileExcludingDependency
  */
 
--- a/langtools/test/tools/sjavac/CompileWithAtFile.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/CompileWithAtFile.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,11 +29,10 @@
  * @author sogoel (rewrite)
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper CompileWithAtFile
  */
 
--- a/langtools/test/tools/sjavac/CompileWithInvisibleSources.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/CompileWithInvisibleSources.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,11 +29,10 @@
  * @author sogoel (rewrite)
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper CompileWithInvisibleSources
  */
 
--- a/langtools/test/tools/sjavac/CompileWithOverrideSources.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/CompileWithOverrideSources.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,11 +29,10 @@
  * @author sogoel (rewrite)
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper CompileWithOverrideSources
  */
 
--- a/langtools/test/tools/sjavac/HiddenFiles.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/HiddenFiles.java	Thu Mar 31 15:20:50 2016 -0700
@@ -32,7 +32,7 @@
  * @modules jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper HiddenFiles
  */
 
--- a/langtools/test/tools/sjavac/IncCompInheritance.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/IncCompInheritance.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,10 +27,9 @@
  * @summary Analysis of public API does not take super classes into account
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper IncCompInheritance
  */
 
--- a/langtools/test/tools/sjavac/IncCompileChangeNative.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/IncCompileChangeNative.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,11 +29,10 @@
  * @author sogoel (rewrite)
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper IncCompileChangeNative
  */
 
--- a/langtools/test/tools/sjavac/IncCompileDropClasses.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/IncCompileDropClasses.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,11 +29,10 @@
  * @author sogoel (rewrite)
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper IncCompileDropClasses
  */
 
--- a/langtools/test/tools/sjavac/IncCompileFullyQualifiedRef.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/IncCompileFullyQualifiedRef.java	Thu Mar 31 15:20:50 2016 -0700
@@ -25,21 +25,21 @@
  * @test
  * @summary Verify that "alfa.omega.A a" does create a proper dependency
  * @bug 8054689
- * @ignore Requires dependency code to deal with in-method dependencies.
  * @author Fredrik O
  * @author sogoel (rewrite)
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
- *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @ignore Requires dependency code to deal with in-method dependencies.
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper IncCompileFullyQualifiedRef
  */
 
 import java.util.Map;
 
+import toolbox.ToolBox;
+
 public class IncCompileFullyQualifiedRef extends SJavacTester {
     public static void main(String... args) throws Exception {
         IncCompileFullyQualifiedRef fr = new IncCompileFullyQualifiedRef();
--- a/langtools/test/tools/sjavac/IncCompileNoChanges.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/IncCompileNoChanges.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,11 +29,10 @@
  * @author sogoel (rewrite)
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper IncCompileNoChanges
  */
 
--- a/langtools/test/tools/sjavac/IncCompileUpdateNative.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/IncCompileUpdateNative.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,11 +29,10 @@
  * @author sogoel (rewrite)
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper IncCompileUpdateNative
  */
 
--- a/langtools/test/tools/sjavac/IncCompileWithChanges.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/IncCompileWithChanges.java	Thu Mar 31 15:20:50 2016 -0700
@@ -24,23 +24,24 @@
 /*
  * @test
  * @summary Verify incremental changes in gensrc are handled as expected
- * @ignore Requires dependency code to deal with in-method dependencies.
  * @bug 8054689
  * @author Fredrik O
  * @author sogoel (rewrite)
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @ignore Requires dependency code to deal with in-method dependencies.
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper IncCompileWithChanges
  */
 
 import java.util.*;
 import java.nio.file.*;
 
+import toolbox.ToolBox;
+
 public class IncCompileWithChanges extends SJavacTester {
     public static void main(String... args) throws Exception {
         IncCompileWithChanges wc = new IncCompileWithChanges();
--- a/langtools/test/tools/sjavac/IncludeExcludePatterns.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/IncludeExcludePatterns.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,7 +29,7 @@
  * @modules jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
  * @library /tools/lib
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper IncludeExcludePatterns
  */
 
--- a/langtools/test/tools/sjavac/NoState.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/NoState.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,11 +27,10 @@
  * @bug 8135131
   * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper NoState
  */
 
--- a/langtools/test/tools/sjavac/OverlappingSrcDst.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/OverlappingSrcDst.java	Thu Mar 31 15:20:50 2016 -0700
@@ -30,11 +30,10 @@
  * @bug 8061320
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper OverlappingSrcDst
  */
 
--- a/langtools/test/tools/sjavac/PackagePathMismatch.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/PackagePathMismatch.java	Thu Mar 31 15:20:50 2016 -0700
@@ -27,10 +27,9 @@
  * @summary This test makes sure file paths matches package declarations
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper PackagePathMismatch
  */
 
--- a/langtools/test/tools/sjavac/ParallelCompilations.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/ParallelCompilations.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,11 +28,10 @@
  * @author sogoel
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper ParallelCompilations
  */
 
--- a/langtools/test/tools/sjavac/PermittedArtifact.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/PermittedArtifact.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,11 +29,10 @@
  * @author sogoel (rewrite)
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper PermittedArtifact
  */
 
--- a/langtools/test/tools/sjavac/SJavacTester.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/SJavacTester.java	Thu Mar 31 15:20:50 2016 -0700
@@ -28,6 +28,8 @@
 
 import com.sun.tools.sjavac.Main;
 
+import toolbox.ToolBox;
+
 public class SJavacTester {
 
     final ToolBox tb = new ToolBox();
--- a/langtools/test/tools/sjavac/StateDir.java	Thu Mar 31 14:56:33 2016 -0700
+++ b/langtools/test/tools/sjavac/StateDir.java	Thu Mar 31 15:20:50 2016 -0700
@@ -29,11 +29,10 @@
  * @author sogoel (rewrite)
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
- *          jdk.compiler/com.sun.tools.javac.file
  *          jdk.compiler/com.sun.tools.javac.main
  *          jdk.compiler/com.sun.tools.sjavac
  *          jdk.jdeps/com.sun.tools.javap
- * @build Wrapper ToolBox
+ * @build Wrapper toolbox.ToolBox
  * @run main Wrapper StateDir
  */