langtools/test/tools/javac/processing/messager/6362067/T6362067.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 10 06bc494ca11e
child 6150 d055fa8ced62
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
 * @test  /nodynamiccopyright/
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * @bug     6362067
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 * @summary Messager methods do not print out source position information
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * @build   T6362067
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * @compile -processor T6362067 -proc:only T6362067.java
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * @compile/ref=T6362067.out -XDstdout -XDrawDiagnostics -processor T6362067 -proc:only T6362067.java
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
import java.util.Set;
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
import javax.annotation.processing.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
import javax.lang.model.element.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
import static javax.tools.Diagnostic.Kind.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
@Deprecated // convenient test annotation
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
@SupportedAnnotationTypes("*")
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
public class T6362067 extends AbstractProcessor {
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
    public boolean process(Set<? extends TypeElement> annos,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
                           RoundEnvironment roundEnv) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
        Messager msgr = processingEnv.getMessager();
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
        for (Element e: roundEnv.getRootElements()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
            msgr.printMessage(NOTE, "note:elem", e);
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
            for (AnnotationMirror a: e.getAnnotationMirrors()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
                msgr.printMessage(NOTE, "note:anno", e, a);
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
                for (AnnotationValue v: a.getElementValues().values()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
                    msgr.printMessage(NOTE, "note:value", e, a, v);
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
        if (roundEnv.processingOver())
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
            msgr.printMessage(NOTE, "note:nopos");
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
        return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
    @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
    public javax.lang.model.SourceVersion getSupportedSourceVersion() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
        return javax.lang.model.SourceVersion.latest();
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
}