6983738: Use a JavacTestingAbstractProcessor

Wed, 29 Sep 2010 23:27:57 -0700

author
darcy
date
Wed, 29 Sep 2010 23:27:57 -0700
changeset 699
d2aaaec153e8
parent 698
f94af0667151
child 700
7b413ac1a720

6983738: Use a JavacTestingAbstractProcessor
Reviewed-by: jjg

test/tools/javac/lib/JavacTestingAbstractProcessor.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/6348499/A.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/6348499/T6348499.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/6359313/T6359313.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/6365040/ProcBar.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/6365040/ProcFoo.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/6365040/T6365040.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/6413690/T6413690.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/6414633/A.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/6414633/T6414633.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/6430209/T6430209.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/6430209/b6341534.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/6499119/ClassProcessor.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/6511613/DummyProcessor.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/6511613/clss41701.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/6512707/T6512707.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/6634138/T6634138.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/T6439826.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/T6920317.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/environment/TestSourceVersion.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/errors/TestFatalityOfParseErrors.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/errors/TestOptionSyntaxErrors.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/errors/TestReturnCode.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/filer/TestFilerConstraints.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/filer/TestGetResource.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/filer/TestGetResource2.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/filer/TestInvalidRelativeNames.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/filer/TestLastRound.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/filer/TestPackageInfo.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/messager/6362067/T6362067.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/messager/MessagerBasics.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/6194785/T6194785.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/6341534/T6341534.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/element/TestAnonClassNames.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/element/TestAnonSourceNames.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/element/TestElement.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/element/TestNames.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/element/TestPackageElement.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/element/TestResourceElement.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/element/TestResourceVariable.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/element/TypeParamBounds.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/type/MirroredTypeEx/OverEager.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/type/MirroredTypeEx/Plurality.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/type/NoTypes.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/util/BinaryName.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/util/GetTypeElemBadArg.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/util/NoSupers.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/util/OverridesSpecEx.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/util/TypesBadArg.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/util/deprecation/TestDeprecation.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/util/directSupersOfErr/DirectSupersOfErr.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/util/elements/TestGetConstantExpression.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/util/elements/TestGetPackageOf.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/model/util/filter/TestIterables.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/warnings/TestSourceVersionWarnings.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/werror/WError1.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/werror/WErrorGen.java file | annotate | diff | comparison | revisions
test/tools/javac/processing/werror/WErrorLast.java file | annotate | diff | comparison | revisions
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/lib/JavacTestingAbstractProcessor.java	Wed Sep 29 23:27:57 2010 -0700
     1.3 @@ -0,0 +1,100 @@
     1.4 +/*
     1.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + */
    1.26 +
    1.27 +import java.util.*;
    1.28 +import javax.annotation.processing.*;
    1.29 +import javax.lang.model.SourceVersion;
    1.30 +import static javax.lang.model.SourceVersion.*;
    1.31 +import javax.lang.model.element.*;
    1.32 +import javax.lang.model.util.*;
    1.33 +
    1.34 +/**
    1.35 + * An abstract annotation processor tailored to javac regression testing.
    1.36 + */
    1.37 +public abstract class JavacTestingAbstractProcessor extends AbstractProcessor {
    1.38 +    private static final Set<String> allAnnotations;
    1.39 +
    1.40 +    static {
    1.41 +        Set<String> tmp = new HashSet<>();
    1.42 +        tmp.add("*");
    1.43 +        allAnnotations = Collections.unmodifiableSet(tmp);
    1.44 +    }
    1.45 +
    1.46 +    protected Elements eltUtils;
    1.47 +    protected Elements elements;
    1.48 +    protected Types    typeUtils;
    1.49 +    protected Types    types;
    1.50 +    protected Filer    filer;
    1.51 +    protected Messager messager;
    1.52 +    protected Map<String, String> options;
    1.53 +
    1.54 +    /**
    1.55 +     * Constructor for subclasses to call.
    1.56 +     */
    1.57 +    protected JavacTestingAbstractProcessor() {
    1.58 +        super();
    1.59 +    }
    1.60 +
    1.61 +    /**
    1.62 +     * Return the latest source version. Unless this method is
    1.63 +     * overridden, an {@code IllegalStateException} will be thrown if a
    1.64 +     * subclass has a {@code SupportedSourceVersion} annotation.
    1.65 +     */
    1.66 +    @Override
    1.67 +    public SourceVersion getSupportedSourceVersion() {
    1.68 +        SupportedSourceVersion ssv = this.getClass().getAnnotation(SupportedSourceVersion.class);
    1.69 +        if (ssv != null)
    1.70 +            throw new IllegalStateException("SupportedSourceVersion annotation not supported here.");
    1.71 +
    1.72 +        return SourceVersion.latest();
    1.73 +    }
    1.74 +
    1.75 +    /**
    1.76 +     * If the processor class is annotated with {@link
    1.77 +     * SupportedAnnotationTypes}, return an unmodifiable set with the
    1.78 +     * same set of strings as the annotation.  If the class is not so
    1.79 +     * annotated, a one-element set containing {@code "*"} is returned
    1.80 +     * to indicate all annotations are processed.
    1.81 +     *
    1.82 +     * @return the names of the annotation types supported by this
    1.83 +     * processor, or an empty set if none
    1.84 +     */
    1.85 +    @Override
    1.86 +    public Set<String> getSupportedAnnotationTypes() {
    1.87 +        SupportedAnnotationTypes sat = this.getClass().getAnnotation(SupportedAnnotationTypes.class);
    1.88 +        if (sat != null)
    1.89 +            return super.getSupportedAnnotationTypes();
    1.90 +        else
    1.91 +            return allAnnotations;
    1.92 +    }
    1.93 +
    1.94 +    @Override
    1.95 +    public void init(ProcessingEnvironment processingEnv) {
    1.96 +        super.init(processingEnv);
    1.97 +        elements = eltUtils  = processingEnv.getElementUtils();
    1.98 +        types = typeUtils = processingEnv.getTypeUtils();
    1.99 +        filer     = processingEnv.getFiler();
   1.100 +        messager  = processingEnv.getMessager();
   1.101 +        options   = processingEnv.getOptions();
   1.102 +    }
   1.103 +}
     2.1 --- a/test/tools/javac/processing/6348499/A.java	Wed Sep 29 14:01:37 2010 -0700
     2.2 +++ b/test/tools/javac/processing/6348499/A.java	Wed Sep 29 23:27:57 2010 -0700
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -27,10 +27,8 @@
    2.11  import javax.lang.model.*;
    2.12  import javax.lang.model.element.*;
    2.13  
    2.14 -@SupportedAnnotationTypes("*")
    2.15 -public class A extends AbstractProcessor {
    2.16 +public class A extends JavacTestingAbstractProcessor {
    2.17      public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv) {
    2.18 -        Filer filer = processingEnv.getFiler();
    2.19          try {
    2.20              OutputStream out = filer.createClassFile(getClass().getName()+"_0").openOutputStream();
    2.21              out.close();
    2.22 @@ -39,8 +37,4 @@
    2.23          }
    2.24          return true;
    2.25      }
    2.26 -    @Override
    2.27 -    public SourceVersion getSupportedSourceVersion() {
    2.28 -        return SourceVersion.latest();
    2.29 -    }
    2.30  }
     3.1 --- a/test/tools/javac/processing/6348499/T6348499.java	Wed Sep 29 14:01:37 2010 -0700
     3.2 +++ b/test/tools/javac/processing/6348499/T6348499.java	Wed Sep 29 23:27:57 2010 -0700
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
     3.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8   *
     3.9   * This code is free software; you can redistribute it and/or modify it
    3.10 @@ -25,7 +25,8 @@
    3.11   * @test
    3.12   * @bug 6441871
    3.13   * @summary javac crashes at com.sun.tools.javac.jvm.ClassReader$BadClassFile
    3.14 - * @build A
    3.15 + * @library ../../lib
    3.16 + * @build JavacTestingAbstractProcessor A
    3.17   * @run main T6348499
    3.18   */
    3.19  
    3.20 @@ -54,7 +55,6 @@
    3.21              fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "A.java")));
    3.22          Iterable<String> opts = Arrays.asList("-proc:only",
    3.23                                                "-processor", "A",
    3.24 -                                              "-source", "1.6",
    3.25                                                "-processorpath", testClasses);
    3.26          StringWriter out = new StringWriter();
    3.27          JavacTask task = tool.getTask(out, fm, dl, opts, null, files);
     4.1 --- a/test/tools/javac/processing/6359313/T6359313.java	Wed Sep 29 14:01:37 2010 -0700
     4.2 +++ b/test/tools/javac/processing/6359313/T6359313.java	Wed Sep 29 23:27:57 2010 -0700
     4.3 @@ -1,5 +1,5 @@
     4.4  /*
     4.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
     4.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
     4.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8   *
     4.9   * This code is free software; you can redistribute it and/or modify it
    4.10 @@ -26,6 +26,8 @@
    4.11   * @bug     6359313
    4.12   * @summary error compiling annotated package
    4.13   * @author  Peter von der Ah\u00e9
    4.14 + * @library ../../lib
    4.15 + * @build   JavacTestingAbstractProcessor
    4.16   * @compile T6359313.java
    4.17   * @compile -processor T6359313 package-info.java Foo.java
    4.18   */
    4.19 @@ -37,7 +39,7 @@
    4.20  import javax.lang.model.element.TypeElement;
    4.21  
    4.22  @SupportedAnnotationTypes("Foo")
    4.23 -public class T6359313 extends AbstractProcessor {
    4.24 +public class T6359313 extends JavacTestingAbstractProcessor {
    4.25      public boolean process(Set<? extends TypeElement> annotations,
    4.26                             RoundEnvironment roundEnvironment) {
    4.27          return true;
     5.1 --- a/test/tools/javac/processing/6365040/ProcBar.java	Wed Sep 29 14:01:37 2010 -0700
     5.2 +++ b/test/tools/javac/processing/6365040/ProcBar.java	Wed Sep 29 23:27:57 2010 -0700
     5.3 @@ -1,5 +1,5 @@
     5.4  /*
     5.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
     5.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
     5.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.8   *
     5.9   * This code is free software; you can redistribute it and/or modify it
    5.10 @@ -31,13 +31,11 @@
    5.11  /**
    5.12   * Second of several processors to run.
    5.13   */
    5.14 -@SupportedAnnotationTypes("*")
    5.15 -public class ProcBar extends AbstractProcessor {
    5.16 +public class ProcBar extends JavacTestingAbstractProcessor {
    5.17      public boolean process(Set<? extends TypeElement> annotations,
    5.18                             RoundEnvironment roundEnvironment) {
    5.19          if (!roundEnvironment.processingOver())
    5.20 -            processingEnv.getMessager().printMessage(NOTE,
    5.21 -                                                     "Hello from ProcBar");
    5.22 +            messager.printMessage(NOTE, "Hello from ProcBar");
    5.23          return false;
    5.24      }
    5.25  }
     6.1 --- a/test/tools/javac/processing/6365040/ProcFoo.java	Wed Sep 29 14:01:37 2010 -0700
     6.2 +++ b/test/tools/javac/processing/6365040/ProcFoo.java	Wed Sep 29 23:27:57 2010 -0700
     6.3 @@ -1,5 +1,5 @@
     6.4  /*
     6.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
     6.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
     6.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.8   *
     6.9   * This code is free software; you can redistribute it and/or modify it
    6.10 @@ -31,13 +31,11 @@
    6.11  /**
    6.12   * First of several processors to run.
    6.13   */
    6.14 -@SupportedAnnotationTypes("*")
    6.15 -public class ProcFoo extends AbstractProcessor {
    6.16 +public class ProcFoo extends JavacTestingAbstractProcessor {
    6.17      public boolean process(Set<? extends TypeElement> annotations,
    6.18                             RoundEnvironment roundEnvironment) {
    6.19          if (!roundEnvironment.processingOver())
    6.20 -            processingEnv.getMessager().printMessage(NOTE,
    6.21 -                                                     "Hello from ProcFoo");
    6.22 +            messager.printMessage(NOTE, "Hello from ProcFoo");
    6.23          return false;
    6.24      }
    6.25  }
     7.1 --- a/test/tools/javac/processing/6365040/T6365040.java	Wed Sep 29 14:01:37 2010 -0700
     7.2 +++ b/test/tools/javac/processing/6365040/T6365040.java	Wed Sep 29 23:27:57 2010 -0700
     7.3 @@ -1,5 +1,5 @@
     7.4  /*
     7.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
     7.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
     7.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8   *
     7.9   * This code is free software; you can redistribute it and/or modify it
    7.10 @@ -26,6 +26,8 @@
    7.11   * @bug 6365040 6358129
    7.12   * @summary Test -processor foo,bar,baz
    7.13   * @author  Joseph D. Darcy
    7.14 + * @library ../../lib
    7.15 + * @build   JavacTestingAbstractProcessor
    7.16   * @compile ProcFoo.java
    7.17   * @compile ProcBar.java
    7.18   * @compile T6365040.java
    7.19 @@ -43,13 +45,11 @@
    7.20  import javax.lang.model.element.TypeElement;
    7.21  import static javax.tools.Diagnostic.Kind.*;
    7.22  
    7.23 -@SupportedAnnotationTypes("*")
    7.24 -public class T6365040 extends AbstractProcessor {
    7.25 +public class T6365040 extends JavacTestingAbstractProcessor {
    7.26      public boolean process(Set<? extends TypeElement> annotations,
    7.27                             RoundEnvironment roundEnvironment) {
    7.28          if (!roundEnvironment.processingOver())
    7.29 -            processingEnv.getMessager().printMessage(NOTE,
    7.30 -                                                     "Hello from T6365040");
    7.31 +            messager.printMessage(NOTE, "Hello from T6365040");
    7.32          return true;
    7.33      }
    7.34  }
     8.1 --- a/test/tools/javac/processing/6413690/T6413690.java	Wed Sep 29 14:01:37 2010 -0700
     8.2 +++ b/test/tools/javac/processing/6413690/T6413690.java	Wed Sep 29 23:27:57 2010 -0700
     8.3 @@ -1,5 +1,5 @@
     8.4  /*
     8.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
     8.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
     8.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.8   *
     8.9   * This code is free software; you can redistribute it and/or modify it
    8.10 @@ -26,6 +26,8 @@
    8.11   * @bug     6413690 6380018
    8.12   * @summary JavacProcessingEnvironment does not enter trees from preceding rounds
    8.13   * @author  Peter von der Ah\u00e9
    8.14 + * @library ../../lib
    8.15 + * @build   JavacTestingAbstractProcessor
    8.16   * @compile T6413690.java
    8.17   * @compile -XDfatalEnterError -verbose -processor T6413690 src/Super.java TestMe.java
    8.18   */
    8.19 @@ -42,11 +44,9 @@
    8.20  import javax.lang.model.util.Elements;
    8.21  
    8.22  @SupportedAnnotationTypes("TestMe")
    8.23 -public class T6413690 extends AbstractProcessor {
    8.24 +public class T6413690 extends JavacTestingAbstractProcessor {
    8.25      public boolean process(Set<? extends TypeElement> annotations,
    8.26                             RoundEnvironment roundEnvironment) {
    8.27 -        Elements elements = processingEnv.getElementUtils();
    8.28 -        Filer filer = processingEnv.getFiler();
    8.29          TypeElement testMe = elements.getTypeElement(TestMe.class.getName());
    8.30          Set<? extends Element> supers = roundEnvironment.getElementsAnnotatedWith(testMe);
    8.31          try {
     9.1 --- a/test/tools/javac/processing/6414633/A.java	Wed Sep 29 14:01:37 2010 -0700
     9.2 +++ b/test/tools/javac/processing/6414633/A.java	Wed Sep 29 23:27:57 2010 -0700
     9.3 @@ -1,5 +1,5 @@
     9.4  /*
     9.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
     9.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
     9.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.8   *
     9.9   * This code is free software; you can redistribute it and/or modify it
    9.10 @@ -29,9 +29,8 @@
    9.11  import javax.lang.model.element.*;
    9.12  import javax.tools.*;
    9.13  
    9.14 -@SupportedAnnotationTypes("*")
    9.15 -public class A extends AbstractProcessor {
    9.16 -
    9.17 +@SuppressWarnings("")
    9.18 +public class A extends JavacTestingAbstractProcessor {
    9.19      public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    9.20          Messager m = processingEnv.getMessager();
    9.21          for (TypeElement anno: annotations) {
    9.22 @@ -42,8 +41,6 @@
    9.23          return true;
    9.24      }
    9.25  
    9.26 -    @Override
    9.27 -    public SourceVersion getSupportedSourceVersion() {
    9.28 -        return SourceVersion.latest();
    9.29 -    }
    9.30 +    @SuppressWarnings("")
    9.31 +    private void foo() {}
    9.32  }
    10.1 --- a/test/tools/javac/processing/6414633/T6414633.java	Wed Sep 29 14:01:37 2010 -0700
    10.2 +++ b/test/tools/javac/processing/6414633/T6414633.java	Wed Sep 29 23:27:57 2010 -0700
    10.3 @@ -1,5 +1,5 @@
    10.4  /*
    10.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    10.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    10.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.8   *
    10.9   * This code is free software; you can redistribute it and/or modify it
   10.10 @@ -25,7 +25,8 @@
   10.11   * @test
   10.12   * @bug 6414633 6440109
   10.13   * @summary Only the first processor message at a source location is reported
   10.14 - * @build A T6414633
   10.15 + * @library ../../lib
   10.16 + * @build    JavacTestingAbstractProcessor A T6414633
   10.17   * @run main T6414633
   10.18   */
   10.19  
   10.20 @@ -55,8 +56,7 @@
   10.21              fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, A.class.getName()+".java")));
   10.22          String[] opts = { "-proc:only",
   10.23                            "-processor", A.class.getName(),
   10.24 -                          "-source", "1.6",
   10.25 -                          "-classpath", testClasses };
   10.26 +                          "-classpath", testClasses + System.getProperty("path.separator") + "../../lib" };
   10.27          JavacTask task = tool.getTask(null, fm, dl, Arrays.asList(opts), null, files);
   10.28          task.call();
   10.29  
    11.1 --- a/test/tools/javac/processing/6430209/T6430209.java	Wed Sep 29 14:01:37 2010 -0700
    11.2 +++ b/test/tools/javac/processing/6430209/T6430209.java	Wed Sep 29 23:27:57 2010 -0700
    11.3 @@ -1,5 +1,5 @@
    11.4  /*
    11.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    11.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    11.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.8   *
    11.9   * This code is free software; you can redistribute it and/or modify it
   11.10 @@ -25,7 +25,8 @@
   11.11   * @test
   11.12   * @bug 6441871
   11.13   * @summary spurious compiler error elicited by packageElement.getEnclosedElements()
   11.14 - * @build b6341534
   11.15 + * @library ../../lib
   11.16 + * @build JavacTestingAbstractProcessor b6341534
   11.17   * @run main T6430209
   11.18   */
   11.19  
   11.20 @@ -54,7 +55,7 @@
   11.21          // run annotation processor b6341534 so we can check diagnostics
   11.22          // -proc:only -processor b6341534 -cp . ./src/*.java
   11.23          String testSrc = System.getProperty("test.src", ".");
   11.24 -        String testClasses = System.getProperty("test.classes");
   11.25 +        String testClasses = System.getProperty("test.classes") + System.getProperty("path.separator") + "../../lib";
   11.26          JavacTool tool = JavacTool.create();
   11.27          MyDiagListener dl = new MyDiagListener();
   11.28          StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, null);
    12.1 --- a/test/tools/javac/processing/6430209/b6341534.java	Wed Sep 29 14:01:37 2010 -0700
    12.2 +++ b/test/tools/javac/processing/6430209/b6341534.java	Wed Sep 29 23:27:57 2010 -0700
    12.3 @@ -1,5 +1,5 @@
    12.4  /*
    12.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    12.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    12.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.8   *
    12.9   * This code is free software; you can redistribute it and/or modify it
   12.10 @@ -30,16 +30,9 @@
   12.11  import java.util.*;
   12.12  import java.util.Set;
   12.13  
   12.14 -@SupportedAnnotationTypes({"*"})
   12.15 -public class b6341534 extends AbstractProcessor {
   12.16 +public class b6341534 extends JavacTestingAbstractProcessor {
   12.17      static int r = 0;
   12.18 -    static Elements E = null;
   12.19 -    static Messager msgr = null;
   12.20 -    public void init(ProcessingEnvironment penv)  {
   12.21 -        processingEnv = penv;
   12.22 -        msgr = penv.getMessager();
   12.23 -        E = penv.getElementUtils();
   12.24 -    }
   12.25 +
   12.26      //Create directory 'dir1' and a test class in dir1
   12.27      public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv)
   12.28      {
   12.29 @@ -49,13 +42,13 @@
   12.30                  System.out.println("Round"+r+ ": " + t.toString());
   12.31  
   12.32              try {
   12.33 -                PackageElement PE = E.getPackageElement("dir1");
   12.34 +                PackageElement PE = eltUtils.getPackageElement("dir1");
   12.35                  List<? extends Element> LEE = PE.getEnclosedElements();    /* <=This line elicits the error message.  */
   12.36                  for(Element e : LEE)
   12.37                      System.out.println("found " + e.toString() + " in dir1.");
   12.38              }
   12.39              catch(NullPointerException npe) {
   12.40 -                msgr.printMessage(ERROR,npe.toString());
   12.41 +                messager.printMessage(ERROR,npe.toString());
   12.42                  //npe.printStackTrace();
   12.43                  return false;
   12.44              }
   12.45 @@ -63,13 +56,8 @@
   12.46          // on round 1, expect errorRaised == false && processingOver == false
   12.47          // on round 2, expect errorRaised == true && processingOver == true
   12.48          if( renv.errorRaised() != renv.processingOver()) {
   12.49 -            msgr.printMessage(ERROR, "FAILED");
   12.50 +            messager.printMessage(ERROR, "FAILED");
   12.51          }
   12.52          return true;
   12.53      }
   12.54 -
   12.55 -    @Override
   12.56 -    public SourceVersion getSupportedSourceVersion() {
   12.57 -        return SourceVersion.latest();
   12.58 -    }
   12.59  }
    13.1 --- a/test/tools/javac/processing/6499119/ClassProcessor.java	Wed Sep 29 14:01:37 2010 -0700
    13.2 +++ b/test/tools/javac/processing/6499119/ClassProcessor.java	Wed Sep 29 23:27:57 2010 -0700
    13.3 @@ -32,20 +32,17 @@
    13.4   * @test
    13.5   * @bug 6499119
    13.6   * @summary Created package-info class file modeled improperly
    13.7 + * @library ../../lib
    13.8 + * @build   JavacTestingAbstractProcessor
    13.9   * @compile ClassProcessor.java package-info.java
   13.10   * @compile/process -cp . -processor ClassProcessor -Akind=java  java.lang.Object
   13.11   * @compile/process -cp . -processor ClassProcessor -Akind=class java.lang.Object
   13.12   */
   13.13  
   13.14  @SupportedOptions({ "gen", "expect" })
   13.15 -@SupportedAnnotationTypes({"*"})
   13.16 -public class ClassProcessor extends AbstractProcessor {
   13.17 +public class ClassProcessor extends JavacTestingAbstractProcessor {
   13.18      int round = 1;
   13.19  
   13.20 -    public SourceVersion getSupportedSourceVersion() {
   13.21 -        return SourceVersion.latest();
   13.22 -    }
   13.23 -
   13.24      public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
   13.25          if (round == 1) {
   13.26              System.out.println("-- Round 1 --");
   13.27 @@ -71,8 +68,6 @@
   13.28      }
   13.29  
   13.30      private void createPackageFile() {
   13.31 -        Filer filer = processingEnv.getFiler();
   13.32 -
   13.33          String kind = processingEnv.getOptions().get("kind");
   13.34  
   13.35          File pkgInfo;
   13.36 @@ -125,7 +120,6 @@
   13.37      }
   13.38  
   13.39      private void error(String msg) {
   13.40 -        Messager messager = processingEnv.getMessager();
   13.41          messager.printMessage(Kind.ERROR, msg);
   13.42      }
   13.43  }
    14.1 --- a/test/tools/javac/processing/6511613/DummyProcessor.java	Wed Sep 29 14:01:37 2010 -0700
    14.2 +++ b/test/tools/javac/processing/6511613/DummyProcessor.java	Wed Sep 29 23:27:57 2010 -0700
    14.3 @@ -26,15 +26,10 @@
    14.4  import javax.lang.model.element.*;
    14.5  import java.util.Set;
    14.6  
    14.7 -@SupportedAnnotationTypes("*")
    14.8 -public class DummyProcessor extends  AbstractProcessor {
    14.9 +public class DummyProcessor extends JavacTestingAbstractProcessor {
   14.10     public boolean process(Set<? extends TypeElement> annotations,
   14.11                    RoundEnvironment roundEnv) {
   14.12         return true;
   14.13     }
   14.14 -    @Override
   14.15 -    public SourceVersion getSupportedSourceVersion() {
   14.16 -        return SourceVersion.latest();
   14.17 -    }
   14.18  }
   14.19  
    15.1 --- a/test/tools/javac/processing/6511613/clss41701.java	Wed Sep 29 14:01:37 2010 -0700
    15.2 +++ b/test/tools/javac/processing/6511613/clss41701.java	Wed Sep 29 23:27:57 2010 -0700
    15.3 @@ -26,7 +26,8 @@
    15.4   * @bug 6511613
    15.5   * @summary javac unexpectedly doesn't fail in some cases if an annotation processor specified
    15.6   *
    15.7 - * @build DummyProcessor
    15.8 + * @library ../../lib
    15.9 + * @build JavacTestingAbstractProcessor DummyProcessor
   15.10   * @compile/fail clss41701.java
   15.11   * @compile/fail -processor DummyProcessor clss41701.java
   15.12   */
    16.1 --- a/test/tools/javac/processing/6512707/T6512707.java	Wed Sep 29 14:01:37 2010 -0700
    16.2 +++ b/test/tools/javac/processing/6512707/T6512707.java	Wed Sep 29 23:27:57 2010 -0700
    16.3 @@ -1,5 +1,5 @@
    16.4  /*
    16.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
    16.6 + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
    16.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.8   *
    16.9   * This code is free software; you can redistribute it and/or modify it
   16.10 @@ -26,8 +26,9 @@
   16.11   * @bug 6512707
   16.12   * @summary "incompatible types" after (unrelated) annotation processing
   16.13   * @author  Peter Runge
   16.14 + * @library ../../lib
   16.15 + * @build   JavacTestingAbstractProcessor
   16.16   * @compile T6512707.java
   16.17 - *
   16.18   * @compile -processor T6512707 TestAnnotation.java
   16.19   */
   16.20  
   16.21 @@ -41,16 +42,10 @@
   16.22   * Dummy processor to force bug 6512707 to show - it does not matter what
   16.23   * the annotation processor does for this bug.
   16.24   */
   16.25 -@SupportedAnnotationTypes("*")
   16.26 -public class T6512707 extends AbstractProcessor {
   16.27 +public class T6512707 extends JavacTestingAbstractProcessor {
   16.28  
   16.29      public boolean process(Set<? extends TypeElement> annotations,
   16.30                             RoundEnvironment roundEnv) {
   16.31 -        return(false);
   16.32 -    }
   16.33 -
   16.34 -    @Override
   16.35 -    public SourceVersion getSupportedSourceVersion() {
   16.36 -        return SourceVersion.latest();
   16.37 +        return false;
   16.38      }
   16.39  }
    17.1 --- a/test/tools/javac/processing/6634138/T6634138.java	Wed Sep 29 14:01:37 2010 -0700
    17.2 +++ b/test/tools/javac/processing/6634138/T6634138.java	Wed Sep 29 23:27:57 2010 -0700
    17.3 @@ -26,6 +26,8 @@
    17.4   * @bug 6634138
    17.5   * @author  Joseph D. Darcy
    17.6   * @summary Verify source files output after processing is over are compiled
    17.7 + * @library ../../lib
    17.8 + * @build   JavacTestingAbstractProcessor
    17.9   * @compile T6634138.java
   17.10   * @compile -processor T6634138 Dummy.java
   17.11   * @run main ExerciseDependency
   17.12 @@ -44,10 +46,7 @@
   17.13  import javax.lang.model.element.*;
   17.14  import javax.lang.model.util.*;
   17.15  
   17.16 -@SupportedAnnotationTypes("*")
   17.17 -public class T6634138 extends AbstractProcessor {
   17.18 -    private Filer filer;
   17.19 -
   17.20 +public class T6634138 extends JavacTestingAbstractProcessor {
   17.21      public boolean process(Set<? extends TypeElement> annotations,
   17.22                             RoundEnvironment roundEnvironment) {
   17.23          // Write out files *after* processing is over.
   17.24 @@ -77,16 +76,6 @@
   17.25          }
   17.26          return true;
   17.27      }
   17.28 -
   17.29 -    @Override
   17.30 -    public SourceVersion getSupportedSourceVersion() {
   17.31 -        return SourceVersion.latest();
   17.32 -    }
   17.33 -
   17.34 -    public void init(ProcessingEnvironment processingEnv) {
   17.35 -        super.init(processingEnv);
   17.36 -        filer    = processingEnv.getFiler();
   17.37 -    }
   17.38  }
   17.39  
   17.40  
    18.1 --- a/test/tools/javac/processing/T6439826.java	Wed Sep 29 14:01:37 2010 -0700
    18.2 +++ b/test/tools/javac/processing/T6439826.java	Wed Sep 29 23:27:57 2010 -0700
    18.3 @@ -1,5 +1,5 @@
    18.4  /*
    18.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    18.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    18.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    18.8   *
    18.9   * This code is free software; you can redistribute it and/or modify it
   18.10 @@ -48,8 +48,7 @@
   18.11          StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, null);
   18.12          Iterable<? extends JavaFileObject> files =
   18.13              fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, T6439826.class.getName()+".java")));
   18.14 -        Iterable<String> opts = Arrays.asList("-source","1.6",
   18.15 -                                              "-proc:only",
   18.16 +        Iterable<String> opts = Arrays.asList("-proc:only",
   18.17                                                "-processor", "T6439826",
   18.18                                                "-processorpath", testClasses);
   18.19          StringWriter out = new StringWriter();
    19.1 --- a/test/tools/javac/processing/T6920317.java	Wed Sep 29 14:01:37 2010 -0700
    19.2 +++ b/test/tools/javac/processing/T6920317.java	Wed Sep 29 23:27:57 2010 -0700
    19.3 @@ -25,6 +25,7 @@
    19.4   * @test
    19.5   * @bug 6920317
    19.6   * @summary package-info.java file has to be specified on the javac cmdline, else it will not be avail
    19.7 + * @library ../lib
    19.8   */
    19.9  
   19.10  import java.io.*;
   19.11 @@ -349,12 +350,7 @@
   19.12      /** Annotation processor used to verify the expected value for the
   19.13          package annotations found by javac. */
   19.14      @SupportedOptions({ "gen", "expect" })
   19.15 -    @SupportedAnnotationTypes({"*"})
   19.16 -    public static class Processor extends AbstractProcessor {
   19.17 -        public SourceVersion getSupportedSourceVersion() {
   19.18 -            return SourceVersion.latest();
   19.19 -        }
   19.20 -
   19.21 +    public static class Processor extends JavacTestingAbstractProcessor {
   19.22          public boolean process(Set<? extends TypeElement> annots, RoundEnvironment renv) {
   19.23              round++;
   19.24              System.err.println("Round " + round + " annots:" + annots + " rootElems:" + renv.getRootElements());
    20.1 --- a/test/tools/javac/processing/environment/TestSourceVersion.java	Wed Sep 29 14:01:37 2010 -0700
    20.2 +++ b/test/tools/javac/processing/environment/TestSourceVersion.java	Wed Sep 29 23:27:57 2010 -0700
    20.3 @@ -1,5 +1,5 @@
    20.4  /*
    20.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    20.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    20.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.8   *
    20.9   * This code is free software; you can redistribute it and/or modify it
   20.10 @@ -26,6 +26,8 @@
   20.11   * @bug 6402506
   20.12   * @summary Test that getSourceVersion works properly
   20.13   * @author  Joseph D. Darcy
   20.14 + * @library ../../lib
   20.15 + * @build   JavacTestingAbstractProcessor
   20.16   * @compile TestSourceVersion.java
   20.17   * @compile -processor TestSourceVersion -proc:only -source 1.2 -AExpectedVersion=RELEASE_2 HelloWorld.java
   20.18   * @compile -processor TestSourceVersion -proc:only -source 1.3 -AExpectedVersion=RELEASE_3 HelloWorld.java
   20.19 @@ -52,9 +54,8 @@
   20.20   * This processor checks that ProcessingEnvironment.getSourceVersion()
   20.21   * is consistent with the setting of the -source option.
   20.22   */
   20.23 -@SupportedAnnotationTypes("*")
   20.24  @SupportedOptions("ExpectedVersion")
   20.25 -public class TestSourceVersion extends AbstractProcessor {
   20.26 +public class TestSourceVersion extends JavacTestingAbstractProcessor {
   20.27  
   20.28      public boolean process(Set<? extends TypeElement> annotations,
   20.29                             RoundEnvironment roundEnvironment) {
   20.30 @@ -68,9 +69,4 @@
   20.31  
   20.32          return true;
   20.33      }
   20.34 -
   20.35 -    @Override
   20.36 -    public SourceVersion getSupportedSourceVersion() {
   20.37 -        return SourceVersion.latest();
   20.38 -    }
   20.39  }
    21.1 --- a/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java	Wed Sep 29 14:01:37 2010 -0700
    21.2 +++ b/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java	Wed Sep 29 23:27:57 2010 -0700
    21.3 @@ -1,5 +1,5 @@
    21.4  /*
    21.5 - * Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
    21.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    21.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    21.8   *
    21.9   * This code is free software; you can redistribute it and/or modify it
   21.10 @@ -26,6 +26,8 @@
   21.11   * @bug 6397298 6400986 6425592 6449798 6453386 6508401 6498938 6911854
   21.12   * @summary Tests that getElementsAnnotatedWith works properly.
   21.13   * @author  Joseph D. Darcy
   21.14 + * @library ../../../lib
   21.15 + * @build   JavacTestingAbstractProcessor
   21.16   * @compile TestElementsAnnotatedWith.java
   21.17   * @compile InheritedAnnotation.java
   21.18   * @compile -processor TestElementsAnnotatedWith -proc:only SurfaceAnnotations.java
   21.19 @@ -57,16 +59,13 @@
   21.20   * getElementsAnnotatedWith is consistent with the expected results
   21.21   * stored in an AnnotatedElementInfo annotation.
   21.22   */
   21.23 -@SupportedAnnotationTypes("*")
   21.24  @AnnotatedElementInfo(annotationName="java.lang.SuppressWarnings", expectedSize=0, names={})
   21.25 -public class TestElementsAnnotatedWith extends AbstractProcessor {
   21.26 +public class TestElementsAnnotatedWith extends JavacTestingAbstractProcessor {
   21.27  
   21.28      public boolean process(Set<? extends TypeElement> annotations,
   21.29                             RoundEnvironment roundEnvironment) {
   21.30 -        Elements elementUtils = processingEnv.getElementUtils();
   21.31 -
   21.32          TypeElement annotatedElementInfoElement =
   21.33 -            elementUtils.getTypeElement("AnnotatedElementInfo");
   21.34 +            elements.getTypeElement("AnnotatedElementInfo");
   21.35          Set<? extends Element> resultsMeta = Collections.emptySet();
   21.36          Set<? extends Element> resultsBase = Collections.emptySet();
   21.37  
   21.38 @@ -93,9 +92,7 @@
   21.39  
   21.40                  resultsMeta =
   21.41                      roundEnvironment.
   21.42 -                    getElementsAnnotatedWith(elementUtils.
   21.43 -                                             getTypeElement(annotatedElementInfo.
   21.44 -                                                            annotationName())) ;
   21.45 +                    getElementsAnnotatedWith(elements.getTypeElement(annotatedElementInfo.annotationName()));
   21.46  
   21.47                  System.err.println("Results: " + resultsMeta);
   21.48  
   21.49 @@ -167,9 +164,4 @@
   21.50              throw new RuntimeException("Illegal argument exception not thrown");
   21.51          } catch(IllegalArgumentException iae) {}
   21.52      }
   21.53 -
   21.54 -    @Override
   21.55 -    public SourceVersion getSupportedSourceVersion() {
   21.56 -        return SourceVersion.latest();
   21.57 -    }
   21.58  }
    22.1 --- a/test/tools/javac/processing/errors/TestFatalityOfParseErrors.java	Wed Sep 29 14:01:37 2010 -0700
    22.2 +++ b/test/tools/javac/processing/errors/TestFatalityOfParseErrors.java	Wed Sep 29 23:27:57 2010 -0700
    22.3 @@ -1,5 +1,5 @@
    22.4  /*
    22.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    22.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    22.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    22.8   *
    22.9   * This code is free software; you can redistribute it and/or modify it
   22.10 @@ -26,6 +26,9 @@
   22.11   * @bug 6403459
   22.12   * @summary Test that generating programs with syntax errors is a fatal condition
   22.13   * @author  Joseph D. Darcy
   22.14 + * @library ../../lib
   22.15 + * @build JavacTestingAbstractProcessor
   22.16 + * @compile TestReturnCode.java
   22.17   * @compile TestFatalityOfParseErrors.java
   22.18   * @compile/fail -XprintRounds -processor TestFatalityOfParseErrors -proc:only TestFatalityOfParseErrors.java
   22.19   */
   22.20 @@ -45,11 +48,8 @@
   22.21   * Write out an incomplete source file and observe that the next round
   22.22   * is marked as an error.
   22.23   */
   22.24 -@SupportedAnnotationTypes("*")
   22.25 -public class TestFatalityOfParseErrors extends AbstractProcessor {
   22.26 +public class TestFatalityOfParseErrors extends JavacTestingAbstractProcessor {
   22.27      int round = 0;
   22.28 -    Messager messager;
   22.29 -    Filer filer;
   22.30  
   22.31      public boolean process(Set<? extends TypeElement> annotations,
   22.32                             RoundEnvironment roundEnvironment) {
   22.33 @@ -87,14 +87,4 @@
   22.34          }
   22.35          return true;
   22.36      }
   22.37 -
   22.38 -    public SourceVersion getSupportedSourceVersion() {
   22.39 -        return SourceVersion.latest();
   22.40 -    }
   22.41 -
   22.42 -    public void init(ProcessingEnvironment processingEnv) {
   22.43 -        super.init(processingEnv);
   22.44 -        messager = processingEnv.getMessager();
   22.45 -        filer    = processingEnv.getFiler();
   22.46 -    }
   22.47  }
    23.1 --- a/test/tools/javac/processing/errors/TestOptionSyntaxErrors.java	Wed Sep 29 14:01:37 2010 -0700
    23.2 +++ b/test/tools/javac/processing/errors/TestOptionSyntaxErrors.java	Wed Sep 29 23:27:57 2010 -0700
    23.3 @@ -1,5 +1,5 @@
    23.4  /*
    23.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    23.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    23.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    23.8   *
    23.9   * This code is free software; you can redistribute it and/or modify it
   23.10 @@ -26,6 +26,8 @@
   23.11   * @bug 6406212
   23.12   * @summary Test that annotation processor options with illegal syntax are rejected
   23.13   * @author  Joseph D. Darcy
   23.14 + * @library ../../lib
   23.15 + * @build JavacTestingAbstractProcessor
   23.16   * @compile TestOptionSyntaxErrors.java
   23.17   * @compile/fail -A TestOptionSyntaxErrors.java
   23.18   * @compile/fail -A8adOption TestOptionSyntaxErrors.java
   23.19 @@ -46,14 +48,9 @@
   23.20  /**
   23.21   * No-op processor; should not be run.
   23.22   */
   23.23 -@SupportedAnnotationTypes("*")
   23.24 -public class TestOptionSyntaxErrors extends AbstractProcessor {
   23.25 +public class TestOptionSyntaxErrors extends JavacTestingAbstractProcessor {
   23.26      public boolean process(Set<? extends TypeElement> annotations,
   23.27                             RoundEnvironment roundEnvironment) {
   23.28          return true;
   23.29      }
   23.30 -
   23.31 -    public SourceVersion getSupportedSourceVersion() {
   23.32 -        return SourceVersion.latest();
   23.33 -    }
   23.34  }
    24.1 --- a/test/tools/javac/processing/errors/TestReturnCode.java	Wed Sep 29 14:01:37 2010 -0700
    24.2 +++ b/test/tools/javac/processing/errors/TestReturnCode.java	Wed Sep 29 23:27:57 2010 -0700
    24.3 @@ -1,5 +1,5 @@
    24.4  /*
    24.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    24.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    24.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    24.8   *
    24.9   * This code is free software; you can redistribute it and/or modify it
   24.10 @@ -26,6 +26,8 @@
   24.11   * @bug 6403468
   24.12   * @summary Test that an erroneous return code results from raising an error.
   24.13   * @author  Joseph D. Darcy
   24.14 + * @library ../../lib
   24.15 + * @build JavacTestingAbstractProcessor
   24.16   * @compile TestReturnCode.java
   24.17   *
   24.18   * @compile      -processor TestReturnCode -proc:only                                                                   Foo.java
   24.19 @@ -60,20 +62,17 @@
   24.20   * This processor raises errors or throws exceptions on different
   24.21   * rounds to allow the return code to be test.
   24.22   */
   24.23 -@SupportedAnnotationTypes("*")
   24.24  @SupportedOptions({"ErrorOnFirst",
   24.25                     "ErrorOnLast",
   24.26                     "ExceptionOnFirst",
   24.27                     "ExceptionOnLast"})
   24.28 -public class TestReturnCode extends AbstractProcessor {
   24.29 +public class TestReturnCode extends JavacTestingAbstractProcessor {
   24.30  
   24.31      private boolean errorOnFirst;
   24.32      private boolean errorOnLast;
   24.33      private boolean exceptionOnFirst;
   24.34      private boolean exceptionOnLast;
   24.35  
   24.36 -    private Messager messager;
   24.37 -
   24.38      public boolean process(Set<? extends TypeElement> annotations,
   24.39                             RoundEnvironment roundEnv) {
   24.40          if (!roundEnv.processingOver()) {
   24.41 @@ -103,11 +102,5 @@
   24.42          errorOnLast     = keySet.contains("ErrorOnLast");
   24.43          exceptionOnFirst  = keySet.contains("ExceptionOnFirst");
   24.44          exceptionOnLast = keySet.contains("ExceptionOnLast");
   24.45 -        messager = processingEnv.getMessager();
   24.46 -    }
   24.47 -
   24.48 -    @Override
   24.49 -    public SourceVersion getSupportedSourceVersion() {
   24.50 -        return SourceVersion.latest();
   24.51      }
   24.52  }
    25.1 --- a/test/tools/javac/processing/filer/TestFilerConstraints.java	Wed Sep 29 14:01:37 2010 -0700
    25.2 +++ b/test/tools/javac/processing/filer/TestFilerConstraints.java	Wed Sep 29 23:27:57 2010 -0700
    25.3 @@ -1,5 +1,5 @@
    25.4  /*
    25.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    25.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    25.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    25.8   *
    25.9   * This code is free software; you can redistribute it and/or modify it
   25.10 @@ -26,6 +26,7 @@
   25.11   * @bug 6380018 6453386 6457283
   25.12   * @summary Test that the constraints guaranteed by the Filer and maintained
   25.13   * @author  Joseph D. Darcy
   25.14 + * @library ../../lib
   25.15   * @build TestFilerConstraints
   25.16   * @compile -encoding iso-8859-1 -processor TestFilerConstraints -proc:only TestFilerConstraints.java
   25.17   */
   25.18 @@ -69,11 +70,8 @@
   25.19   *
   25.20   * </ul>
   25.21   */
   25.22 -@SupportedAnnotationTypes("*")
   25.23 -public class TestFilerConstraints extends AbstractProcessor {
   25.24 +public class TestFilerConstraints extends JavacTestingAbstractProcessor {
   25.25      private int round = 0;
   25.26 -    private Messager messager;
   25.27 -    private Filer filer;
   25.28  
   25.29      private PrintWriter  pw_src1 = null;
   25.30      private PrintWriter  pw_src2 = null;
   25.31 @@ -167,17 +165,6 @@
   25.32          return true;
   25.33      }
   25.34  
   25.35 -    public SourceVersion getSupportedSourceVersion() {
   25.36 -        return SourceVersion.latest();
   25.37 -    }
   25.38 -
   25.39 -    public void init(ProcessingEnvironment processingEnv) {
   25.40 -        super.init(processingEnv);
   25.41 -        messager = processingEnv.getMessager();
   25.42 -        filer    = processingEnv.getFiler();
   25.43 -
   25.44 -    }
   25.45 -
   25.46      /**
   25.47       * Test that the single expected expected type, name, is the root
   25.48       * element.
    26.1 --- a/test/tools/javac/processing/filer/TestGetResource.java	Wed Sep 29 14:01:37 2010 -0700
    26.2 +++ b/test/tools/javac/processing/filer/TestGetResource.java	Wed Sep 29 23:27:57 2010 -0700
    26.3 @@ -1,5 +1,5 @@
    26.4  /*
    26.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    26.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    26.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    26.8   *
    26.9   * This code is free software; you can redistribute it and/or modify it
   26.10 @@ -26,7 +26,8 @@
   26.11   * @bug 6380018 6449798
   26.12   * @summary Test Filer.getResource
   26.13   * @author  Joseph D. Darcy
   26.14 - * @build TestGetResource
   26.15 + * @library ../../lib
   26.16 + * @build  JavacTestingAbstractProcessor TestGetResource
   26.17   * @compile -processor TestGetResource -proc:only -Aphase=write TestGetResource.java
   26.18   * @compile -processor TestGetResource -proc:only -Aphase=read  TestGetResource.java
   26.19   */
   26.20 @@ -49,13 +50,8 @@
   26.21   * first run of the annotation processor, write out a resource file
   26.22   * and on the second run read it in.
   26.23   */
   26.24 -@SupportedAnnotationTypes("*")
   26.25  @SupportedOptions("phase")
   26.26 -public class TestGetResource extends AbstractProcessor {
   26.27 -    private Messager messager;
   26.28 -    private Filer filer;
   26.29 -    private Map<String,String> options;
   26.30 -
   26.31 +public class TestGetResource extends JavacTestingAbstractProcessor {
   26.32      private static String CONTENTS = "Hello World.";
   26.33      private static String PKG = "";
   26.34      private static String RESOURCE_NAME = "Resource1";
   26.35 @@ -92,15 +88,4 @@
   26.36          }
   26.37          return false;
   26.38      }
   26.39 -
   26.40 -    public SourceVersion getSupportedSourceVersion() {
   26.41 -        return SourceVersion.latest();
   26.42 -    }
   26.43 -
   26.44 -    public void init(ProcessingEnvironment processingEnv) {
   26.45 -        super.init(processingEnv);
   26.46 -        messager = processingEnv.getMessager();
   26.47 -        filer    = processingEnv.getFiler();
   26.48 -        options  = processingEnv.getOptions();
   26.49 -    }
   26.50  }
    27.1 --- a/test/tools/javac/processing/filer/TestGetResource2.java	Wed Sep 29 14:01:37 2010 -0700
    27.2 +++ b/test/tools/javac/processing/filer/TestGetResource2.java	Wed Sep 29 23:27:57 2010 -0700
    27.3 @@ -1,5 +1,5 @@
    27.4  /*
    27.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    27.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    27.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    27.8   *
    27.9   * This code is free software; you can redistribute it and/or modify it
   27.10 @@ -24,6 +24,7 @@
   27.11  /* @test
   27.12   * @bug 6929404
   27.13   * @summary Filer.getResource(SOURCE_PATH, ...) does not work when -sourcepath contains >1 entry
   27.14 + * @library ../../lib
   27.15   */
   27.16  
   27.17  import java.io.*;
   27.18 @@ -114,8 +115,7 @@
   27.19              throw new Exception(errors + " errors occurred");
   27.20      }
   27.21  
   27.22 -    @SupportedAnnotationTypes("*")
   27.23 -    static class AnnoProc extends AbstractProcessor {
   27.24 +    static class AnnoProc extends JavacTestingAbstractProcessor {
   27.25  
   27.26          public @Override boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
   27.27              if (roundEnv.processingOver()) {
   27.28 @@ -123,27 +123,23 @@
   27.29              }
   27.30  
   27.31              try {
   27.32 -                FileObject resource = processingEnv.getFiler().getResource(StandardLocation.SOURCE_PATH, "resources", "file.txt");
   27.33 +                FileObject resource = filer.getResource(StandardLocation.SOURCE_PATH, "resources", "file.txt");
   27.34                  try {
   27.35                      resource.openInputStream().close();
   27.36 -                    processingEnv.getMessager().printMessage(Kind.NOTE, "found: " + resource.toUri());
   27.37 +                    messager.printMessage(Kind.NOTE, "found: " + resource.toUri());
   27.38                      return true;
   27.39                  } catch (IOException x) {
   27.40 -                    processingEnv.getMessager().printMessage(Kind.ERROR, "could not read: " + resource.toUri());
   27.41 +                    messager.printMessage(Kind.ERROR, "could not read: " + resource.toUri());
   27.42                      x.printStackTrace();
   27.43                  }
   27.44              } catch (IOException x) {
   27.45 -                processingEnv.getMessager().printMessage(Kind.ERROR, "did not find resource");
   27.46 +                messager.printMessage(Kind.ERROR, "did not find resource");
   27.47                  x.printStackTrace();
   27.48              }
   27.49  
   27.50              return false;
   27.51          }
   27.52  
   27.53 -        @Override
   27.54 -        public SourceVersion getSupportedSourceVersion() {
   27.55 -            return SourceVersion.latest();
   27.56 -        }
   27.57      }
   27.58  
   27.59      private File write(File dir, String path, String contents) throws IOException {
    28.1 --- a/test/tools/javac/processing/filer/TestInvalidRelativeNames.java	Wed Sep 29 14:01:37 2010 -0700
    28.2 +++ b/test/tools/javac/processing/filer/TestInvalidRelativeNames.java	Wed Sep 29 23:27:57 2010 -0700
    28.3 @@ -25,6 +25,8 @@
    28.4   * @test
    28.5   * @bug 6502392
    28.6   * @summary Invalid relative names for Filer.createResource and Filer.getResource
    28.7 + * @library ../../lib
    28.8 + * @build   JavacTestingAbstractProcessor
    28.9   * @compile TestInvalidRelativeNames.java
   28.10   * @compile/process -processor TestInvalidRelativeNames java.lang.Object
   28.11   */
   28.12 @@ -37,30 +39,13 @@
   28.13  import javax.tools.Diagnostic;
   28.14  import javax.tools.StandardLocation;
   28.15  
   28.16 -
   28.17 -@SupportedAnnotationTypes("*")
   28.18 -public class TestInvalidRelativeNames extends AbstractProcessor {
   28.19 +public class TestInvalidRelativeNames extends JavacTestingAbstractProcessor {
   28.20      enum Kind { CREATE_WRITER, GET_READER, CREATE_OUTPUT_STREAM, GET_INPUT_STREAM };
   28.21  
   28.22      static final String[] invalidRelativeNames = {
   28.23              "/boo", "goo/../hoo", "./ioo", ""
   28.24      };
   28.25  
   28.26 -    @Override
   28.27 -    public SourceVersion getSupportedSourceVersion() {
   28.28 -        return SourceVersion.latest();
   28.29 -    }
   28.30 -
   28.31 -    Filer filer;
   28.32 -    Messager messager;
   28.33 -
   28.34 -    @Override
   28.35 -    public void init(ProcessingEnvironment pEnv) {
   28.36 -        super.init(pEnv);
   28.37 -        filer = processingEnv.getFiler();
   28.38 -        messager = processingEnv.getMessager();
   28.39 -    }
   28.40 -
   28.41      public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
   28.42          if (roundEnv.processingOver()) {
   28.43              for (String relative: invalidRelativeNames) {
    29.1 --- a/test/tools/javac/processing/filer/TestLastRound.java	Wed Sep 29 14:01:37 2010 -0700
    29.2 +++ b/test/tools/javac/processing/filer/TestLastRound.java	Wed Sep 29 23:27:57 2010 -0700
    29.3 @@ -24,6 +24,8 @@
    29.4  /*
    29.5   * @test 6966604
    29.6   * @summary JavacFiler not correctly notified of lastRound
    29.7 + * @library ../../lib
    29.8 + * @build   JavacTestingAbstractProcessor
    29.9   * @compile TestLastRound.java
   29.10   * @compile/fail/ref=TestLastRound.out -XDrawDiagnostics -Werror -proc:only -processor TestLastRound TestLastRound.java
   29.11   */
   29.12 @@ -35,12 +37,10 @@
   29.13  import javax.lang.model.element.*;
   29.14  import javax.tools.*;
   29.15  
   29.16 -@SupportedAnnotationTypes("*")
   29.17 -public class TestLastRound extends AbstractProcessor {
   29.18 +public class TestLastRound extends JavacTestingAbstractProcessor {
   29.19      @Override
   29.20      public boolean process(Set<? extends TypeElement> annotations,
   29.21                             RoundEnvironment roundEnv) {
   29.22 -        Filer filer = processingEnv.getFiler();
   29.23          if (roundEnv.processingOver()) {
   29.24              try {
   29.25                  JavaFileObject fo = filer.createSourceFile("LastRound.java");
   29.26 @@ -52,9 +52,4 @@
   29.27          }
   29.28          return true;
   29.29      }
   29.30 -
   29.31 -    @Override
   29.32 -    public SourceVersion getSupportedSourceVersion() {
   29.33 -        return SourceVersion.latest();
   29.34 -    }
   29.35  }
    30.1 --- a/test/tools/javac/processing/filer/TestPackageInfo.java	Wed Sep 29 14:01:37 2010 -0700
    30.2 +++ b/test/tools/javac/processing/filer/TestPackageInfo.java	Wed Sep 29 23:27:57 2010 -0700
    30.3 @@ -1,5 +1,5 @@
    30.4  /*
    30.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    30.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    30.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.8   *
    30.9   * This code is free software; you can redistribute it and/or modify it
   30.10 @@ -26,6 +26,8 @@
   30.11   * @bug 6380018 6392177
   30.12   * @summary Test the ability to create and process package-info.java files
   30.13   * @author  Joseph D. Darcy
   30.14 + * @library ../../lib
   30.15 + * @build   JavacTestingAbstractProcessor
   30.16   * @compile TestPackageInfo.java
   30.17   * @compile -processor TestPackageInfo -proc:only foo/bar/package-info.java TestPackageInfo.java
   30.18   */
   30.19 @@ -49,13 +51,7 @@
   30.20   * 1) Visibility of package-info files from the command line
   30.21   * 2) Visibility of generated package-info.java source files
   30.22   */
   30.23 -@SupportedAnnotationTypes("*")
   30.24 -public class TestPackageInfo extends AbstractProcessor {
   30.25 -    private Elements eltUtils;
   30.26 -    private Messager messager;
   30.27 -    private Filer filer;
   30.28 -    private Map<String,String> options;
   30.29 -
   30.30 +public class TestPackageInfo extends JavacTestingAbstractProcessor {
   30.31      private int round = 0;
   30.32  
   30.33      public boolean process(Set<? extends TypeElement> annotations,
   30.34 @@ -64,11 +60,7 @@
   30.35  
   30.36          // Verify annotations are as expected
   30.37          Set<TypeElement> expectedAnnotations = new HashSet<TypeElement>();
   30.38 -        if (round == 1)
   30.39 -            expectedAnnotations.add(eltUtils.
   30.40 -                                    getTypeElement("javax.annotation.processing.SupportedAnnotationTypes"));
   30.41 -        expectedAnnotations.add(eltUtils.
   30.42 -                                getTypeElement("java.lang.SuppressWarnings"));
   30.43 +        expectedAnnotations.add(eltUtils.getTypeElement("java.lang.SuppressWarnings"));
   30.44  
   30.45          if (!roundEnv.processingOver()) {
   30.46              System.out.println("\nRound " + round);
   30.47 @@ -127,16 +119,4 @@
   30.48          }
   30.49          return false;
   30.50      }
   30.51 -
   30.52 -    public SourceVersion getSupportedSourceVersion() {
   30.53 -        return SourceVersion.latest();
   30.54 -    }
   30.55 -
   30.56 -    public void init(ProcessingEnvironment processingEnv) {
   30.57 -        super.init(processingEnv);
   30.58 -        eltUtils = processingEnv.getElementUtils();
   30.59 -        messager = processingEnv.getMessager();
   30.60 -        filer    = processingEnv.getFiler();
   30.61 -        options  = processingEnv.getOptions();
   30.62 -    }
   30.63  }
    31.1 --- a/test/tools/javac/processing/messager/6362067/T6362067.java	Wed Sep 29 14:01:37 2010 -0700
    31.2 +++ b/test/tools/javac/processing/messager/6362067/T6362067.java	Wed Sep 29 23:27:57 2010 -0700
    31.3 @@ -2,39 +2,34 @@
    31.4   * @test  /nodynamiccopyright/
    31.5   * @bug     6362067
    31.6   * @summary Messager methods do not print out source position information
    31.7 - * @build   T6362067
    31.8 + * @library ../../../lib
    31.9 + * @build   JavacTestingAbstractProcessor T6362067
   31.10   * @compile -processor T6362067 -proc:only T6362067.java
   31.11   * @compile/ref=T6362067.out -XDrawDiagnostics -processor T6362067 -proc:only T6362067.java
   31.12   */
   31.13 -
   31.14  import java.util.Set;
   31.15  import javax.annotation.processing.*;
   31.16  import javax.lang.model.element.*;
   31.17  import static javax.tools.Diagnostic.Kind.*;
   31.18  
   31.19 -@Deprecated // convenient test annotation
   31.20 -@SupportedAnnotationTypes("*")
   31.21 -public class T6362067 extends AbstractProcessor {
   31.22 +@Deprecated // convenient test annotations
   31.23 +@SuppressWarnings({""})
   31.24 +public class T6362067 extends JavacTestingAbstractProcessor {
   31.25      public boolean process(Set<? extends TypeElement> annos,
   31.26                             RoundEnvironment roundEnv) {
   31.27 -        Messager msgr = processingEnv.getMessager();
   31.28 +
   31.29          for (Element e: roundEnv.getRootElements()) {
   31.30 -            msgr.printMessage(NOTE, "note:elem", e);
   31.31 +            messager.printMessage(NOTE, "note:elem", e);
   31.32              for (AnnotationMirror a: e.getAnnotationMirrors()) {
   31.33 -                msgr.printMessage(NOTE, "note:anno", e, a);
   31.34 +                messager.printMessage(NOTE, "note:anno", e, a);
   31.35                  for (AnnotationValue v: a.getElementValues().values()) {
   31.36 -                    msgr.printMessage(NOTE, "note:value", e, a, v);
   31.37 +                    messager.printMessage(NOTE, "note:value", e, a, v);
   31.38                  }
   31.39 -
   31.40              }
   31.41          }
   31.42 +
   31.43          if (roundEnv.processingOver())
   31.44 -            msgr.printMessage(NOTE, "note:nopos");
   31.45 +            messager.printMessage(NOTE, "note:nopos");
   31.46          return true;
   31.47      }
   31.48 -
   31.49 -    @Override
   31.50 -    public javax.lang.model.SourceVersion getSupportedSourceVersion() {
   31.51 -        return javax.lang.model.SourceVersion.latest();
   31.52 -    }
   31.53  }
    32.1 --- a/test/tools/javac/processing/messager/MessagerBasics.java	Wed Sep 29 14:01:37 2010 -0700
    32.2 +++ b/test/tools/javac/processing/messager/MessagerBasics.java	Wed Sep 29 23:27:57 2010 -0700
    32.3 @@ -1,5 +1,5 @@
    32.4  /*
    32.5 - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
    32.6 + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    32.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    32.8   *
    32.9   * This code is free software; you can redistribute it and/or modify it
   32.10 @@ -26,6 +26,8 @@
   32.11   * @bug     6341173 6341072
   32.12   * @summary Test presence of Messager methods
   32.13   * @author  Joseph D. Darcy
   32.14 + * @library ../../lib
   32.15 + * @build   JavacTestingAbstractProcessor
   32.16   * @compile MessagerBasics.java
   32.17   * @compile -processor MessagerBasics -proc:only MessagerBasics.java
   32.18   * @compile/fail -processor MessagerBasics -proc:only -AfinalError MessagerBasics.java
   32.19 @@ -39,18 +41,16 @@
   32.20  import javax.lang.model.util.*;
   32.21  import static javax.tools.Diagnostic.Kind.*;
   32.22  
   32.23 -@SupportedAnnotationTypes("*")
   32.24  @SupportedOptions("finalError")
   32.25 -public class MessagerBasics extends AbstractProcessor {
   32.26 +public class MessagerBasics extends JavacTestingAbstractProcessor {
   32.27      public boolean process(Set<? extends TypeElement> annotations,
   32.28                             RoundEnvironment roundEnv) {
   32.29 -        Messager m = processingEnv.getMessager();
   32.30          if (roundEnv.processingOver()) {
   32.31              if (processingEnv.getOptions().containsKey("finalError"))
   32.32 -                m.printMessage(ERROR,   "Does not compute");
   32.33 +                messager.printMessage(ERROR,   "Does not compute");
   32.34              else {
   32.35 -                m.printMessage(NOTE,    "Post no bills");
   32.36 -                m.printMessage(WARNING, "Beware the ides of March!");
   32.37 +                messager.printMessage(NOTE,    "Post no bills");
   32.38 +                messager.printMessage(WARNING, "Beware the ides of March!");
   32.39              }
   32.40          }
   32.41          return true;
    33.1 --- a/test/tools/javac/processing/model/6194785/T6194785.java	Wed Sep 29 14:01:37 2010 -0700
    33.2 +++ b/test/tools/javac/processing/model/6194785/T6194785.java	Wed Sep 29 23:27:57 2010 -0700
    33.3 @@ -1,5 +1,5 @@
    33.4  /*
    33.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    33.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    33.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    33.8   *
    33.9   * This code is free software; you can redistribute it and/or modify it
   33.10 @@ -26,6 +26,8 @@
   33.11   * @bug     6194785
   33.12   * @summary ParameterDeclaration.getSimpleName does not return actual name from class files
   33.13   * @author  Peter von der Ah\u00e9
   33.14 + * @library ../../../lib
   33.15 + * @build   JavacTestingAbstractProcessor
   33.16   * @compile -g T6194785.java T6194785a.java
   33.17   * @compile -processor T6194785 foo.T6194785a T6194785.java
   33.18   */
   33.19 @@ -36,13 +38,10 @@
   33.20  import javax.lang.model.util.*;
   33.21  import static javax.tools.Diagnostic.Kind.*;
   33.22  
   33.23 -@SupportedAnnotationTypes("*")
   33.24 -public class T6194785 extends AbstractProcessor {
   33.25 +public class T6194785 extends JavacTestingAbstractProcessor {
   33.26      public boolean process(Set<? extends TypeElement> annotations,
   33.27                             RoundEnvironment roundEnvironment)
   33.28      {
   33.29 -        final Messager log = processingEnv.getMessager();
   33.30 -        final Elements elements = processingEnv.getElementUtils();
   33.31          class Scan extends ElementScanner7<Void,Void> {
   33.32              @Override
   33.33              public Void visitExecutable(ExecutableElement e, Void ignored) {
    34.1 --- a/test/tools/javac/processing/model/6341534/T6341534.java	Wed Sep 29 14:01:37 2010 -0700
    34.2 +++ b/test/tools/javac/processing/model/6341534/T6341534.java	Wed Sep 29 23:27:57 2010 -0700
    34.3 @@ -1,5 +1,5 @@
    34.4  /*
    34.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    34.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    34.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    34.8   *
    34.9   * This code is free software; you can redistribute it and/or modify it
   34.10 @@ -27,6 +27,8 @@
   34.11   * @summary PackageElement.getEnclosedElements results in NullPointerException from parse(JavaCompiler.java:429)
   34.12   * @author  Steve Sides
   34.13   * @author  Peter von der Ahe
   34.14 + * @library ../../../lib
   34.15 + * @build   JavacTestingAbstractProcessor
   34.16   * @compile T6341534.java
   34.17   * @compile -proc:only -processor T6341534 dir/package-info.java
   34.18   * @compile -processor T6341534 dir/package-info.java
   34.19 @@ -40,20 +42,11 @@
   34.20  import java.util.Set;
   34.21  import static javax.tools.Diagnostic.Kind.*;
   34.22  
   34.23 -@SupportedAnnotationTypes("*")
   34.24 -public class T6341534 extends AbstractProcessor {
   34.25 -    Elements elements;
   34.26 -    Messager messager;
   34.27 -    public void init(ProcessingEnvironment penv)  {
   34.28 -        super.init(penv);
   34.29 -        elements = penv.getElementUtils();
   34.30 -        messager = processingEnv.getMessager();
   34.31 -    }
   34.32 -
   34.33 +public class T6341534 extends JavacTestingAbstractProcessor {
   34.34      public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv)  {
   34.35          messager.printMessage(NOTE,
   34.36 -                              String.valueOf(elements.getPackageElement("no.such.package")));
   34.37 -        PackageElement dir = elements.getPackageElement("dir");
   34.38 +                              String.valueOf(eltUtils.getPackageElement("no.such.package")));
   34.39 +        PackageElement dir = eltUtils.getPackageElement("dir");
   34.40          messager.printMessage(NOTE, dir.getQualifiedName().toString());
   34.41          for (Element e : dir.getEnclosedElements())
   34.42              messager.printMessage(NOTE, e.toString());
    35.1 --- a/test/tools/javac/processing/model/element/TestAnonClassNames.java	Wed Sep 29 14:01:37 2010 -0700
    35.2 +++ b/test/tools/javac/processing/model/element/TestAnonClassNames.java	Wed Sep 29 23:27:57 2010 -0700
    35.3 @@ -26,7 +26,8 @@
    35.4   * @bug 6449781
    35.5   * @summary Test that reported names of anonymous classes are non-null.
    35.6   * @author  Joseph D. Darcy
    35.7 - * @build TestAnonSourceNames
    35.8 + * @library ../../../lib
    35.9 + * @build   JavacTestingAbstractProcessor TestAnonSourceNames
   35.10   * @compile -processor TestAnonSourceNames TestAnonClassNames.java
   35.11   * @run main TestAnonClassNames
   35.12   */
   35.13 @@ -141,8 +142,7 @@
   35.14  /**
   35.15   * Probe at the various kinds of names of a type element.
   35.16   */
   35.17 -@SupportedAnnotationTypes("*")
   35.18 -class ClassNameProber extends AbstractProcessor {
   35.19 +class ClassNameProber extends JavacTestingAbstractProcessor {
   35.20      public ClassNameProber(){super();}
   35.21  
   35.22      private boolean classesFound=false;
   35.23 @@ -174,8 +174,4 @@
   35.24          }
   35.25          return true;
   35.26      }
   35.27 -
   35.28 -    public SourceVersion getSupportedSourceVersion() {
   35.29 -        return SourceVersion.latest();
   35.30 -    }
   35.31  }
    36.1 --- a/test/tools/javac/processing/model/element/TestAnonSourceNames.java	Wed Sep 29 14:01:37 2010 -0700
    36.2 +++ b/test/tools/javac/processing/model/element/TestAnonSourceNames.java	Wed Sep 29 23:27:57 2010 -0700
    36.3 @@ -36,8 +36,7 @@
    36.4   * Using the tree API, retrieve element representations of anonymous
    36.5   * classes and verify their names are as specified.
    36.6   */
    36.7 -@SupportedAnnotationTypes("*")
    36.8 -public class TestAnonSourceNames extends AbstractProcessor {
    36.9 +public class TestAnonSourceNames extends JavacTestingAbstractProcessor {
   36.10  
   36.11     public boolean process(Set<? extends TypeElement> annotations,
   36.12                            RoundEnvironment roundEnv) {
   36.13 @@ -84,9 +83,4 @@
   36.14             return super.visitClass(node, cu);
   36.15         }
   36.16     }
   36.17 -
   36.18 -   @Override
   36.19 -   public SourceVersion getSupportedSourceVersion() {
   36.20 -       return SourceVersion.latest();
   36.21 -   }
   36.22  }
    37.1 --- a/test/tools/javac/processing/model/element/TestElement.java	Wed Sep 29 14:01:37 2010 -0700
    37.2 +++ b/test/tools/javac/processing/model/element/TestElement.java	Wed Sep 29 23:27:57 2010 -0700
    37.3 @@ -1,5 +1,5 @@
    37.4  /*
    37.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    37.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    37.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    37.8   *
    37.9   * This code is free software; you can redistribute it and/or modify it
   37.10 @@ -26,7 +26,8 @@
   37.11   * @bug 6453386
   37.12   * @summary Test basic properties of javax.lang.element.Element
   37.13   * @author  Joseph D. Darcy
   37.14 - * @build TestElement
   37.15 + * @library ../../../lib
   37.16 + * @build   JavacTestingAbstractProcessor TestElement
   37.17   * @compile -processor TestElement -proc:only TestElement.java
   37.18   */
   37.19  
   37.20 @@ -43,8 +44,7 @@
   37.21  /**
   37.22   * Test basic workings of javax.lang.element.Element
   37.23   */
   37.24 -@SupportedAnnotationTypes("*")
   37.25 -public class TestElement extends AbstractProcessor {
   37.26 +public class TestElement extends JavacTestingAbstractProcessor {
   37.27      /**
   37.28       * For now, just check that constructors have a simple name of
   37.29       * "<init>".
   37.30 @@ -66,9 +66,4 @@
   37.31          }
   37.32          return true;
   37.33      }
   37.34 -
   37.35 -    public SourceVersion getSupportedSourceVersion() {
   37.36 -        return SourceVersion.latest();
   37.37 -    }
   37.38 -
   37.39  }
    38.1 --- a/test/tools/javac/processing/model/element/TestNames.java	Wed Sep 29 14:01:37 2010 -0700
    38.2 +++ b/test/tools/javac/processing/model/element/TestNames.java	Wed Sep 29 23:27:57 2010 -0700
    38.3 @@ -1,5 +1,5 @@
    38.4  /*
    38.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    38.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    38.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    38.8   *
    38.9   * This code is free software; you can redistribute it and/or modify it
   38.10 @@ -26,7 +26,8 @@
   38.11   * @bug 6380016
   38.12   * @summary Test that the constraints guaranteed by the Filer and maintained
   38.13   * @author  Joseph D. Darcy
   38.14 - * @build TestNames
   38.15 + * @library ../../../lib
   38.16 + * @build   JavacTestingAbstractProcessor TestNames
   38.17   * @compile -processor TestNames -proc:only TestNames.java
   38.18   */
   38.19  
   38.20 @@ -45,11 +46,8 @@
   38.21  /**
   38.22   * Basic tests of semantics of javax.lang.model.element.Name
   38.23   */
   38.24 -@SupportedAnnotationTypes("*")
   38.25 -public class TestNames extends AbstractProcessor {
   38.26 +public class TestNames extends JavacTestingAbstractProcessor {
   38.27      private int round = 0;
   38.28 -    private Filer filer;
   38.29 -    private Elements eltUtils;
   38.30  
   38.31      String stringStringName = "java.lang.String";
   38.32      Name stringName = null;
   38.33 @@ -106,16 +104,6 @@
   38.34          return true;
   38.35      }
   38.36  
   38.37 -    public SourceVersion getSupportedSourceVersion() {
   38.38 -        return SourceVersion.latest();
   38.39 -    }
   38.40 -
   38.41 -    public void init(ProcessingEnvironment processingEnv) {
   38.42 -        super.init(processingEnv);
   38.43 -        filer    = processingEnv.getFiler();
   38.44 -        eltUtils = processingEnv.getElementUtils();
   38.45 -    }
   38.46 -
   38.47      private static class Pseudonym implements Name {
   38.48          private String name;
   38.49  
    39.1 --- a/test/tools/javac/processing/model/element/TestPackageElement.java	Wed Sep 29 14:01:37 2010 -0700
    39.2 +++ b/test/tools/javac/processing/model/element/TestPackageElement.java	Wed Sep 29 23:27:57 2010 -0700
    39.3 @@ -1,5 +1,5 @@
    39.4  /*
    39.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    39.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    39.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    39.8   *
    39.9   * This code is free software; you can redistribute it and/or modify it
   39.10 @@ -26,7 +26,8 @@
   39.11   * @bug 6449798 6399404
   39.12   * @summary Test basic workings of PackageElement
   39.13   * @author  Joseph D. Darcy
   39.14 - * @build TestPackageElement
   39.15 + * @library ../../../lib
   39.16 + * @build   JavacTestingAbstractProcessor TestPackageElement
   39.17   * @compile -processor TestPackageElement -proc:only TestPackageElement.java
   39.18   */
   39.19  
   39.20 @@ -43,11 +44,7 @@
   39.21  /**
   39.22   * Test basic workings of PackageElement.
   39.23   */
   39.24 -@SupportedAnnotationTypes("*")
   39.25 -public class TestPackageElement extends AbstractProcessor {
   39.26 -    private Filer filer;
   39.27 -    private Elements eltUtils;
   39.28 -
   39.29 +public class TestPackageElement extends JavacTestingAbstractProcessor {
   39.30      public boolean process(Set<? extends TypeElement> annotations,
   39.31                             RoundEnvironment roundEnv) {
   39.32          if (!roundEnv.processingOver()) {
   39.33 @@ -71,15 +68,4 @@
   39.34          }
   39.35          return true;
   39.36      }
   39.37 -
   39.38 -    public SourceVersion getSupportedSourceVersion() {
   39.39 -        return SourceVersion.latest();
   39.40 -    }
   39.41 -
   39.42 -    public void init(ProcessingEnvironment processingEnv) {
   39.43 -        super.init(processingEnv);
   39.44 -        filer    = processingEnv.getFiler();
   39.45 -        eltUtils = processingEnv.getElementUtils();
   39.46 -    }
   39.47 -
   39.48  }
    40.1 --- a/test/tools/javac/processing/model/element/TestResourceElement.java	Wed Sep 29 14:01:37 2010 -0700
    40.2 +++ b/test/tools/javac/processing/model/element/TestResourceElement.java	Wed Sep 29 23:27:57 2010 -0700
    40.3 @@ -26,7 +26,8 @@
    40.4   * @bug 6967842
    40.5   * @summary Element not returned from tree API for ARM resource variables.
    40.6   * @author A. Sundararajan
    40.7 - * @build TestResourceElement
    40.8 + * @library ../../../lib
    40.9 + * @build   JavacTestingAbstractProcessor TestResourceElement
   40.10   * @compile -processor TestResourceElement -proc:only TestResourceElement.java
   40.11   */
   40.12  
   40.13 @@ -37,8 +38,7 @@
   40.14  import com.sun.source.tree.*;
   40.15  import com.sun.source.util.*;
   40.16  
   40.17 -@SupportedAnnotationTypes("*")
   40.18 -public class TestResourceElement extends AbstractProcessor implements AutoCloseable {
   40.19 +public class TestResourceElement extends JavacTestingAbstractProcessor implements AutoCloseable {
   40.20      public boolean process(Set<? extends TypeElement> annotations,
   40.21                            RoundEnvironment roundEnv) {
   40.22         if (!roundEnv.processingOver()) {
   40.23 @@ -88,9 +88,4 @@
   40.24             return trvElement;
   40.25         }
   40.26     }
   40.27 -
   40.28 -   @Override
   40.29 -   public SourceVersion getSupportedSourceVersion() {
   40.30 -       return SourceVersion.latest();
   40.31 -   }
   40.32  }
    41.1 --- a/test/tools/javac/processing/model/element/TestResourceVariable.java	Wed Sep 29 14:01:37 2010 -0700
    41.2 +++ b/test/tools/javac/processing/model/element/TestResourceVariable.java	Wed Sep 29 23:27:57 2010 -0700
    41.3 @@ -26,7 +26,8 @@
    41.4   * @bug  6911256 6964740 6967842
    41.5   * @summary Test that the resource variable kind is appropriately set
    41.6   * @author  Joseph D. Darcy
    41.7 - * @build TestResourceVariable
    41.8 + * @library ../../../lib
    41.9 + * @build   JavacTestingAbstractProcessor TestResourceVariable
   41.10   * @compile -processor TestResourceVariable -proc:only TestResourceVariable.java
   41.11   */
   41.12  
   41.13 @@ -48,8 +49,7 @@
   41.14   * resource of an ARM block and verify their kind tags are set
   41.15   * appropriately.
   41.16   */
   41.17 -@SupportedAnnotationTypes("*")
   41.18 -public class TestResourceVariable extends AbstractProcessor implements AutoCloseable {
   41.19 +public class TestResourceVariable extends JavacTestingAbstractProcessor implements AutoCloseable {
   41.20      int resourceVariableCount = 0;
   41.21  
   41.22      public boolean process(Set<? extends TypeElement> annotations,
   41.23 @@ -105,9 +105,4 @@
   41.24             return super.visitVariable(node, cu);
   41.25         }
   41.26     }
   41.27 -
   41.28 -   @Override
   41.29 -   public SourceVersion getSupportedSourceVersion() {
   41.30 -       return SourceVersion.latest();
   41.31 -   }
   41.32  }
    42.1 --- a/test/tools/javac/processing/model/element/TypeParamBounds.java	Wed Sep 29 14:01:37 2010 -0700
    42.2 +++ b/test/tools/javac/processing/model/element/TypeParamBounds.java	Wed Sep 29 23:27:57 2010 -0700
    42.3 @@ -1,5 +1,5 @@
    42.4  /*
    42.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    42.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    42.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    42.8   *
    42.9   * This code is free software; you can redistribute it and/or modify it
   42.10 @@ -26,7 +26,8 @@
   42.11   * @bug     6423972
   42.12   * @summary Tests TypeParameter.getBounds.
   42.13   * @author  Scott Seligman
   42.14 - * @build   TypeParamBounds
   42.15 + * @library ../../../lib
   42.16 + * @build   JavacTestingAbstractProcessor TypeParamBounds
   42.17   * @compile -processor TypeParamBounds -proc:only TypeParamBounds.java
   42.18   */
   42.19  
   42.20 @@ -40,18 +41,7 @@
   42.21  import javax.lang.model.type.*;
   42.22  import javax.lang.model.util.*;
   42.23  
   42.24 -@SupportedAnnotationTypes("*")
   42.25 -public class TypeParamBounds extends AbstractProcessor {
   42.26 -
   42.27 -    Elements elements;
   42.28 -    Types types;
   42.29 -
   42.30 -    public void init(ProcessingEnvironment penv) {
   42.31 -        super.init(penv);
   42.32 -        elements = penv.getElementUtils();
   42.33 -        types = penv.getTypeUtils();
   42.34 -    }
   42.35 -
   42.36 +public class TypeParamBounds extends JavacTestingAbstractProcessor {
   42.37      public boolean process(Set<? extends TypeElement> annoTypes,
   42.38                             RoundEnvironment round) {
   42.39          if (!round.processingOver())
   42.40 @@ -59,11 +49,6 @@
   42.41          return true;
   42.42      }
   42.43  
   42.44 -    @Override
   42.45 -    public SourceVersion getSupportedSourceVersion() {
   42.46 -        return SourceVersion.latest();
   42.47 -    }
   42.48 -
   42.49      private void doit(Set<? extends TypeElement> annoTypes,
   42.50                        RoundEnvironment round) {
   42.51          TypeElement gen = elements.getTypeElement("TypeParamBounds.Gen");
   42.52 @@ -91,7 +76,6 @@
   42.53  
   42.54  
   42.55      // Fodder for the processor
   42.56 -
   42.57      static class Gen<T, U extends Object, V extends Number, W extends U,
   42.58                       X extends Runnable, Y extends CharSequence & Runnable,
   42.59                       Z extends Object & Runnable> {
    43.1 --- a/test/tools/javac/processing/model/type/MirroredTypeEx/OverEager.java	Wed Sep 29 14:01:37 2010 -0700
    43.2 +++ b/test/tools/javac/processing/model/type/MirroredTypeEx/OverEager.java	Wed Sep 29 23:27:57 2010 -0700
    43.3 @@ -1,5 +1,5 @@
    43.4  /*
    43.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    43.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    43.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    43.8   *
    43.9   * This code is free software; you can redistribute it and/or modify it
   43.10 @@ -26,6 +26,8 @@
   43.11   * @bug     6362178
   43.12   * @summary MirroredType[s]Exception shouldn't be created too eagerly
   43.13   * @author  Scott Seligman
   43.14 + * @library ../../../../lib
   43.15 + * @build JavacTestingAbstractProcessor
   43.16   * @compile -g OverEager.java
   43.17   * @compile -processor OverEager -proc:only OverEager.java
   43.18   */
   43.19 @@ -40,17 +42,7 @@
   43.20  
   43.21  @SupportedAnnotationTypes("IAm")
   43.22  @IAm(OverEager.class)
   43.23 -public class OverEager extends AbstractProcessor {
   43.24 -
   43.25 -    Elements elements;
   43.26 -    Types types;
   43.27 -
   43.28 -    public void init(ProcessingEnvironment penv) {
   43.29 -        super.init(penv);
   43.30 -        elements = penv.getElementUtils();
   43.31 -        types =  penv.getTypeUtils();
   43.32 -    }
   43.33 -
   43.34 +public class OverEager extends JavacTestingAbstractProcessor {
   43.35      public boolean process(Set<? extends TypeElement> annoTypes,
   43.36                             RoundEnvironment round) {
   43.37          if (!round.processingOver())
   43.38 @@ -58,11 +50,6 @@
   43.39          return true;
   43.40      }
   43.41  
   43.42 -    @Override
   43.43 -    public SourceVersion getSupportedSourceVersion() {
   43.44 -        return SourceVersion.latest();
   43.45 -    }
   43.46 -
   43.47      private void doit(Set<? extends TypeElement> annoTypes,
   43.48                        RoundEnvironment round) {
   43.49          for (TypeElement t : typesIn(round.getRootElements())) {
    44.1 --- a/test/tools/javac/processing/model/type/MirroredTypeEx/Plurality.java	Wed Sep 29 14:01:37 2010 -0700
    44.2 +++ b/test/tools/javac/processing/model/type/MirroredTypeEx/Plurality.java	Wed Sep 29 23:27:57 2010 -0700
    44.3 @@ -25,6 +25,8 @@
    44.4   * @test
    44.5   * @bug     6519115
    44.6   * @summary Verify MirroredTypeException vs MirroredTypesException is thrown
    44.7 + * @library ../../../../lib
    44.8 + * @build JavacTestingAbstractProcessor
    44.9   * @compile Plurality.java
   44.10   * @compile -processor Plurality -proc:only Plurality.java
   44.11   * @author  Joseph D. Darcy
   44.12 @@ -38,25 +40,13 @@
   44.13  import javax.lang.model.type.*;
   44.14  import javax.lang.model.util.*;
   44.15  
   44.16 -@SupportedAnnotationTypes("*")
   44.17  @P0
   44.18  @P1
   44.19  @P2
   44.20  @S1
   44.21 -public class Plurality extends AbstractProcessor {
   44.22 +public class Plurality extends JavacTestingAbstractProcessor {
   44.23      private boolean executed = false;
   44.24  
   44.25 -    Elements elements;
   44.26 -    Types types;
   44.27 -
   44.28 -    @Override
   44.29 -    public void init(ProcessingEnvironment penv) {
   44.30 -        super.init(penv);
   44.31 -        elements = penv.getElementUtils();
   44.32 -        types =  penv.getTypeUtils();
   44.33 -    }
   44.34 -
   44.35 -
   44.36      public boolean process(Set<? extends TypeElement> annotations,
   44.37                             RoundEnvironment roundEnv) {
   44.38          if (!roundEnv.processingOver()) {
   44.39 @@ -164,11 +154,6 @@
   44.40                                             toStringName);
   44.41          }
   44.42      }
   44.43 -
   44.44 -    @Override
   44.45 -    public SourceVersion getSupportedSourceVersion() {
   44.46 -        return SourceVersion.latest();
   44.47 -    }
   44.48  }
   44.49  
   44.50  @Retention(RetentionPolicy.RUNTIME)
    45.1 --- a/test/tools/javac/processing/model/type/NoTypes.java	Wed Sep 29 14:01:37 2010 -0700
    45.2 +++ b/test/tools/javac/processing/model/type/NoTypes.java	Wed Sep 29 23:27:57 2010 -0700
    45.3 @@ -1,5 +1,5 @@
    45.4  /*
    45.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    45.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    45.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    45.8   *
    45.9   * This code is free software; you can redistribute it and/or modify it
   45.10 @@ -26,6 +26,8 @@
   45.11   * @bug     6418666 6423973 6453386
   45.12   * @summary Test the NoTypes: VOID, PACKAGE, NONE
   45.13   * @author  Scott Seligman
   45.14 + * @library ../../../lib
   45.15 + * @build JavacTestingAbstractProcessor
   45.16   * @compile -g NoTypes.java
   45.17   * @compile -processor NoTypes -proc:only NoTypes.java
   45.18   */
   45.19 @@ -39,18 +41,7 @@
   45.20  
   45.21  import static javax.lang.model.type.TypeKind.*;
   45.22  
   45.23 -@SupportedAnnotationTypes("*")
   45.24 -public class NoTypes extends AbstractProcessor {
   45.25 -
   45.26 -    Elements elements;
   45.27 -    Types types;
   45.28 -
   45.29 -    public void init(ProcessingEnvironment penv) {
   45.30 -        super.init(penv);
   45.31 -        elements = penv.getElementUtils();
   45.32 -        types =  penv.getTypeUtils();
   45.33 -    }
   45.34 -
   45.35 +public class NoTypes extends JavacTestingAbstractProcessor {
   45.36      public boolean process(Set<? extends TypeElement> annoTypes,
   45.37                             RoundEnvironment round) {
   45.38          if (!round.processingOver())
   45.39 @@ -58,11 +49,6 @@
   45.40          return true;
   45.41      }
   45.42  
   45.43 -    @Override
   45.44 -    public SourceVersion getSupportedSourceVersion() {
   45.45 -        return SourceVersion.latest();
   45.46 -    }
   45.47 -
   45.48      private void doit(Set<? extends TypeElement> annoTypes,
   45.49                        RoundEnvironment round) {
   45.50  
    46.1 --- a/test/tools/javac/processing/model/util/BinaryName.java	Wed Sep 29 14:01:37 2010 -0700
    46.2 +++ b/test/tools/javac/processing/model/util/BinaryName.java	Wed Sep 29 23:27:57 2010 -0700
    46.3 @@ -1,5 +1,5 @@
    46.4  /*
    46.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    46.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    46.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    46.8   *
    46.9   * This code is free software; you can redistribute it and/or modify it
   46.10 @@ -26,7 +26,8 @@
   46.11   * @bug     6346251
   46.12   * @summary Test Elements.getBinaryName
   46.13   * @author  Scott Seligman
   46.14 - * @build   BinaryName
   46.15 + * @library ../../../lib
   46.16 + * @build   JavacTestingAbstractProcessor BinaryName
   46.17   * @compile -processor BinaryName -proc:only BinaryName.java
   46.18   */
   46.19  
   46.20 @@ -38,17 +39,8 @@
   46.21  
   46.22  import static javax.lang.model.util.ElementFilter.typesIn;
   46.23  
   46.24 -@SupportedAnnotationTypes("*")
   46.25  @HelloIm("BinaryName")
   46.26 -public class BinaryName extends AbstractProcessor {
   46.27 -
   46.28 -    Elements elements;
   46.29 -
   46.30 -    public void init(ProcessingEnvironment penv) {
   46.31 -        super.init(penv);
   46.32 -        elements = penv.getElementUtils();
   46.33 -    }
   46.34 -
   46.35 +public class BinaryName extends JavacTestingAbstractProcessor {
   46.36      public boolean process(Set<? extends TypeElement> tes,
   46.37                             RoundEnvironment round) {
   46.38          if (round.processingOver()) return true;
    47.1 --- a/test/tools/javac/processing/model/util/GetTypeElemBadArg.java	Wed Sep 29 14:01:37 2010 -0700
    47.2 +++ b/test/tools/javac/processing/model/util/GetTypeElemBadArg.java	Wed Sep 29 23:27:57 2010 -0700
    47.3 @@ -1,5 +1,5 @@
    47.4  /*
    47.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    47.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    47.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    47.8   *
    47.9   * This code is free software; you can redistribute it and/or modify it
   47.10 @@ -26,7 +26,8 @@
   47.11   * @bug     6346506 6408241
   47.12   * @summary getTypeElement should tolerate a type that can't be found
   47.13   * @author  Scott Seligman
   47.14 - * @build   GetTypeElemBadArg
   47.15 + * @library ../../../lib
   47.16 + * @build   JavacTestingAbstractProcessor GetTypeElemBadArg
   47.17   * @compile -processor GetTypeElemBadArg -proc:only GetTypeElemBadArg.java
   47.18   */
   47.19  
   47.20 @@ -37,16 +38,7 @@
   47.21  import javax.lang.model.type.*;
   47.22  import javax.lang.model.util.*;
   47.23  
   47.24 -@SupportedAnnotationTypes("*")
   47.25 -public class GetTypeElemBadArg extends AbstractProcessor {
   47.26 -
   47.27 -    Elements elements;
   47.28 -
   47.29 -    public void init(ProcessingEnvironment penv) {
   47.30 -        super.init(penv);
   47.31 -        elements = penv.getElementUtils();
   47.32 -    }
   47.33 -
   47.34 +public class GetTypeElemBadArg extends JavacTestingAbstractProcessor {
   47.35      public boolean process(Set<? extends TypeElement> tes,
   47.36                             RoundEnvironment round) {
   47.37          if (round.processingOver()) return true;
   47.38 @@ -63,12 +55,6 @@
   47.39          return true;
   47.40      }
   47.41  
   47.42 -
   47.43 -    @Override
   47.44 -    public SourceVersion getSupportedSourceVersion() {
   47.45 -        return SourceVersion.latest();
   47.46 -    }
   47.47 -
   47.48      private static void tellAbout(TypeElement t) {
   47.49          System.out.println(t);
   47.50          System.out.println(t.getClass());
    48.1 --- a/test/tools/javac/processing/model/util/NoSupers.java	Wed Sep 29 14:01:37 2010 -0700
    48.2 +++ b/test/tools/javac/processing/model/util/NoSupers.java	Wed Sep 29 23:27:57 2010 -0700
    48.3 @@ -1,5 +1,5 @@
    48.4  /*
    48.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    48.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    48.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    48.8   *
    48.9   * This code is free software; you can redistribute it and/or modify it
   48.10 @@ -26,7 +26,8 @@
   48.11   * @bug     6346453
   48.12   * @summary directSupertypes should return empty list if arg has no supertypes
   48.13   * @author  Scott Seligman
   48.14 - * @build   NoSupers
   48.15 + * @library ../../../lib
   48.16 + * @build   JavacTestingAbstractProcessor NoSupers
   48.17   * @compile -processor NoSupers -proc:only NoSupers.java
   48.18   */
   48.19  
   48.20 @@ -36,16 +37,7 @@
   48.21  import javax.lang.model.type.*;
   48.22  import javax.lang.model.util.*;
   48.23  
   48.24 -@SupportedAnnotationTypes("*")
   48.25 -public class NoSupers extends AbstractProcessor {
   48.26 -
   48.27 -    Types types;
   48.28 -
   48.29 -    public void init(ProcessingEnvironment penv) {
   48.30 -        super.init(penv);
   48.31 -        types = penv.getTypeUtils();
   48.32 -    }
   48.33 -
   48.34 +public class NoSupers extends JavacTestingAbstractProcessor {
   48.35      public boolean process(Set<? extends TypeElement> tes,
   48.36                             RoundEnvironment round) {
   48.37          if (round.processingOver()) return true;
    49.1 --- a/test/tools/javac/processing/model/util/OverridesSpecEx.java	Wed Sep 29 14:01:37 2010 -0700
    49.2 +++ b/test/tools/javac/processing/model/util/OverridesSpecEx.java	Wed Sep 29 23:27:57 2010 -0700
    49.3 @@ -1,5 +1,5 @@
    49.4  /*
    49.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    49.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    49.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    49.8   *
    49.9   * This code is free software; you can redistribute it and/or modify it
   49.10 @@ -26,6 +26,8 @@
   49.11   * @bug     6453386
   49.12   * @summary Verify that example code in Elements.overrides works as spec'ed.
   49.13   * @author  Scott Seligman
   49.14 + * @library ../../../lib
   49.15 + * @build JavacTestingAbstractProcessor
   49.16   * @compile -g OverridesSpecEx.java
   49.17   * @compile -processor OverridesSpecEx -proc:only OverridesSpecEx.java
   49.18   */
   49.19 @@ -39,19 +41,7 @@
   49.20  
   49.21  import static javax.lang.model.util.ElementFilter.*;
   49.22  
   49.23 -
   49.24 -@SupportedAnnotationTypes("*")
   49.25 -public class OverridesSpecEx extends AbstractProcessor {
   49.26 -
   49.27 -    Elements elements;
   49.28 -    Types types;
   49.29 -
   49.30 -    public void init(ProcessingEnvironment penv) {
   49.31 -        super.init(penv);
   49.32 -        elements = penv.getElementUtils();
   49.33 -        types =  penv.getTypeUtils();
   49.34 -    }
   49.35 -
   49.36 +public class OverridesSpecEx extends JavacTestingAbstractProcessor {
   49.37      public boolean process(Set<? extends TypeElement> annoTypes,
   49.38                             RoundEnvironment round) {
   49.39          if (!round.processingOver())
   49.40 @@ -59,11 +49,6 @@
   49.41          return true;
   49.42      }
   49.43  
   49.44 -    @Override
   49.45 -    public SourceVersion getSupportedSourceVersion() {
   49.46 -        return SourceVersion.latest();
   49.47 -    }
   49.48 -
   49.49      private void doit(Set<? extends TypeElement> annoTypes,
   49.50                        RoundEnvironment round) {
   49.51          TypeElement string = elements.getTypeElement("java.lang.String");
   49.52 @@ -113,9 +98,7 @@
   49.53              throw new AssertionError("Bogus result");
   49.54      }
   49.55  
   49.56 -
   49.57      // Fodder for the processor
   49.58 -
   49.59      class A {
   49.60          public void m() {}
   49.61      }
    50.1 --- a/test/tools/javac/processing/model/util/TypesBadArg.java	Wed Sep 29 14:01:37 2010 -0700
    50.2 +++ b/test/tools/javac/processing/model/util/TypesBadArg.java	Wed Sep 29 23:27:57 2010 -0700
    50.3 @@ -1,5 +1,5 @@
    50.4  /*
    50.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    50.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    50.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    50.8   *
    50.9   * This code is free software; you can redistribute it and/or modify it
   50.10 @@ -26,7 +26,8 @@
   50.11   * @bug     6345812
   50.12   * @summary Validate argument kinds in Types utilities
   50.13   * @author  Scott Seligman
   50.14 - * @build   TypesBadArg
   50.15 + * @library ../../../lib
   50.16 + * @build   JavacTestingAbstractProcessor TypesBadArg
   50.17   * @compile -processor TypesBadArg -proc:only TypesBadArg.java
   50.18   */
   50.19  
   50.20 @@ -36,15 +37,9 @@
   50.21  import javax.lang.model.type.*;
   50.22  import javax.lang.model.util.*;
   50.23  
   50.24 -@SupportedAnnotationTypes("*")
   50.25 -public class TypesBadArg extends AbstractProcessor {
   50.26 -
   50.27 +public class TypesBadArg extends JavacTestingAbstractProcessor {
   50.28      boolean success = true;
   50.29  
   50.30 -    public void init(ProcessingEnvironment penv) {
   50.31 -        super.init(penv);
   50.32 -    }
   50.33 -
   50.34      public boolean process(Set<? extends TypeElement> tes,
   50.35                             RoundEnvironment round) {
   50.36          if (round.processingOver()) return true;
    51.1 --- a/test/tools/javac/processing/model/util/deprecation/TestDeprecation.java	Wed Sep 29 14:01:37 2010 -0700
    51.2 +++ b/test/tools/javac/processing/model/util/deprecation/TestDeprecation.java	Wed Sep 29 23:27:57 2010 -0700
    51.3 @@ -1,5 +1,5 @@
    51.4  /*
    51.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    51.6 + * Copyright (c) 2006, 2010 Oracle and/or its affiliates. All rights reserved.
    51.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    51.8   *
    51.9   * This code is free software; you can redistribute it and/or modify it
   51.10 @@ -26,6 +26,8 @@
   51.11   * @bug 6392818
   51.12   * @summary Tests Elements.isDeprecated(Element)
   51.13   * @author  Joseph D. Darcy
   51.14 + * @library ../../../../lib
   51.15 + * @build JavacTestingAbstractProcessor
   51.16   * @compile TestDeprecation.java
   51.17   * @compile -processor TestDeprecation -proc:only Dep1.java
   51.18   * @compile Dep1.java
   51.19 @@ -47,8 +49,7 @@
   51.20   * getElementsAnnotatedWith is consistent with the expected results
   51.21   * stored in an AnnotatedElementInfo annotation.
   51.22   */
   51.23 -@SupportedAnnotationTypes("*")
   51.24 -public class TestDeprecation extends AbstractProcessor {
   51.25 +public class TestDeprecation extends JavacTestingAbstractProcessor {
   51.26  
   51.27      public boolean process(Set<? extends TypeElement> annotations,
   51.28                             RoundEnvironment roundEnv) {
   51.29 @@ -98,9 +99,4 @@
   51.30              return failure;
   51.31          }
   51.32      }
   51.33 -
   51.34 -    @Override
   51.35 -    public SourceVersion getSupportedSourceVersion() {
   51.36 -        return SourceVersion.latest();
   51.37 -    }
   51.38  }
    52.1 --- a/test/tools/javac/processing/model/util/directSupersOfErr/DirectSupersOfErr.java	Wed Sep 29 14:01:37 2010 -0700
    52.2 +++ b/test/tools/javac/processing/model/util/directSupersOfErr/DirectSupersOfErr.java	Wed Sep 29 23:27:57 2010 -0700
    52.3 @@ -1,5 +1,5 @@
    52.4  /*
    52.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    52.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    52.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    52.8   *
    52.9   * This code is free software; you can redistribute it and/or modify it
   52.10 @@ -26,7 +26,8 @@
   52.11   * @bug     6346973
   52.12   * @summary directSupertypes(t) should not return t
   52.13   * @author  Scott Seligman
   52.14 - * @build   DirectSupersOfErr
   52.15 + * @library ../../../../lib
   52.16 + * @build   JavacTestingAbstractProcessor DirectSupersOfErr
   52.17   * @compile -processor DirectSupersOfErr -proc:only C1.java
   52.18   */
   52.19  
   52.20 @@ -37,16 +38,7 @@
   52.21  import javax.lang.model.util.*;
   52.22  import static javax.lang.model.util.ElementFilter.*;
   52.23  
   52.24 -@SupportedAnnotationTypes("*")
   52.25 -public class DirectSupersOfErr extends AbstractProcessor {
   52.26 -
   52.27 -    Types types;
   52.28 -
   52.29 -    public void init(ProcessingEnvironment penv) {
   52.30 -        super.init(penv);
   52.31 -        types = penv.getTypeUtils();
   52.32 -    }
   52.33 -
   52.34 +public class DirectSupersOfErr extends JavacTestingAbstractProcessor {
   52.35      public boolean process(Set<? extends TypeElement> tes,
   52.36                             RoundEnvironment round) {
   52.37          if (round.processingOver()) return true;
    53.1 --- a/test/tools/javac/processing/model/util/elements/TestGetConstantExpression.java	Wed Sep 29 14:01:37 2010 -0700
    53.2 +++ b/test/tools/javac/processing/model/util/elements/TestGetConstantExpression.java	Wed Sep 29 23:27:57 2010 -0700
    53.3 @@ -1,5 +1,5 @@
    53.4  /*
    53.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    53.6 + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
    53.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    53.8   *
    53.9   * This code is free software; you can redistribute it and/or modify it
   53.10 @@ -26,7 +26,8 @@
   53.11   * @bug 6471577 6517779
   53.12   * @summary Test Elements.getConstantExpression
   53.13   * @author  Joseph D. Darcy
   53.14 - * @build TestGetConstantExpression
   53.15 + * @library ../../../../lib
   53.16 + * @build   JavacTestingAbstractProcessor TestGetConstantExpression
   53.17   * @compile -processor TestGetConstantExpression Foo.java
   53.18   */
   53.19  
   53.20 @@ -44,10 +45,7 @@
   53.21  /**
   53.22   * Test basic workings of Elements.getConstantExpression.
   53.23   */
   53.24 -@SupportedAnnotationTypes("*")
   53.25 -public class TestGetConstantExpression extends AbstractProcessor {
   53.26 -    private Elements eltUtils;
   53.27 -    private Filer filer;
   53.28 +public class TestGetConstantExpression extends JavacTestingAbstractProcessor {
   53.29      private int round = 1;
   53.30  
   53.31      /**
   53.32 @@ -130,14 +128,4 @@
   53.33              return 0;
   53.34          }
   53.35      }
   53.36 -
   53.37 -    public SourceVersion getSupportedSourceVersion() {
   53.38 -        return SourceVersion.latest();
   53.39 -    }
   53.40 -
   53.41 -    public void init(ProcessingEnvironment processingEnv) {
   53.42 -        super.init(processingEnv);
   53.43 -        eltUtils = processingEnv.getElementUtils();
   53.44 -        filer    = processingEnv.getFiler();
   53.45 -    }
   53.46  }
    54.1 --- a/test/tools/javac/processing/model/util/elements/TestGetPackageOf.java	Wed Sep 29 14:01:37 2010 -0700
    54.2 +++ b/test/tools/javac/processing/model/util/elements/TestGetPackageOf.java	Wed Sep 29 23:27:57 2010 -0700
    54.3 @@ -1,5 +1,5 @@
    54.4  /*
    54.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    54.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    54.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    54.8   *
    54.9   * This code is free software; you can redistribute it and/or modify it
   54.10 @@ -26,7 +26,8 @@
   54.11   * @bug 6453386
   54.12   * @summary Test Elements.getPackageOf
   54.13   * @author  Joseph D. Darcy
   54.14 - * @build TestGetPackageOf
   54.15 + * @library ../../../../lib
   54.16 + * @build   JavacTestingAbstractProcessor TestGetPackageOf
   54.17   * @compile -processor TestGetPackageOf -proc:only TestGetPackageOf.java
   54.18   */
   54.19  
   54.20 @@ -43,10 +44,7 @@
   54.21  /**
   54.22   * Test basic workings of Elements.getPackageOf
   54.23   */
   54.24 -@SupportedAnnotationTypes("*")
   54.25 -public class TestGetPackageOf extends AbstractProcessor {
   54.26 -    private Elements eltUtils;
   54.27 -
   54.28 +public class TestGetPackageOf extends JavacTestingAbstractProcessor {
   54.29      /**
   54.30       * Check expected behavior on classes and packages.
   54.31       */
   54.32 @@ -69,13 +67,4 @@
   54.33          }
   54.34          return true;
   54.35      }
   54.36 -
   54.37 -    public SourceVersion getSupportedSourceVersion() {
   54.38 -        return SourceVersion.latest();
   54.39 -    }
   54.40 -
   54.41 -    public void init(ProcessingEnvironment processingEnv) {
   54.42 -        super.init(processingEnv);
   54.43 -        eltUtils = processingEnv.getElementUtils();
   54.44 -    }
   54.45  }
    55.1 --- a/test/tools/javac/processing/model/util/filter/TestIterables.java	Wed Sep 29 14:01:37 2010 -0700
    55.2 +++ b/test/tools/javac/processing/model/util/filter/TestIterables.java	Wed Sep 29 23:27:57 2010 -0700
    55.3 @@ -1,5 +1,5 @@
    55.4  /*
    55.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    55.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    55.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    55.8   *
    55.9   * This code is free software; you can redistribute it and/or modify it
   55.10 @@ -26,6 +26,8 @@
   55.11   * @bug 6406164
   55.12   * @summary Test that ElementFilter iterable methods behave properly.
   55.13   * @author  Joseph D. Darcy
   55.14 + * @library ../../../../lib
   55.15 + * @build JavacTestingAbstractProcessor
   55.16   * @compile TestIterables.java
   55.17   * @compile -processor TestIterables -proc:only Foo1.java
   55.18   * @compile Foo1.java
   55.19 @@ -51,9 +53,8 @@
   55.20   * results.
   55.21   */
   55.22  @SupportedAnnotationTypes("ExpectedElementCounts")
   55.23 -@ExpectedElementCounts(methods=3)
   55.24 -public class TestIterables extends AbstractProcessor {
   55.25 -
   55.26 +@ExpectedElementCounts(methods=2)
   55.27 +public class TestIterables extends JavacTestingAbstractProcessor {
   55.28      public boolean process(Set<? extends TypeElement> annotations,
   55.29                             RoundEnvironment roundEnv) {
   55.30          if (!roundEnv.processingOver()) {
   55.31 @@ -118,10 +119,4 @@
   55.32  
   55.33          return count1;
   55.34      }
   55.35 -
   55.36 -    @Override
   55.37 -    public SourceVersion getSupportedSourceVersion() {
   55.38 -        return SourceVersion.latest();
   55.39 -    }
   55.40 -
   55.41  }
    56.1 --- a/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java	Wed Sep 29 14:01:37 2010 -0700
    56.2 +++ b/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java	Wed Sep 29 23:27:57 2010 -0700
    56.3 @@ -1,5 +1,5 @@
    56.4  /*
    56.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    56.6 + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    56.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    56.8   *
    56.9   * This code is free software; you can redistribute it and/or modify it
   56.10 @@ -50,7 +50,8 @@
   56.11  
   56.12  /**
   56.13   * This processor returns the supported source level as indicated by
   56.14 - * the "SourceLevel" option.
   56.15 + * the "SourceLevel" option; therefore, don't use
   56.16 + * JavacTestingAbstractProcessor which returns the latest source level.
   56.17   */
   56.18  @SupportedAnnotationTypes("*")
   56.19  @SupportedOptions("SourceVersion")
    57.1 --- a/test/tools/javac/processing/werror/WError1.java	Wed Sep 29 14:01:37 2010 -0700
    57.2 +++ b/test/tools/javac/processing/werror/WError1.java	Wed Sep 29 23:27:57 2010 -0700
    57.3 @@ -24,6 +24,8 @@
    57.4  /*
    57.5   * @test 6403456
    57.6   * @summary -Werror should work with annotation processing
    57.7 + * @library ../../lib
    57.8 + * @build   JavacTestingAbstractProcessor
    57.9   * @compile WError1.java
   57.10   * @compile -proc:only -processor WError1 WError1.java
   57.11   * @compile/fail/ref=WError1.out -XDrawDiagnostics -Werror -proc:only -processor WError1 WError1.java
   57.12 @@ -36,22 +38,15 @@
   57.13  import javax.lang.model.element.*;
   57.14  import javax.tools.*;
   57.15  
   57.16 -@SupportedAnnotationTypes("*")
   57.17 -public class WError1 extends AbstractProcessor {
   57.18 +public class WError1 extends JavacTestingAbstractProcessor {
   57.19      @Override
   57.20      public boolean process(Set<? extends TypeElement> annotations,
   57.21                             RoundEnvironment roundEnv) {
   57.22 -        Messager messager = processingEnv.getMessager();
   57.23          if (++round == 1) {
   57.24              messager.printMessage(Diagnostic.Kind.WARNING, "round 1");
   57.25          }
   57.26          return true;
   57.27      }
   57.28  
   57.29 -    @Override
   57.30 -    public SourceVersion getSupportedSourceVersion() {
   57.31 -        return SourceVersion.latest();
   57.32 -    }
   57.33 -
   57.34      int round = 0;
   57.35  }
    58.1 --- a/test/tools/javac/processing/werror/WErrorGen.java	Wed Sep 29 14:01:37 2010 -0700
    58.2 +++ b/test/tools/javac/processing/werror/WErrorGen.java	Wed Sep 29 23:27:57 2010 -0700
    58.3 @@ -24,6 +24,8 @@
    58.4  /*
    58.5   * @test 6403456
    58.6   * @summary -Werror should work with annotation processing
    58.7 + * @library ../../lib
    58.8 + * @build   JavacTestingAbstractProcessor
    58.9   * @compile WErrorGen.java
   58.10   * @compile -proc:only -processor WErrorGen WErrorGen.java
   58.11   * @compile/fail/ref=WErrorGen.out -XDrawDiagnostics -Werror -Xlint:rawtypes -processor WErrorGen WErrorGen.java
   58.12 @@ -36,12 +38,10 @@
   58.13  import javax.lang.model.element.*;
   58.14  import javax.tools.*;
   58.15  
   58.16 -@SupportedAnnotationTypes("*")
   58.17 -public class WErrorGen extends AbstractProcessor {
   58.18 +public class WErrorGen extends JavacTestingAbstractProcessor {
   58.19      @Override
   58.20      public boolean process(Set<? extends TypeElement> annotations,
   58.21                             RoundEnvironment roundEnv) {
   58.22 -        Filer filer = processingEnv.getFiler();
   58.23          if (++round == 1) {
   58.24              try {
   58.25                  JavaFileObject fo = filer.createSourceFile("Gen");
   58.26 @@ -54,10 +54,5 @@
   58.27          return true;
   58.28      }
   58.29  
   58.30 -    @Override
   58.31 -    public SourceVersion getSupportedSourceVersion() {
   58.32 -        return SourceVersion.latest();
   58.33 -    }
   58.34 -
   58.35      int round = 0;
   58.36  }
    59.1 --- a/test/tools/javac/processing/werror/WErrorLast.java	Wed Sep 29 14:01:37 2010 -0700
    59.2 +++ b/test/tools/javac/processing/werror/WErrorLast.java	Wed Sep 29 23:27:57 2010 -0700
    59.3 @@ -24,6 +24,8 @@
    59.4  /*
    59.5   * @test 6403456
    59.6   * @summary -Werror should work with annotation processing
    59.7 + * @library ../../lib
    59.8 + * @build   JavacTestingAbstractProcessor
    59.9   * @compile WErrorLast.java
   59.10   * @compile -proc:only -processor WErrorLast WErrorLast.java
   59.11   * @compile/fail/ref=WErrorLast.out -XDrawDiagnostics -Werror -proc:only -processor WErrorLast WErrorLast.java
   59.12 @@ -36,20 +38,13 @@
   59.13  import javax.lang.model.element.*;
   59.14  import javax.tools.*;
   59.15  
   59.16 -@SupportedAnnotationTypes("*")
   59.17 -public class WErrorLast extends AbstractProcessor {
   59.18 +public class WErrorLast extends JavacTestingAbstractProcessor {
   59.19      @Override
   59.20      public boolean process(Set<? extends TypeElement> annotations,
   59.21                             RoundEnvironment roundEnv) {
   59.22 -        Messager messager = processingEnv.getMessager();
   59.23          if (roundEnv.processingOver()) {
   59.24              messager.printMessage(Diagnostic.Kind.WARNING, "last round");
   59.25          }
   59.26          return true;
   59.27      }
   59.28 -
   59.29 -    @Override
   59.30 -    public SourceVersion getSupportedSourceVersion() {
   59.31 -        return SourceVersion.latest();
   59.32 -    }
   59.33  }

mercurial