test/tools/javac/processing/messager/6362067/T6362067.java

Print this page


   1 /*
   2  * @test  /nodynamiccopyright/
   3  * @bug     6362067
   4  * @summary Messager methods do not print out source position information


   5  * @build   T6362067
   6  * @compile -processor T6362067 -proc:only T6362067.java
   7  * @compile/ref=T6362067.out -XDrawDiagnostics -processor T6362067 -proc:only T6362067.java
   8  */
   9 
  10 import java.util.Set;
  11 import javax.annotation.processing.*;
  12 import javax.lang.model.element.*;
  13 import static javax.tools.Diagnostic.Kind.*;
  14 
  15 @Deprecated // convenient test annotation
  16 @SupportedAnnotationTypes("*")
  17 public class T6362067 extends AbstractProcessor {
  18     public boolean process(Set<? extends TypeElement> annos,
  19                            RoundEnvironment roundEnv) {
  20         Messager msgr = processingEnv.getMessager();
  21         for (Element e: roundEnv.getRootElements()) {
  22             msgr.printMessage(NOTE, "note:elem", e);
  23             for (AnnotationMirror a: e.getAnnotationMirrors()) {
  24                 msgr.printMessage(NOTE, "note:anno", e, a);
  25                 for (AnnotationValue v: a.getElementValues().values()) {
  26                     msgr.printMessage(NOTE, "note:value", e, a, v);
  27                 }
  28 
  29             }
  30         }
  31         if (roundEnv.processingOver())
  32             msgr.printMessage(NOTE, "note:nopos");
  33         return true;
  34     }
  35 
  36     @Override
  37     public javax.lang.model.SourceVersion getSupportedSourceVersion() {
  38         return javax.lang.model.SourceVersion.latest();
  39     }
  40 }
   1 /*
   2  * @test  /nodynamiccopyright/
   3  * @bug     6362067
   4  * @summary Messager methods do not print out source position information
   5  * @library ../../../lib
   6  * @build   JavacTestingAbstractProcessor
   7  * @build   T6362067
   8  * @compile -processor T6362067 -proc:only T6362067.java
   9  * @compile/ref=T6362067.out -XDrawDiagnostics -processor T6362067 -proc:only T6362067.java
  10  */

  11 import java.util.Set;
  12 import javax.annotation.processing.*;
  13 import javax.lang.model.element.*;
  14 import static javax.tools.Diagnostic.Kind.*;
  15 @Deprecated // convenient test annotations
  16 @SuppressWarnings({""})
  17 public class T6362067 extends JavacTestingAbstractProcessor {

  18     public boolean process(Set<? extends TypeElement> annos,
  19                            RoundEnvironment roundEnv) {

  20         for (Element e: roundEnv.getRootElements()) {
  21             messager.printMessage(NOTE, "note:elem", e);
  22             for (AnnotationMirror a: e.getAnnotationMirrors()) {
  23                 messager.printMessage(NOTE, "note:anno", e, a);
  24                 for (AnnotationValue v: a.getElementValues().values()) {
  25                     messager.printMessage(NOTE, "note:value", e, a, v);
  26                 }
  27 
  28             }
  29         }
  30         if (roundEnv.processingOver())
  31             messager.printMessage(NOTE, "note:nopos");
  32         return true;
  33     }





  34 }