6983738: Use a JavacTestingAbstractProcessor
authordarcy
Wed, 29 Sep 2010 23:27:57 -0700
changeset 6720 f16f91662ad8
parent 6719 1ce993f87850
child 6721 d92073844278
6983738: Use a JavacTestingAbstractProcessor Reviewed-by: jjg
langtools/test/tools/javac/lib/JavacTestingAbstractProcessor.java
langtools/test/tools/javac/processing/6348499/A.java
langtools/test/tools/javac/processing/6348499/T6348499.java
langtools/test/tools/javac/processing/6359313/T6359313.java
langtools/test/tools/javac/processing/6365040/ProcBar.java
langtools/test/tools/javac/processing/6365040/ProcFoo.java
langtools/test/tools/javac/processing/6365040/T6365040.java
langtools/test/tools/javac/processing/6413690/T6413690.java
langtools/test/tools/javac/processing/6414633/A.java
langtools/test/tools/javac/processing/6414633/T6414633.java
langtools/test/tools/javac/processing/6430209/T6430209.java
langtools/test/tools/javac/processing/6430209/b6341534.java
langtools/test/tools/javac/processing/6499119/ClassProcessor.java
langtools/test/tools/javac/processing/6511613/DummyProcessor.java
langtools/test/tools/javac/processing/6511613/clss41701.java
langtools/test/tools/javac/processing/6512707/T6512707.java
langtools/test/tools/javac/processing/6634138/T6634138.java
langtools/test/tools/javac/processing/T6439826.java
langtools/test/tools/javac/processing/T6920317.java
langtools/test/tools/javac/processing/environment/TestSourceVersion.java
langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java
langtools/test/tools/javac/processing/errors/TestFatalityOfParseErrors.java
langtools/test/tools/javac/processing/errors/TestOptionSyntaxErrors.java
langtools/test/tools/javac/processing/errors/TestReturnCode.java
langtools/test/tools/javac/processing/filer/TestFilerConstraints.java
langtools/test/tools/javac/processing/filer/TestGetResource.java
langtools/test/tools/javac/processing/filer/TestGetResource2.java
langtools/test/tools/javac/processing/filer/TestInvalidRelativeNames.java
langtools/test/tools/javac/processing/filer/TestLastRound.java
langtools/test/tools/javac/processing/filer/TestPackageInfo.java
langtools/test/tools/javac/processing/messager/6362067/T6362067.java
langtools/test/tools/javac/processing/messager/MessagerBasics.java
langtools/test/tools/javac/processing/model/6194785/T6194785.java
langtools/test/tools/javac/processing/model/6341534/T6341534.java
langtools/test/tools/javac/processing/model/element/TestAnonClassNames.java
langtools/test/tools/javac/processing/model/element/TestAnonSourceNames.java
langtools/test/tools/javac/processing/model/element/TestElement.java
langtools/test/tools/javac/processing/model/element/TestNames.java
langtools/test/tools/javac/processing/model/element/TestPackageElement.java
langtools/test/tools/javac/processing/model/element/TestResourceElement.java
langtools/test/tools/javac/processing/model/element/TestResourceVariable.java
langtools/test/tools/javac/processing/model/element/TypeParamBounds.java
langtools/test/tools/javac/processing/model/type/MirroredTypeEx/OverEager.java
langtools/test/tools/javac/processing/model/type/MirroredTypeEx/Plurality.java
langtools/test/tools/javac/processing/model/type/NoTypes.java
langtools/test/tools/javac/processing/model/util/BinaryName.java
langtools/test/tools/javac/processing/model/util/GetTypeElemBadArg.java
langtools/test/tools/javac/processing/model/util/NoSupers.java
langtools/test/tools/javac/processing/model/util/OverridesSpecEx.java
langtools/test/tools/javac/processing/model/util/TypesBadArg.java
langtools/test/tools/javac/processing/model/util/deprecation/TestDeprecation.java
langtools/test/tools/javac/processing/model/util/directSupersOfErr/DirectSupersOfErr.java
langtools/test/tools/javac/processing/model/util/elements/TestGetConstantExpression.java
langtools/test/tools/javac/processing/model/util/elements/TestGetPackageOf.java
langtools/test/tools/javac/processing/model/util/filter/TestIterables.java
langtools/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java
langtools/test/tools/javac/processing/werror/WError1.java
langtools/test/tools/javac/processing/werror/WErrorGen.java
langtools/test/tools/javac/processing/werror/WErrorLast.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lib/JavacTestingAbstractProcessor.java	Wed Sep 29 23:27:57 2010 -0700
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2010, 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.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.SourceVersion;
+import static javax.lang.model.SourceVersion.*;
+import javax.lang.model.element.*;
+import javax.lang.model.util.*;
+
+/**
+ * An abstract annotation processor tailored to javac regression testing.
+ */
+public abstract class JavacTestingAbstractProcessor extends AbstractProcessor {
+    private static final Set<String> allAnnotations;
+
+    static {
+        Set<String> tmp = new HashSet<>();
+        tmp.add("*");
+        allAnnotations = Collections.unmodifiableSet(tmp);
+    }
+
+    protected Elements eltUtils;
+    protected Elements elements;
+    protected Types    typeUtils;
+    protected Types    types;
+    protected Filer    filer;
+    protected Messager messager;
+    protected Map<String, String> options;
+
+    /**
+     * Constructor for subclasses to call.
+     */
+    protected JavacTestingAbstractProcessor() {
+        super();
+    }
+
+    /**
+     * Return the latest source version. Unless this method is
+     * overridden, an {@code IllegalStateException} will be thrown if a
+     * subclass has a {@code SupportedSourceVersion} annotation.
+     */
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        SupportedSourceVersion ssv = this.getClass().getAnnotation(SupportedSourceVersion.class);
+        if (ssv != null)
+            throw new IllegalStateException("SupportedSourceVersion annotation not supported here.");
+
+        return SourceVersion.latest();
+    }
+
+    /**
+     * If the processor class is annotated with {@link
+     * SupportedAnnotationTypes}, return an unmodifiable set with the
+     * same set of strings as the annotation.  If the class is not so
+     * annotated, a one-element set containing {@code "*"} is returned
+     * to indicate all annotations are processed.
+     *
+     * @return the names of the annotation types supported by this
+     * processor, or an empty set if none
+     */
+    @Override
+    public Set<String> getSupportedAnnotationTypes() {
+        SupportedAnnotationTypes sat = this.getClass().getAnnotation(SupportedAnnotationTypes.class);
+        if (sat != null)
+            return super.getSupportedAnnotationTypes();
+        else
+            return allAnnotations;
+    }
+
+    @Override
+    public void init(ProcessingEnvironment processingEnv) {
+        super.init(processingEnv);
+        elements = eltUtils  = processingEnv.getElementUtils();
+        types = typeUtils = processingEnv.getTypeUtils();
+        filer     = processingEnv.getFiler();
+        messager  = processingEnv.getMessager();
+        options   = processingEnv.getOptions();
+    }
+}
--- a/langtools/test/tools/javac/processing/6348499/A.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/6348499/A.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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 @@
 import javax.lang.model.*;
 import javax.lang.model.element.*;
 
-@SupportedAnnotationTypes("*")
-public class A extends AbstractProcessor {
+public class A extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv) {
-        Filer filer = processingEnv.getFiler();
         try {
             OutputStream out = filer.createClassFile(getClass().getName()+"_0").openOutputStream();
             out.close();
@@ -39,8 +37,4 @@
         }
         return true;
     }
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
 }
--- a/langtools/test/tools/javac/processing/6348499/T6348499.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/6348499/T6348499.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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
@@ -25,7 +25,8 @@
  * @test
  * @bug 6441871
  * @summary javac crashes at com.sun.tools.javac.jvm.ClassReader$BadClassFile
- * @build A
+ * @library ../../lib
+ * @build JavacTestingAbstractProcessor A
  * @run main T6348499
  */
 
@@ -54,7 +55,6 @@
             fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "A.java")));
         Iterable<String> opts = Arrays.asList("-proc:only",
                                               "-processor", "A",
-                                              "-source", "1.6",
                                               "-processorpath", testClasses);
         StringWriter out = new StringWriter();
         JavacTask task = tool.getTask(out, fm, dl, opts, null, files);
--- a/langtools/test/tools/javac/processing/6359313/T6359313.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/6359313/T6359313.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +26,8 @@
  * @bug     6359313
  * @summary error compiling annotated package
  * @author  Peter von der Ah\u00e9
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile T6359313.java
  * @compile -processor T6359313 package-info.java Foo.java
  */
@@ -37,7 +39,7 @@
 import javax.lang.model.element.TypeElement;
 
 @SupportedAnnotationTypes("Foo")
-public class T6359313 extends AbstractProcessor {
+public class T6359313 extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnvironment) {
         return true;
--- a/langtools/test/tools/javac/processing/6365040/ProcBar.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/6365040/ProcBar.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,13 +31,11 @@
 /**
  * Second of several processors to run.
  */
-@SupportedAnnotationTypes("*")
-public class ProcBar extends AbstractProcessor {
+public class ProcBar extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnvironment) {
         if (!roundEnvironment.processingOver())
-            processingEnv.getMessager().printMessage(NOTE,
-                                                     "Hello from ProcBar");
+            messager.printMessage(NOTE, "Hello from ProcBar");
         return false;
     }
 }
--- a/langtools/test/tools/javac/processing/6365040/ProcFoo.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/6365040/ProcFoo.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,13 +31,11 @@
 /**
  * First of several processors to run.
  */
-@SupportedAnnotationTypes("*")
-public class ProcFoo extends AbstractProcessor {
+public class ProcFoo extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnvironment) {
         if (!roundEnvironment.processingOver())
-            processingEnv.getMessager().printMessage(NOTE,
-                                                     "Hello from ProcFoo");
+            messager.printMessage(NOTE, "Hello from ProcFoo");
         return false;
     }
 }
--- a/langtools/test/tools/javac/processing/6365040/T6365040.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/6365040/T6365040.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +26,8 @@
  * @bug 6365040 6358129
  * @summary Test -processor foo,bar,baz
  * @author  Joseph D. Darcy
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile ProcFoo.java
  * @compile ProcBar.java
  * @compile T6365040.java
@@ -43,13 +45,11 @@
 import javax.lang.model.element.TypeElement;
 import static javax.tools.Diagnostic.Kind.*;
 
-@SupportedAnnotationTypes("*")
-public class T6365040 extends AbstractProcessor {
+public class T6365040 extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnvironment) {
         if (!roundEnvironment.processingOver())
-            processingEnv.getMessager().printMessage(NOTE,
-                                                     "Hello from T6365040");
+            messager.printMessage(NOTE, "Hello from T6365040");
         return true;
     }
 }
--- a/langtools/test/tools/javac/processing/6413690/T6413690.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/6413690/T6413690.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +26,8 @@
  * @bug     6413690 6380018
  * @summary JavacProcessingEnvironment does not enter trees from preceding rounds
  * @author  Peter von der Ah\u00e9
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile T6413690.java
  * @compile -XDfatalEnterError -verbose -processor T6413690 src/Super.java TestMe.java
  */
@@ -42,11 +44,9 @@
 import javax.lang.model.util.Elements;
 
 @SupportedAnnotationTypes("TestMe")
-public class T6413690 extends AbstractProcessor {
+public class T6413690 extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnvironment) {
-        Elements elements = processingEnv.getElementUtils();
-        Filer filer = processingEnv.getFiler();
         TypeElement testMe = elements.getTypeElement(TestMe.class.getName());
         Set<? extends Element> supers = roundEnvironment.getElementsAnnotatedWith(testMe);
         try {
--- a/langtools/test/tools/javac/processing/6414633/A.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/6414633/A.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,8 @@
 import javax.lang.model.element.*;
 import javax.tools.*;
 
-@SupportedAnnotationTypes("*")
-public class A extends AbstractProcessor {
-
+@SuppressWarnings("")
+public class A extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
         Messager m = processingEnv.getMessager();
         for (TypeElement anno: annotations) {
@@ -42,8 +41,6 @@
         return true;
     }
 
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
+    @SuppressWarnings("")
+    private void foo() {}
 }
--- a/langtools/test/tools/javac/processing/6414633/T6414633.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/6414633/T6414633.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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
@@ -25,7 +25,8 @@
  * @test
  * @bug 6414633 6440109
  * @summary Only the first processor message at a source location is reported
- * @build A T6414633
+ * @library ../../lib
+ * @build    JavacTestingAbstractProcessor A T6414633
  * @run main T6414633
  */
 
@@ -55,8 +56,7 @@
             fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, A.class.getName()+".java")));
         String[] opts = { "-proc:only",
                           "-processor", A.class.getName(),
-                          "-source", "1.6",
-                          "-classpath", testClasses };
+                          "-classpath", testClasses + System.getProperty("path.separator") + "../../lib" };
         JavacTask task = tool.getTask(null, fm, dl, Arrays.asList(opts), null, files);
         task.call();
 
--- a/langtools/test/tools/javac/processing/6430209/T6430209.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/6430209/T6430209.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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
@@ -25,7 +25,8 @@
  * @test
  * @bug 6441871
  * @summary spurious compiler error elicited by packageElement.getEnclosedElements()
- * @build b6341534
+ * @library ../../lib
+ * @build JavacTestingAbstractProcessor b6341534
  * @run main T6430209
  */
 
@@ -54,7 +55,7 @@
         // run annotation processor b6341534 so we can check diagnostics
         // -proc:only -processor b6341534 -cp . ./src/*.java
         String testSrc = System.getProperty("test.src", ".");
-        String testClasses = System.getProperty("test.classes");
+        String testClasses = System.getProperty("test.classes") + System.getProperty("path.separator") + "../../lib";
         JavacTool tool = JavacTool.create();
         MyDiagListener dl = new MyDiagListener();
         StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, null);
--- a/langtools/test/tools/javac/processing/6430209/b6341534.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/6430209/b6341534.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,16 +30,9 @@
 import java.util.*;
 import java.util.Set;
 
-@SupportedAnnotationTypes({"*"})
-public class b6341534 extends AbstractProcessor {
+public class b6341534 extends JavacTestingAbstractProcessor {
     static int r = 0;
-    static Elements E = null;
-    static Messager msgr = null;
-    public void init(ProcessingEnvironment penv)  {
-        processingEnv = penv;
-        msgr = penv.getMessager();
-        E = penv.getElementUtils();
-    }
+
     //Create directory 'dir1' and a test class in dir1
     public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv)
     {
@@ -49,13 +42,13 @@
                 System.out.println("Round"+r+ ": " + t.toString());
 
             try {
-                PackageElement PE = E.getPackageElement("dir1");
+                PackageElement PE = eltUtils.getPackageElement("dir1");
                 List<? extends Element> LEE = PE.getEnclosedElements();    /* <=This line elicits the error message.  */
                 for(Element e : LEE)
                     System.out.println("found " + e.toString() + " in dir1.");
             }
             catch(NullPointerException npe) {
-                msgr.printMessage(ERROR,npe.toString());
+                messager.printMessage(ERROR,npe.toString());
                 //npe.printStackTrace();
                 return false;
             }
@@ -63,13 +56,8 @@
         // on round 1, expect errorRaised == false && processingOver == false
         // on round 2, expect errorRaised == true && processingOver == true
         if( renv.errorRaised() != renv.processingOver()) {
-            msgr.printMessage(ERROR, "FAILED");
+            messager.printMessage(ERROR, "FAILED");
         }
         return true;
     }
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
 }
--- a/langtools/test/tools/javac/processing/6499119/ClassProcessor.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/6499119/ClassProcessor.java	Wed Sep 29 23:27:57 2010 -0700
@@ -32,20 +32,17 @@
  * @test
  * @bug 6499119
  * @summary Created package-info class file modeled improperly
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile ClassProcessor.java package-info.java
  * @compile/process -cp . -processor ClassProcessor -Akind=java  java.lang.Object
  * @compile/process -cp . -processor ClassProcessor -Akind=class java.lang.Object
  */
 
 @SupportedOptions({ "gen", "expect" })
-@SupportedAnnotationTypes({"*"})
-public class ClassProcessor extends AbstractProcessor {
+public class ClassProcessor extends JavacTestingAbstractProcessor {
     int round = 1;
 
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
     public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
         if (round == 1) {
             System.out.println("-- Round 1 --");
@@ -71,8 +68,6 @@
     }
 
     private void createPackageFile() {
-        Filer filer = processingEnv.getFiler();
-
         String kind = processingEnv.getOptions().get("kind");
 
         File pkgInfo;
@@ -125,7 +120,6 @@
     }
 
     private void error(String msg) {
-        Messager messager = processingEnv.getMessager();
         messager.printMessage(Kind.ERROR, msg);
     }
 }
--- a/langtools/test/tools/javac/processing/6511613/DummyProcessor.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/6511613/DummyProcessor.java	Wed Sep 29 23:27:57 2010 -0700
@@ -26,15 +26,10 @@
 import javax.lang.model.element.*;
 import java.util.Set;
 
-@SupportedAnnotationTypes("*")
-public class DummyProcessor extends  AbstractProcessor {
+public class DummyProcessor extends JavacTestingAbstractProcessor {
    public boolean process(Set<? extends TypeElement> annotations,
                   RoundEnvironment roundEnv) {
        return true;
    }
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
 }
 
--- a/langtools/test/tools/javac/processing/6511613/clss41701.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/6511613/clss41701.java	Wed Sep 29 23:27:57 2010 -0700
@@ -26,7 +26,8 @@
  * @bug 6511613
  * @summary javac unexpectedly doesn't fail in some cases if an annotation processor specified
  *
- * @build DummyProcessor
+ * @library ../../lib
+ * @build JavacTestingAbstractProcessor DummyProcessor
  * @compile/fail clss41701.java
  * @compile/fail -processor DummyProcessor clss41701.java
  */
--- a/langtools/test/tools/javac/processing/6512707/T6512707.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/6512707/T6512707.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2010, 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,8 +26,9 @@
  * @bug 6512707
  * @summary "incompatible types" after (unrelated) annotation processing
  * @author  Peter Runge
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile T6512707.java
- *
  * @compile -processor T6512707 TestAnnotation.java
  */
 
@@ -41,16 +42,10 @@
  * Dummy processor to force bug 6512707 to show - it does not matter what
  * the annotation processor does for this bug.
  */
-@SupportedAnnotationTypes("*")
-public class T6512707 extends AbstractProcessor {
+public class T6512707 extends JavacTestingAbstractProcessor {
 
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnv) {
-        return(false);
-    }
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
+        return false;
     }
 }
--- a/langtools/test/tools/javac/processing/6634138/T6634138.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/6634138/T6634138.java	Wed Sep 29 23:27:57 2010 -0700
@@ -26,6 +26,8 @@
  * @bug 6634138
  * @author  Joseph D. Darcy
  * @summary Verify source files output after processing is over are compiled
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile T6634138.java
  * @compile -processor T6634138 Dummy.java
  * @run main ExerciseDependency
@@ -44,10 +46,7 @@
 import javax.lang.model.element.*;
 import javax.lang.model.util.*;
 
-@SupportedAnnotationTypes("*")
-public class T6634138 extends AbstractProcessor {
-    private Filer filer;
-
+public class T6634138 extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnvironment) {
         // Write out files *after* processing is over.
@@ -77,16 +76,6 @@
         }
         return true;
     }
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
-    public void init(ProcessingEnvironment processingEnv) {
-        super.init(processingEnv);
-        filer    = processingEnv.getFiler();
-    }
 }
 
 
--- a/langtools/test/tools/javac/processing/T6439826.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/T6439826.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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
@@ -48,8 +48,7 @@
         StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, null);
         Iterable<? extends JavaFileObject> files =
             fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, T6439826.class.getName()+".java")));
-        Iterable<String> opts = Arrays.asList("-source","1.6",
-                                              "-proc:only",
+        Iterable<String> opts = Arrays.asList("-proc:only",
                                               "-processor", "T6439826",
                                               "-processorpath", testClasses);
         StringWriter out = new StringWriter();
--- a/langtools/test/tools/javac/processing/T6920317.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/T6920317.java	Wed Sep 29 23:27:57 2010 -0700
@@ -25,6 +25,7 @@
  * @test
  * @bug 6920317
  * @summary package-info.java file has to be specified on the javac cmdline, else it will not be avail
+ * @library ../lib
  */
 
 import java.io.*;
@@ -349,12 +350,7 @@
     /** Annotation processor used to verify the expected value for the
         package annotations found by javac. */
     @SupportedOptions({ "gen", "expect" })
-    @SupportedAnnotationTypes({"*"})
-    public static class Processor extends AbstractProcessor {
-        public SourceVersion getSupportedSourceVersion() {
-            return SourceVersion.latest();
-        }
-
+    public static class Processor extends JavacTestingAbstractProcessor {
         public boolean process(Set<? extends TypeElement> annots, RoundEnvironment renv) {
             round++;
             System.err.println("Round " + round + " annots:" + annots + " rootElems:" + renv.getRootElements());
--- a/langtools/test/tools/javac/processing/environment/TestSourceVersion.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/environment/TestSourceVersion.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +26,8 @@
  * @bug 6402506
  * @summary Test that getSourceVersion works properly
  * @author  Joseph D. Darcy
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile TestSourceVersion.java
  * @compile -processor TestSourceVersion -proc:only -source 1.2 -AExpectedVersion=RELEASE_2 HelloWorld.java
  * @compile -processor TestSourceVersion -proc:only -source 1.3 -AExpectedVersion=RELEASE_3 HelloWorld.java
@@ -52,9 +54,8 @@
  * This processor checks that ProcessingEnvironment.getSourceVersion()
  * is consistent with the setting of the -source option.
  */
-@SupportedAnnotationTypes("*")
 @SupportedOptions("ExpectedVersion")
-public class TestSourceVersion extends AbstractProcessor {
+public class TestSourceVersion extends JavacTestingAbstractProcessor {
 
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnvironment) {
@@ -68,9 +69,4 @@
 
         return true;
     }
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
 }
--- a/langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +26,8 @@
  * @bug 6397298 6400986 6425592 6449798 6453386 6508401 6498938 6911854
  * @summary Tests that getElementsAnnotatedWith works properly.
  * @author  Joseph D. Darcy
+ * @library ../../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile TestElementsAnnotatedWith.java
  * @compile InheritedAnnotation.java
  * @compile -processor TestElementsAnnotatedWith -proc:only SurfaceAnnotations.java
@@ -57,16 +59,13 @@
  * getElementsAnnotatedWith is consistent with the expected results
  * stored in an AnnotatedElementInfo annotation.
  */
-@SupportedAnnotationTypes("*")
 @AnnotatedElementInfo(annotationName="java.lang.SuppressWarnings", expectedSize=0, names={})
-public class TestElementsAnnotatedWith extends AbstractProcessor {
+public class TestElementsAnnotatedWith extends JavacTestingAbstractProcessor {
 
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnvironment) {
-        Elements elementUtils = processingEnv.getElementUtils();
-
         TypeElement annotatedElementInfoElement =
-            elementUtils.getTypeElement("AnnotatedElementInfo");
+            elements.getTypeElement("AnnotatedElementInfo");
         Set<? extends Element> resultsMeta = Collections.emptySet();
         Set<? extends Element> resultsBase = Collections.emptySet();
 
@@ -93,9 +92,7 @@
 
                 resultsMeta =
                     roundEnvironment.
-                    getElementsAnnotatedWith(elementUtils.
-                                             getTypeElement(annotatedElementInfo.
-                                                            annotationName())) ;
+                    getElementsAnnotatedWith(elements.getTypeElement(annotatedElementInfo.annotationName()));
 
                 System.err.println("Results: " + resultsMeta);
 
@@ -167,9 +164,4 @@
             throw new RuntimeException("Illegal argument exception not thrown");
         } catch(IllegalArgumentException iae) {}
     }
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
 }
--- a/langtools/test/tools/javac/processing/errors/TestFatalityOfParseErrors.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/errors/TestFatalityOfParseErrors.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +26,9 @@
  * @bug 6403459
  * @summary Test that generating programs with syntax errors is a fatal condition
  * @author  Joseph D. Darcy
+ * @library ../../lib
+ * @build JavacTestingAbstractProcessor
+ * @compile TestReturnCode.java
  * @compile TestFatalityOfParseErrors.java
  * @compile/fail -XprintRounds -processor TestFatalityOfParseErrors -proc:only TestFatalityOfParseErrors.java
  */
@@ -45,11 +48,8 @@
  * Write out an incomplete source file and observe that the next round
  * is marked as an error.
  */
-@SupportedAnnotationTypes("*")
-public class TestFatalityOfParseErrors extends AbstractProcessor {
+public class TestFatalityOfParseErrors extends JavacTestingAbstractProcessor {
     int round = 0;
-    Messager messager;
-    Filer filer;
 
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnvironment) {
@@ -87,14 +87,4 @@
         }
         return true;
     }
-
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
-    public void init(ProcessingEnvironment processingEnv) {
-        super.init(processingEnv);
-        messager = processingEnv.getMessager();
-        filer    = processingEnv.getFiler();
-    }
 }
--- a/langtools/test/tools/javac/processing/errors/TestOptionSyntaxErrors.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/errors/TestOptionSyntaxErrors.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +26,8 @@
  * @bug 6406212
  * @summary Test that annotation processor options with illegal syntax are rejected
  * @author  Joseph D. Darcy
+ * @library ../../lib
+ * @build JavacTestingAbstractProcessor
  * @compile TestOptionSyntaxErrors.java
  * @compile/fail -A TestOptionSyntaxErrors.java
  * @compile/fail -A8adOption TestOptionSyntaxErrors.java
@@ -46,14 +48,9 @@
 /**
  * No-op processor; should not be run.
  */
-@SupportedAnnotationTypes("*")
-public class TestOptionSyntaxErrors extends AbstractProcessor {
+public class TestOptionSyntaxErrors extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnvironment) {
         return true;
     }
-
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
 }
--- a/langtools/test/tools/javac/processing/errors/TestReturnCode.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/errors/TestReturnCode.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +26,8 @@
  * @bug 6403468
  * @summary Test that an erroneous return code results from raising an error.
  * @author  Joseph D. Darcy
+ * @library ../../lib
+ * @build JavacTestingAbstractProcessor
  * @compile TestReturnCode.java
  *
  * @compile      -processor TestReturnCode -proc:only                                                                   Foo.java
@@ -60,20 +62,17 @@
  * This processor raises errors or throws exceptions on different
  * rounds to allow the return code to be test.
  */
-@SupportedAnnotationTypes("*")
 @SupportedOptions({"ErrorOnFirst",
                    "ErrorOnLast",
                    "ExceptionOnFirst",
                    "ExceptionOnLast"})
-public class TestReturnCode extends AbstractProcessor {
+public class TestReturnCode extends JavacTestingAbstractProcessor {
 
     private boolean errorOnFirst;
     private boolean errorOnLast;
     private boolean exceptionOnFirst;
     private boolean exceptionOnLast;
 
-    private Messager messager;
-
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnv) {
         if (!roundEnv.processingOver()) {
@@ -103,11 +102,5 @@
         errorOnLast     = keySet.contains("ErrorOnLast");
         exceptionOnFirst  = keySet.contains("ExceptionOnFirst");
         exceptionOnLast = keySet.contains("ExceptionOnLast");
-        messager = processingEnv.getMessager();
-    }
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
     }
 }
--- a/langtools/test/tools/javac/processing/filer/TestFilerConstraints.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/filer/TestFilerConstraints.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +26,7 @@
  * @bug 6380018 6453386 6457283
  * @summary Test that the constraints guaranteed by the Filer and maintained
  * @author  Joseph D. Darcy
+ * @library ../../lib
  * @build TestFilerConstraints
  * @compile -encoding iso-8859-1 -processor TestFilerConstraints -proc:only TestFilerConstraints.java
  */
@@ -69,11 +70,8 @@
  *
  * </ul>
  */
-@SupportedAnnotationTypes("*")
-public class TestFilerConstraints extends AbstractProcessor {
+public class TestFilerConstraints extends JavacTestingAbstractProcessor {
     private int round = 0;
-    private Messager messager;
-    private Filer filer;
 
     private PrintWriter  pw_src1 = null;
     private PrintWriter  pw_src2 = null;
@@ -167,17 +165,6 @@
         return true;
     }
 
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
-    public void init(ProcessingEnvironment processingEnv) {
-        super.init(processingEnv);
-        messager = processingEnv.getMessager();
-        filer    = processingEnv.getFiler();
-
-    }
-
     /**
      * Test that the single expected expected type, name, is the root
      * element.
--- a/langtools/test/tools/javac/processing/filer/TestGetResource.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/filer/TestGetResource.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,8 @@
  * @bug 6380018 6449798
  * @summary Test Filer.getResource
  * @author  Joseph D. Darcy
- * @build TestGetResource
+ * @library ../../lib
+ * @build  JavacTestingAbstractProcessor TestGetResource
  * @compile -processor TestGetResource -proc:only -Aphase=write TestGetResource.java
  * @compile -processor TestGetResource -proc:only -Aphase=read  TestGetResource.java
  */
@@ -49,13 +50,8 @@
  * first run of the annotation processor, write out a resource file
  * and on the second run read it in.
  */
-@SupportedAnnotationTypes("*")
 @SupportedOptions("phase")
-public class TestGetResource extends AbstractProcessor {
-    private Messager messager;
-    private Filer filer;
-    private Map<String,String> options;
-
+public class TestGetResource extends JavacTestingAbstractProcessor {
     private static String CONTENTS = "Hello World.";
     private static String PKG = "";
     private static String RESOURCE_NAME = "Resource1";
@@ -92,15 +88,4 @@
         }
         return false;
     }
-
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
-    public void init(ProcessingEnvironment processingEnv) {
-        super.init(processingEnv);
-        messager = processingEnv.getMessager();
-        filer    = processingEnv.getFiler();
-        options  = processingEnv.getOptions();
-    }
 }
--- a/langtools/test/tools/javac/processing/filer/TestGetResource2.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/filer/TestGetResource2.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +24,7 @@
 /* @test
  * @bug 6929404
  * @summary Filer.getResource(SOURCE_PATH, ...) does not work when -sourcepath contains >1 entry
+ * @library ../../lib
  */
 
 import java.io.*;
@@ -114,8 +115,7 @@
             throw new Exception(errors + " errors occurred");
     }
 
-    @SupportedAnnotationTypes("*")
-    static class AnnoProc extends AbstractProcessor {
+    static class AnnoProc extends JavacTestingAbstractProcessor {
 
         public @Override boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
             if (roundEnv.processingOver()) {
@@ -123,27 +123,23 @@
             }
 
             try {
-                FileObject resource = processingEnv.getFiler().getResource(StandardLocation.SOURCE_PATH, "resources", "file.txt");
+                FileObject resource = filer.getResource(StandardLocation.SOURCE_PATH, "resources", "file.txt");
                 try {
                     resource.openInputStream().close();
-                    processingEnv.getMessager().printMessage(Kind.NOTE, "found: " + resource.toUri());
+                    messager.printMessage(Kind.NOTE, "found: " + resource.toUri());
                     return true;
                 } catch (IOException x) {
-                    processingEnv.getMessager().printMessage(Kind.ERROR, "could not read: " + resource.toUri());
+                    messager.printMessage(Kind.ERROR, "could not read: " + resource.toUri());
                     x.printStackTrace();
                 }
             } catch (IOException x) {
-                processingEnv.getMessager().printMessage(Kind.ERROR, "did not find resource");
+                messager.printMessage(Kind.ERROR, "did not find resource");
                 x.printStackTrace();
             }
 
             return false;
         }
 
-        @Override
-        public SourceVersion getSupportedSourceVersion() {
-            return SourceVersion.latest();
-        }
     }
 
     private File write(File dir, String path, String contents) throws IOException {
--- a/langtools/test/tools/javac/processing/filer/TestInvalidRelativeNames.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/filer/TestInvalidRelativeNames.java	Wed Sep 29 23:27:57 2010 -0700
@@ -25,6 +25,8 @@
  * @test
  * @bug 6502392
  * @summary Invalid relative names for Filer.createResource and Filer.getResource
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile TestInvalidRelativeNames.java
  * @compile/process -processor TestInvalidRelativeNames java.lang.Object
  */
@@ -37,30 +39,13 @@
 import javax.tools.Diagnostic;
 import javax.tools.StandardLocation;
 
-
-@SupportedAnnotationTypes("*")
-public class TestInvalidRelativeNames extends AbstractProcessor {
+public class TestInvalidRelativeNames extends JavacTestingAbstractProcessor {
     enum Kind { CREATE_WRITER, GET_READER, CREATE_OUTPUT_STREAM, GET_INPUT_STREAM };
 
     static final String[] invalidRelativeNames = {
             "/boo", "goo/../hoo", "./ioo", ""
     };
 
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
-    Filer filer;
-    Messager messager;
-
-    @Override
-    public void init(ProcessingEnvironment pEnv) {
-        super.init(pEnv);
-        filer = processingEnv.getFiler();
-        messager = processingEnv.getMessager();
-    }
-
     public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
         if (roundEnv.processingOver()) {
             for (String relative: invalidRelativeNames) {
--- a/langtools/test/tools/javac/processing/filer/TestLastRound.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/filer/TestLastRound.java	Wed Sep 29 23:27:57 2010 -0700
@@ -24,6 +24,8 @@
 /*
  * @test 6966604
  * @summary JavacFiler not correctly notified of lastRound
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile TestLastRound.java
  * @compile/fail/ref=TestLastRound.out -XDrawDiagnostics -Werror -proc:only -processor TestLastRound TestLastRound.java
  */
@@ -35,12 +37,10 @@
 import javax.lang.model.element.*;
 import javax.tools.*;
 
-@SupportedAnnotationTypes("*")
-public class TestLastRound extends AbstractProcessor {
+public class TestLastRound extends JavacTestingAbstractProcessor {
     @Override
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnv) {
-        Filer filer = processingEnv.getFiler();
         if (roundEnv.processingOver()) {
             try {
                 JavaFileObject fo = filer.createSourceFile("LastRound.java");
@@ -52,9 +52,4 @@
         }
         return true;
     }
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
 }
--- a/langtools/test/tools/javac/processing/filer/TestPackageInfo.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/filer/TestPackageInfo.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +26,8 @@
  * @bug 6380018 6392177
  * @summary Test the ability to create and process package-info.java files
  * @author  Joseph D. Darcy
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile TestPackageInfo.java
  * @compile -processor TestPackageInfo -proc:only foo/bar/package-info.java TestPackageInfo.java
  */
@@ -49,13 +51,7 @@
  * 1) Visibility of package-info files from the command line
  * 2) Visibility of generated package-info.java source files
  */
-@SupportedAnnotationTypes("*")
-public class TestPackageInfo extends AbstractProcessor {
-    private Elements eltUtils;
-    private Messager messager;
-    private Filer filer;
-    private Map<String,String> options;
-
+public class TestPackageInfo extends JavacTestingAbstractProcessor {
     private int round = 0;
 
     public boolean process(Set<? extends TypeElement> annotations,
@@ -64,11 +60,7 @@
 
         // Verify annotations are as expected
         Set<TypeElement> expectedAnnotations = new HashSet<TypeElement>();
-        if (round == 1)
-            expectedAnnotations.add(eltUtils.
-                                    getTypeElement("javax.annotation.processing.SupportedAnnotationTypes"));
-        expectedAnnotations.add(eltUtils.
-                                getTypeElement("java.lang.SuppressWarnings"));
+        expectedAnnotations.add(eltUtils.getTypeElement("java.lang.SuppressWarnings"));
 
         if (!roundEnv.processingOver()) {
             System.out.println("\nRound " + round);
@@ -127,16 +119,4 @@
         }
         return false;
     }
-
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
-    public void init(ProcessingEnvironment processingEnv) {
-        super.init(processingEnv);
-        eltUtils = processingEnv.getElementUtils();
-        messager = processingEnv.getMessager();
-        filer    = processingEnv.getFiler();
-        options  = processingEnv.getOptions();
-    }
 }
--- a/langtools/test/tools/javac/processing/messager/6362067/T6362067.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/messager/6362067/T6362067.java	Wed Sep 29 23:27:57 2010 -0700
@@ -2,39 +2,34 @@
  * @test  /nodynamiccopyright/
  * @bug     6362067
  * @summary Messager methods do not print out source position information
- * @build   T6362067
+ * @library ../../../lib
+ * @build   JavacTestingAbstractProcessor T6362067
  * @compile -processor T6362067 -proc:only T6362067.java
  * @compile/ref=T6362067.out -XDrawDiagnostics -processor T6362067 -proc:only T6362067.java
  */
-
 import java.util.Set;
 import javax.annotation.processing.*;
 import javax.lang.model.element.*;
 import static javax.tools.Diagnostic.Kind.*;
 
-@Deprecated // convenient test annotation
-@SupportedAnnotationTypes("*")
-public class T6362067 extends AbstractProcessor {
+@Deprecated // convenient test annotations
+@SuppressWarnings({""})
+public class T6362067 extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annos,
                            RoundEnvironment roundEnv) {
-        Messager msgr = processingEnv.getMessager();
+
         for (Element e: roundEnv.getRootElements()) {
-            msgr.printMessage(NOTE, "note:elem", e);
+            messager.printMessage(NOTE, "note:elem", e);
             for (AnnotationMirror a: e.getAnnotationMirrors()) {
-                msgr.printMessage(NOTE, "note:anno", e, a);
+                messager.printMessage(NOTE, "note:anno", e, a);
                 for (AnnotationValue v: a.getElementValues().values()) {
-                    msgr.printMessage(NOTE, "note:value", e, a, v);
+                    messager.printMessage(NOTE, "note:value", e, a, v);
                 }
-
             }
         }
+
         if (roundEnv.processingOver())
-            msgr.printMessage(NOTE, "note:nopos");
+            messager.printMessage(NOTE, "note:nopos");
         return true;
     }
-
-    @Override
-    public javax.lang.model.SourceVersion getSupportedSourceVersion() {
-        return javax.lang.model.SourceVersion.latest();
-    }
 }
--- a/langtools/test/tools/javac/processing/messager/MessagerBasics.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/messager/MessagerBasics.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2010, 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,6 +26,8 @@
  * @bug     6341173 6341072
  * @summary Test presence of Messager methods
  * @author  Joseph D. Darcy
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile MessagerBasics.java
  * @compile -processor MessagerBasics -proc:only MessagerBasics.java
  * @compile/fail -processor MessagerBasics -proc:only -AfinalError MessagerBasics.java
@@ -39,18 +41,16 @@
 import javax.lang.model.util.*;
 import static javax.tools.Diagnostic.Kind.*;
 
-@SupportedAnnotationTypes("*")
 @SupportedOptions("finalError")
-public class MessagerBasics extends AbstractProcessor {
+public class MessagerBasics extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnv) {
-        Messager m = processingEnv.getMessager();
         if (roundEnv.processingOver()) {
             if (processingEnv.getOptions().containsKey("finalError"))
-                m.printMessage(ERROR,   "Does not compute");
+                messager.printMessage(ERROR,   "Does not compute");
             else {
-                m.printMessage(NOTE,    "Post no bills");
-                m.printMessage(WARNING, "Beware the ides of March!");
+                messager.printMessage(NOTE,    "Post no bills");
+                messager.printMessage(WARNING, "Beware the ides of March!");
             }
         }
         return true;
--- a/langtools/test/tools/javac/processing/model/6194785/T6194785.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/6194785/T6194785.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +26,8 @@
  * @bug     6194785
  * @summary ParameterDeclaration.getSimpleName does not return actual name from class files
  * @author  Peter von der Ah\u00e9
+ * @library ../../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile -g T6194785.java T6194785a.java
  * @compile -processor T6194785 foo.T6194785a T6194785.java
  */
@@ -36,13 +38,10 @@
 import javax.lang.model.util.*;
 import static javax.tools.Diagnostic.Kind.*;
 
-@SupportedAnnotationTypes("*")
-public class T6194785 extends AbstractProcessor {
+public class T6194785 extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnvironment)
     {
-        final Messager log = processingEnv.getMessager();
-        final Elements elements = processingEnv.getElementUtils();
         class Scan extends ElementScanner7<Void,Void> {
             @Override
             public Void visitExecutable(ExecutableElement e, Void ignored) {
--- a/langtools/test/tools/javac/processing/model/6341534/T6341534.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/6341534/T6341534.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +27,8 @@
  * @summary PackageElement.getEnclosedElements results in NullPointerException from parse(JavaCompiler.java:429)
  * @author  Steve Sides
  * @author  Peter von der Ahe
+ * @library ../../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile T6341534.java
  * @compile -proc:only -processor T6341534 dir/package-info.java
  * @compile -processor T6341534 dir/package-info.java
@@ -40,20 +42,11 @@
 import java.util.Set;
 import static javax.tools.Diagnostic.Kind.*;
 
-@SupportedAnnotationTypes("*")
-public class T6341534 extends AbstractProcessor {
-    Elements elements;
-    Messager messager;
-    public void init(ProcessingEnvironment penv)  {
-        super.init(penv);
-        elements = penv.getElementUtils();
-        messager = processingEnv.getMessager();
-    }
-
+public class T6341534 extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv)  {
         messager.printMessage(NOTE,
-                              String.valueOf(elements.getPackageElement("no.such.package")));
-        PackageElement dir = elements.getPackageElement("dir");
+                              String.valueOf(eltUtils.getPackageElement("no.such.package")));
+        PackageElement dir = eltUtils.getPackageElement("dir");
         messager.printMessage(NOTE, dir.getQualifiedName().toString());
         for (Element e : dir.getEnclosedElements())
             messager.printMessage(NOTE, e.toString());
--- a/langtools/test/tools/javac/processing/model/element/TestAnonClassNames.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/element/TestAnonClassNames.java	Wed Sep 29 23:27:57 2010 -0700
@@ -26,7 +26,8 @@
  * @bug 6449781
  * @summary Test that reported names of anonymous classes are non-null.
  * @author  Joseph D. Darcy
- * @build TestAnonSourceNames
+ * @library ../../../lib
+ * @build   JavacTestingAbstractProcessor TestAnonSourceNames
  * @compile -processor TestAnonSourceNames TestAnonClassNames.java
  * @run main TestAnonClassNames
  */
@@ -141,8 +142,7 @@
 /**
  * Probe at the various kinds of names of a type element.
  */
-@SupportedAnnotationTypes("*")
-class ClassNameProber extends AbstractProcessor {
+class ClassNameProber extends JavacTestingAbstractProcessor {
     public ClassNameProber(){super();}
 
     private boolean classesFound=false;
@@ -174,8 +174,4 @@
         }
         return true;
     }
-
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
 }
--- a/langtools/test/tools/javac/processing/model/element/TestAnonSourceNames.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/element/TestAnonSourceNames.java	Wed Sep 29 23:27:57 2010 -0700
@@ -36,8 +36,7 @@
  * Using the tree API, retrieve element representations of anonymous
  * classes and verify their names are as specified.
  */
-@SupportedAnnotationTypes("*")
-public class TestAnonSourceNames extends AbstractProcessor {
+public class TestAnonSourceNames extends JavacTestingAbstractProcessor {
 
    public boolean process(Set<? extends TypeElement> annotations,
                           RoundEnvironment roundEnv) {
@@ -84,9 +83,4 @@
            return super.visitClass(node, cu);
        }
    }
-
-   @Override
-   public SourceVersion getSupportedSourceVersion() {
-       return SourceVersion.latest();
-   }
 }
--- a/langtools/test/tools/javac/processing/model/element/TestElement.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/element/TestElement.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,8 @@
  * @bug 6453386
  * @summary Test basic properties of javax.lang.element.Element
  * @author  Joseph D. Darcy
- * @build TestElement
+ * @library ../../../lib
+ * @build   JavacTestingAbstractProcessor TestElement
  * @compile -processor TestElement -proc:only TestElement.java
  */
 
@@ -43,8 +44,7 @@
 /**
  * Test basic workings of javax.lang.element.Element
  */
-@SupportedAnnotationTypes("*")
-public class TestElement extends AbstractProcessor {
+public class TestElement extends JavacTestingAbstractProcessor {
     /**
      * For now, just check that constructors have a simple name of
      * "<init>".
@@ -66,9 +66,4 @@
         }
         return true;
     }
-
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
 }
--- a/langtools/test/tools/javac/processing/model/element/TestNames.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/element/TestNames.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,8 @@
  * @bug 6380016
  * @summary Test that the constraints guaranteed by the Filer and maintained
  * @author  Joseph D. Darcy
- * @build TestNames
+ * @library ../../../lib
+ * @build   JavacTestingAbstractProcessor TestNames
  * @compile -processor TestNames -proc:only TestNames.java
  */
 
@@ -45,11 +46,8 @@
 /**
  * Basic tests of semantics of javax.lang.model.element.Name
  */
-@SupportedAnnotationTypes("*")
-public class TestNames extends AbstractProcessor {
+public class TestNames extends JavacTestingAbstractProcessor {
     private int round = 0;
-    private Filer filer;
-    private Elements eltUtils;
 
     String stringStringName = "java.lang.String";
     Name stringName = null;
@@ -106,16 +104,6 @@
         return true;
     }
 
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
-    public void init(ProcessingEnvironment processingEnv) {
-        super.init(processingEnv);
-        filer    = processingEnv.getFiler();
-        eltUtils = processingEnv.getElementUtils();
-    }
-
     private static class Pseudonym implements Name {
         private String name;
 
--- a/langtools/test/tools/javac/processing/model/element/TestPackageElement.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/element/TestPackageElement.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,8 @@
  * @bug 6449798 6399404
  * @summary Test basic workings of PackageElement
  * @author  Joseph D. Darcy
- * @build TestPackageElement
+ * @library ../../../lib
+ * @build   JavacTestingAbstractProcessor TestPackageElement
  * @compile -processor TestPackageElement -proc:only TestPackageElement.java
  */
 
@@ -43,11 +44,7 @@
 /**
  * Test basic workings of PackageElement.
  */
-@SupportedAnnotationTypes("*")
-public class TestPackageElement extends AbstractProcessor {
-    private Filer filer;
-    private Elements eltUtils;
-
+public class TestPackageElement extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnv) {
         if (!roundEnv.processingOver()) {
@@ -71,15 +68,4 @@
         }
         return true;
     }
-
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
-    public void init(ProcessingEnvironment processingEnv) {
-        super.init(processingEnv);
-        filer    = processingEnv.getFiler();
-        eltUtils = processingEnv.getElementUtils();
-    }
-
 }
--- a/langtools/test/tools/javac/processing/model/element/TestResourceElement.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/element/TestResourceElement.java	Wed Sep 29 23:27:57 2010 -0700
@@ -26,7 +26,8 @@
  * @bug 6967842
  * @summary Element not returned from tree API for ARM resource variables.
  * @author A. Sundararajan
- * @build TestResourceElement
+ * @library ../../../lib
+ * @build   JavacTestingAbstractProcessor TestResourceElement
  * @compile -processor TestResourceElement -proc:only TestResourceElement.java
  */
 
@@ -37,8 +38,7 @@
 import com.sun.source.tree.*;
 import com.sun.source.util.*;
 
-@SupportedAnnotationTypes("*")
-public class TestResourceElement extends AbstractProcessor implements AutoCloseable {
+public class TestResourceElement extends JavacTestingAbstractProcessor implements AutoCloseable {
     public boolean process(Set<? extends TypeElement> annotations,
                           RoundEnvironment roundEnv) {
        if (!roundEnv.processingOver()) {
@@ -88,9 +88,4 @@
            return trvElement;
        }
    }
-
-   @Override
-   public SourceVersion getSupportedSourceVersion() {
-       return SourceVersion.latest();
-   }
 }
--- a/langtools/test/tools/javac/processing/model/element/TestResourceVariable.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/element/TestResourceVariable.java	Wed Sep 29 23:27:57 2010 -0700
@@ -26,7 +26,8 @@
  * @bug  6911256 6964740 6967842
  * @summary Test that the resource variable kind is appropriately set
  * @author  Joseph D. Darcy
- * @build TestResourceVariable
+ * @library ../../../lib
+ * @build   JavacTestingAbstractProcessor TestResourceVariable
  * @compile -processor TestResourceVariable -proc:only TestResourceVariable.java
  */
 
@@ -48,8 +49,7 @@
  * resource of an ARM block and verify their kind tags are set
  * appropriately.
  */
-@SupportedAnnotationTypes("*")
-public class TestResourceVariable extends AbstractProcessor implements AutoCloseable {
+public class TestResourceVariable extends JavacTestingAbstractProcessor implements AutoCloseable {
     int resourceVariableCount = 0;
 
     public boolean process(Set<? extends TypeElement> annotations,
@@ -105,9 +105,4 @@
            return super.visitVariable(node, cu);
        }
    }
-
-   @Override
-   public SourceVersion getSupportedSourceVersion() {
-       return SourceVersion.latest();
-   }
 }
--- a/langtools/test/tools/javac/processing/model/element/TypeParamBounds.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/element/TypeParamBounds.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,8 @@
  * @bug     6423972
  * @summary Tests TypeParameter.getBounds.
  * @author  Scott Seligman
- * @build   TypeParamBounds
+ * @library ../../../lib
+ * @build   JavacTestingAbstractProcessor TypeParamBounds
  * @compile -processor TypeParamBounds -proc:only TypeParamBounds.java
  */
 
@@ -40,18 +41,7 @@
 import javax.lang.model.type.*;
 import javax.lang.model.util.*;
 
-@SupportedAnnotationTypes("*")
-public class TypeParamBounds extends AbstractProcessor {
-
-    Elements elements;
-    Types types;
-
-    public void init(ProcessingEnvironment penv) {
-        super.init(penv);
-        elements = penv.getElementUtils();
-        types = penv.getTypeUtils();
-    }
-
+public class TypeParamBounds extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annoTypes,
                            RoundEnvironment round) {
         if (!round.processingOver())
@@ -59,11 +49,6 @@
         return true;
     }
 
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
     private void doit(Set<? extends TypeElement> annoTypes,
                       RoundEnvironment round) {
         TypeElement gen = elements.getTypeElement("TypeParamBounds.Gen");
@@ -91,7 +76,6 @@
 
 
     // Fodder for the processor
-
     static class Gen<T, U extends Object, V extends Number, W extends U,
                      X extends Runnable, Y extends CharSequence & Runnable,
                      Z extends Object & Runnable> {
--- a/langtools/test/tools/javac/processing/model/type/MirroredTypeEx/OverEager.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/type/MirroredTypeEx/OverEager.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +26,8 @@
  * @bug     6362178
  * @summary MirroredType[s]Exception shouldn't be created too eagerly
  * @author  Scott Seligman
+ * @library ../../../../lib
+ * @build JavacTestingAbstractProcessor
  * @compile -g OverEager.java
  * @compile -processor OverEager -proc:only OverEager.java
  */
@@ -40,17 +42,7 @@
 
 @SupportedAnnotationTypes("IAm")
 @IAm(OverEager.class)
-public class OverEager extends AbstractProcessor {
-
-    Elements elements;
-    Types types;
-
-    public void init(ProcessingEnvironment penv) {
-        super.init(penv);
-        elements = penv.getElementUtils();
-        types =  penv.getTypeUtils();
-    }
-
+public class OverEager extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annoTypes,
                            RoundEnvironment round) {
         if (!round.processingOver())
@@ -58,11 +50,6 @@
         return true;
     }
 
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
     private void doit(Set<? extends TypeElement> annoTypes,
                       RoundEnvironment round) {
         for (TypeElement t : typesIn(round.getRootElements())) {
--- a/langtools/test/tools/javac/processing/model/type/MirroredTypeEx/Plurality.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/type/MirroredTypeEx/Plurality.java	Wed Sep 29 23:27:57 2010 -0700
@@ -25,6 +25,8 @@
  * @test
  * @bug     6519115
  * @summary Verify MirroredTypeException vs MirroredTypesException is thrown
+ * @library ../../../../lib
+ * @build JavacTestingAbstractProcessor
  * @compile Plurality.java
  * @compile -processor Plurality -proc:only Plurality.java
  * @author  Joseph D. Darcy
@@ -38,25 +40,13 @@
 import javax.lang.model.type.*;
 import javax.lang.model.util.*;
 
-@SupportedAnnotationTypes("*")
 @P0
 @P1
 @P2
 @S1
-public class Plurality extends AbstractProcessor {
+public class Plurality extends JavacTestingAbstractProcessor {
     private boolean executed = false;
 
-    Elements elements;
-    Types types;
-
-    @Override
-    public void init(ProcessingEnvironment penv) {
-        super.init(penv);
-        elements = penv.getElementUtils();
-        types =  penv.getTypeUtils();
-    }
-
-
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnv) {
         if (!roundEnv.processingOver()) {
@@ -164,11 +154,6 @@
                                            toStringName);
         }
     }
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
 }
 
 @Retention(RetentionPolicy.RUNTIME)
--- a/langtools/test/tools/javac/processing/model/type/NoTypes.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/type/NoTypes.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +26,8 @@
  * @bug     6418666 6423973 6453386
  * @summary Test the NoTypes: VOID, PACKAGE, NONE
  * @author  Scott Seligman
+ * @library ../../../lib
+ * @build JavacTestingAbstractProcessor
  * @compile -g NoTypes.java
  * @compile -processor NoTypes -proc:only NoTypes.java
  */
@@ -39,18 +41,7 @@
 
 import static javax.lang.model.type.TypeKind.*;
 
-@SupportedAnnotationTypes("*")
-public class NoTypes extends AbstractProcessor {
-
-    Elements elements;
-    Types types;
-
-    public void init(ProcessingEnvironment penv) {
-        super.init(penv);
-        elements = penv.getElementUtils();
-        types =  penv.getTypeUtils();
-    }
-
+public class NoTypes extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annoTypes,
                            RoundEnvironment round) {
         if (!round.processingOver())
@@ -58,11 +49,6 @@
         return true;
     }
 
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
     private void doit(Set<? extends TypeElement> annoTypes,
                       RoundEnvironment round) {
 
--- a/langtools/test/tools/javac/processing/model/util/BinaryName.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/util/BinaryName.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,8 @@
  * @bug     6346251
  * @summary Test Elements.getBinaryName
  * @author  Scott Seligman
- * @build   BinaryName
+ * @library ../../../lib
+ * @build   JavacTestingAbstractProcessor BinaryName
  * @compile -processor BinaryName -proc:only BinaryName.java
  */
 
@@ -38,17 +39,8 @@
 
 import static javax.lang.model.util.ElementFilter.typesIn;
 
-@SupportedAnnotationTypes("*")
 @HelloIm("BinaryName")
-public class BinaryName extends AbstractProcessor {
-
-    Elements elements;
-
-    public void init(ProcessingEnvironment penv) {
-        super.init(penv);
-        elements = penv.getElementUtils();
-    }
-
+public class BinaryName extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> tes,
                            RoundEnvironment round) {
         if (round.processingOver()) return true;
--- a/langtools/test/tools/javac/processing/model/util/GetTypeElemBadArg.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/util/GetTypeElemBadArg.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,8 @@
  * @bug     6346506 6408241
  * @summary getTypeElement should tolerate a type that can't be found
  * @author  Scott Seligman
- * @build   GetTypeElemBadArg
+ * @library ../../../lib
+ * @build   JavacTestingAbstractProcessor GetTypeElemBadArg
  * @compile -processor GetTypeElemBadArg -proc:only GetTypeElemBadArg.java
  */
 
@@ -37,16 +38,7 @@
 import javax.lang.model.type.*;
 import javax.lang.model.util.*;
 
-@SupportedAnnotationTypes("*")
-public class GetTypeElemBadArg extends AbstractProcessor {
-
-    Elements elements;
-
-    public void init(ProcessingEnvironment penv) {
-        super.init(penv);
-        elements = penv.getElementUtils();
-    }
-
+public class GetTypeElemBadArg extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> tes,
                            RoundEnvironment round) {
         if (round.processingOver()) return true;
@@ -63,12 +55,6 @@
         return true;
     }
 
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
     private static void tellAbout(TypeElement t) {
         System.out.println(t);
         System.out.println(t.getClass());
--- a/langtools/test/tools/javac/processing/model/util/NoSupers.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/util/NoSupers.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,8 @@
  * @bug     6346453
  * @summary directSupertypes should return empty list if arg has no supertypes
  * @author  Scott Seligman
- * @build   NoSupers
+ * @library ../../../lib
+ * @build   JavacTestingAbstractProcessor NoSupers
  * @compile -processor NoSupers -proc:only NoSupers.java
  */
 
@@ -36,16 +37,7 @@
 import javax.lang.model.type.*;
 import javax.lang.model.util.*;
 
-@SupportedAnnotationTypes("*")
-public class NoSupers extends AbstractProcessor {
-
-    Types types;
-
-    public void init(ProcessingEnvironment penv) {
-        super.init(penv);
-        types = penv.getTypeUtils();
-    }
-
+public class NoSupers extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> tes,
                            RoundEnvironment round) {
         if (round.processingOver()) return true;
--- a/langtools/test/tools/javac/processing/model/util/OverridesSpecEx.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/util/OverridesSpecEx.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +26,8 @@
  * @bug     6453386
  * @summary Verify that example code in Elements.overrides works as spec'ed.
  * @author  Scott Seligman
+ * @library ../../../lib
+ * @build JavacTestingAbstractProcessor
  * @compile -g OverridesSpecEx.java
  * @compile -processor OverridesSpecEx -proc:only OverridesSpecEx.java
  */
@@ -39,19 +41,7 @@
 
 import static javax.lang.model.util.ElementFilter.*;
 
-
-@SupportedAnnotationTypes("*")
-public class OverridesSpecEx extends AbstractProcessor {
-
-    Elements elements;
-    Types types;
-
-    public void init(ProcessingEnvironment penv) {
-        super.init(penv);
-        elements = penv.getElementUtils();
-        types =  penv.getTypeUtils();
-    }
-
+public class OverridesSpecEx extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annoTypes,
                            RoundEnvironment round) {
         if (!round.processingOver())
@@ -59,11 +49,6 @@
         return true;
     }
 
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
     private void doit(Set<? extends TypeElement> annoTypes,
                       RoundEnvironment round) {
         TypeElement string = elements.getTypeElement("java.lang.String");
@@ -113,9 +98,7 @@
             throw new AssertionError("Bogus result");
     }
 
-
     // Fodder for the processor
-
     class A {
         public void m() {}
     }
--- a/langtools/test/tools/javac/processing/model/util/TypesBadArg.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/util/TypesBadArg.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,8 @@
  * @bug     6345812
  * @summary Validate argument kinds in Types utilities
  * @author  Scott Seligman
- * @build   TypesBadArg
+ * @library ../../../lib
+ * @build   JavacTestingAbstractProcessor TypesBadArg
  * @compile -processor TypesBadArg -proc:only TypesBadArg.java
  */
 
@@ -36,15 +37,9 @@
 import javax.lang.model.type.*;
 import javax.lang.model.util.*;
 
-@SupportedAnnotationTypes("*")
-public class TypesBadArg extends AbstractProcessor {
-
+public class TypesBadArg extends JavacTestingAbstractProcessor {
     boolean success = true;
 
-    public void init(ProcessingEnvironment penv) {
-        super.init(penv);
-    }
-
     public boolean process(Set<? extends TypeElement> tes,
                            RoundEnvironment round) {
         if (round.processingOver()) return true;
--- a/langtools/test/tools/javac/processing/model/util/deprecation/TestDeprecation.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/util/deprecation/TestDeprecation.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010 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,6 +26,8 @@
  * @bug 6392818
  * @summary Tests Elements.isDeprecated(Element)
  * @author  Joseph D. Darcy
+ * @library ../../../../lib
+ * @build JavacTestingAbstractProcessor
  * @compile TestDeprecation.java
  * @compile -processor TestDeprecation -proc:only Dep1.java
  * @compile Dep1.java
@@ -47,8 +49,7 @@
  * getElementsAnnotatedWith is consistent with the expected results
  * stored in an AnnotatedElementInfo annotation.
  */
-@SupportedAnnotationTypes("*")
-public class TestDeprecation extends AbstractProcessor {
+public class TestDeprecation extends JavacTestingAbstractProcessor {
 
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnv) {
@@ -98,9 +99,4 @@
             return failure;
         }
     }
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
 }
--- a/langtools/test/tools/javac/processing/model/util/directSupersOfErr/DirectSupersOfErr.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/util/directSupersOfErr/DirectSupersOfErr.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,8 @@
  * @bug     6346973
  * @summary directSupertypes(t) should not return t
  * @author  Scott Seligman
- * @build   DirectSupersOfErr
+ * @library ../../../../lib
+ * @build   JavacTestingAbstractProcessor DirectSupersOfErr
  * @compile -processor DirectSupersOfErr -proc:only C1.java
  */
 
@@ -37,16 +38,7 @@
 import javax.lang.model.util.*;
 import static javax.lang.model.util.ElementFilter.*;
 
-@SupportedAnnotationTypes("*")
-public class DirectSupersOfErr extends AbstractProcessor {
-
-    Types types;
-
-    public void init(ProcessingEnvironment penv) {
-        super.init(penv);
-        types = penv.getTypeUtils();
-    }
-
+public class DirectSupersOfErr extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> tes,
                            RoundEnvironment round) {
         if (round.processingOver()) return true;
--- a/langtools/test/tools/javac/processing/model/util/elements/TestGetConstantExpression.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/util/elements/TestGetConstantExpression.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2010, 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,8 @@
  * @bug 6471577 6517779
  * @summary Test Elements.getConstantExpression
  * @author  Joseph D. Darcy
- * @build TestGetConstantExpression
+ * @library ../../../../lib
+ * @build   JavacTestingAbstractProcessor TestGetConstantExpression
  * @compile -processor TestGetConstantExpression Foo.java
  */
 
@@ -44,10 +45,7 @@
 /**
  * Test basic workings of Elements.getConstantExpression.
  */
-@SupportedAnnotationTypes("*")
-public class TestGetConstantExpression extends AbstractProcessor {
-    private Elements eltUtils;
-    private Filer filer;
+public class TestGetConstantExpression extends JavacTestingAbstractProcessor {
     private int round = 1;
 
     /**
@@ -130,14 +128,4 @@
             return 0;
         }
     }
-
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
-    public void init(ProcessingEnvironment processingEnv) {
-        super.init(processingEnv);
-        eltUtils = processingEnv.getElementUtils();
-        filer    = processingEnv.getFiler();
-    }
 }
--- a/langtools/test/tools/javac/processing/model/util/elements/TestGetPackageOf.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/util/elements/TestGetPackageOf.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,8 @@
  * @bug 6453386
  * @summary Test Elements.getPackageOf
  * @author  Joseph D. Darcy
- * @build TestGetPackageOf
+ * @library ../../../../lib
+ * @build   JavacTestingAbstractProcessor TestGetPackageOf
  * @compile -processor TestGetPackageOf -proc:only TestGetPackageOf.java
  */
 
@@ -43,10 +44,7 @@
 /**
  * Test basic workings of Elements.getPackageOf
  */
-@SupportedAnnotationTypes("*")
-public class TestGetPackageOf extends AbstractProcessor {
-    private Elements eltUtils;
-
+public class TestGetPackageOf extends JavacTestingAbstractProcessor {
     /**
      * Check expected behavior on classes and packages.
      */
@@ -69,13 +67,4 @@
         }
         return true;
     }
-
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
-    public void init(ProcessingEnvironment processingEnv) {
-        super.init(processingEnv);
-        eltUtils = processingEnv.getElementUtils();
-    }
 }
--- a/langtools/test/tools/javac/processing/model/util/filter/TestIterables.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/model/util/filter/TestIterables.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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,6 +26,8 @@
  * @bug 6406164
  * @summary Test that ElementFilter iterable methods behave properly.
  * @author  Joseph D. Darcy
+ * @library ../../../../lib
+ * @build JavacTestingAbstractProcessor
  * @compile TestIterables.java
  * @compile -processor TestIterables -proc:only Foo1.java
  * @compile Foo1.java
@@ -51,9 +53,8 @@
  * results.
  */
 @SupportedAnnotationTypes("ExpectedElementCounts")
-@ExpectedElementCounts(methods=3)
-public class TestIterables extends AbstractProcessor {
-
+@ExpectedElementCounts(methods=2)
+public class TestIterables extends JavacTestingAbstractProcessor {
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnv) {
         if (!roundEnv.processingOver()) {
@@ -118,10 +119,4 @@
 
         return count1;
     }
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
 }
--- a/langtools/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java	Wed Sep 29 23:27:57 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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
@@ -50,7 +50,8 @@
 
 /**
  * This processor returns the supported source level as indicated by
- * the "SourceLevel" option.
+ * the "SourceLevel" option; therefore, don't use
+ * JavacTestingAbstractProcessor which returns the latest source level.
  */
 @SupportedAnnotationTypes("*")
 @SupportedOptions("SourceVersion")
--- a/langtools/test/tools/javac/processing/werror/WError1.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/werror/WError1.java	Wed Sep 29 23:27:57 2010 -0700
@@ -24,6 +24,8 @@
 /*
  * @test 6403456
  * @summary -Werror should work with annotation processing
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile WError1.java
  * @compile -proc:only -processor WError1 WError1.java
  * @compile/fail/ref=WError1.out -XDrawDiagnostics -Werror -proc:only -processor WError1 WError1.java
@@ -36,22 +38,15 @@
 import javax.lang.model.element.*;
 import javax.tools.*;
 
-@SupportedAnnotationTypes("*")
-public class WError1 extends AbstractProcessor {
+public class WError1 extends JavacTestingAbstractProcessor {
     @Override
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnv) {
-        Messager messager = processingEnv.getMessager();
         if (++round == 1) {
             messager.printMessage(Diagnostic.Kind.WARNING, "round 1");
         }
         return true;
     }
 
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
     int round = 0;
 }
--- a/langtools/test/tools/javac/processing/werror/WErrorGen.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/werror/WErrorGen.java	Wed Sep 29 23:27:57 2010 -0700
@@ -24,6 +24,8 @@
 /*
  * @test 6403456
  * @summary -Werror should work with annotation processing
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile WErrorGen.java
  * @compile -proc:only -processor WErrorGen WErrorGen.java
  * @compile/fail/ref=WErrorGen.out -XDrawDiagnostics -Werror -Xlint:rawtypes -processor WErrorGen WErrorGen.java
@@ -36,12 +38,10 @@
 import javax.lang.model.element.*;
 import javax.tools.*;
 
-@SupportedAnnotationTypes("*")
-public class WErrorGen extends AbstractProcessor {
+public class WErrorGen extends JavacTestingAbstractProcessor {
     @Override
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnv) {
-        Filer filer = processingEnv.getFiler();
         if (++round == 1) {
             try {
                 JavaFileObject fo = filer.createSourceFile("Gen");
@@ -54,10 +54,5 @@
         return true;
     }
 
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
     int round = 0;
 }
--- a/langtools/test/tools/javac/processing/werror/WErrorLast.java	Wed Sep 29 14:01:37 2010 -0700
+++ b/langtools/test/tools/javac/processing/werror/WErrorLast.java	Wed Sep 29 23:27:57 2010 -0700
@@ -24,6 +24,8 @@
 /*
  * @test 6403456
  * @summary -Werror should work with annotation processing
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor
  * @compile WErrorLast.java
  * @compile -proc:only -processor WErrorLast WErrorLast.java
  * @compile/fail/ref=WErrorLast.out -XDrawDiagnostics -Werror -proc:only -processor WErrorLast WErrorLast.java
@@ -36,20 +38,13 @@
 import javax.lang.model.element.*;
 import javax.tools.*;
 
-@SupportedAnnotationTypes("*")
-public class WErrorLast extends AbstractProcessor {
+public class WErrorLast extends JavacTestingAbstractProcessor {
     @Override
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnv) {
-        Messager messager = processingEnv.getMessager();
         if (roundEnv.processingOver()) {
             messager.printMessage(Diagnostic.Kind.WARNING, "last round");
         }
         return true;
     }
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
 }