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

changeset 0
959103a6100f
child 2525
2eb010b6cb22
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/processing/messager/6362067/T6362067.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,35 @@
     1.4 +/*
     1.5 + * @test  /nodynamiccopyright/
     1.6 + * @bug     6362067
     1.7 + * @summary Messager methods do not print out source position information
     1.8 + * @library /tools/javac/lib
     1.9 + * @build   JavacTestingAbstractProcessor T6362067
    1.10 + * @compile -processor T6362067 -proc:only T6362067.java
    1.11 + * @compile/ref=T6362067.out -XDrawDiagnostics -processor T6362067 -proc:only T6362067.java
    1.12 + */
    1.13 +import java.util.Set;
    1.14 +import javax.annotation.processing.*;
    1.15 +import javax.lang.model.element.*;
    1.16 +import static javax.tools.Diagnostic.Kind.*;
    1.17 +
    1.18 +@Deprecated // convenient test annotations
    1.19 +@SuppressWarnings({""})
    1.20 +public class T6362067 extends JavacTestingAbstractProcessor {
    1.21 +    public boolean process(Set<? extends TypeElement> annos,
    1.22 +                           RoundEnvironment roundEnv) {
    1.23 +
    1.24 +        for (Element e: roundEnv.getRootElements()) {
    1.25 +            messager.printMessage(NOTE, "note:elem", e);
    1.26 +            for (AnnotationMirror a: e.getAnnotationMirrors()) {
    1.27 +                messager.printMessage(NOTE, "note:anno", e, a);
    1.28 +                for (AnnotationValue v: a.getElementValues().values()) {
    1.29 +                    messager.printMessage(NOTE, "note:value", e, a, v);
    1.30 +                }
    1.31 +            }
    1.32 +        }
    1.33 +
    1.34 +        if (roundEnv.processingOver())
    1.35 +            messager.printMessage(NOTE, "note:nopos");
    1.36 +        return true;
    1.37 +    }
    1.38 +}

mercurial