test/tools/javac/processing/werror/WError1.java

Print this page

        

*** 22,31 **** --- 22,33 ---- */ /* * @test 6403456 * @summary -Werror should work with annotation processing + * @library ../../lib + * @build JavacTestingAbstractProcessor * @compile WError1.java * @compile -proc:only -processor WError1 WError1.java * @compile/fail/ref=WError1.out -XDrawDiagnostics -Werror -proc:only -processor WError1 WError1.java */
*** 34,57 **** import javax.annotation.processing.*; import javax.lang.model.*; import javax.lang.model.element.*; import javax.tools.*; ! @SupportedAnnotationTypes("*") ! public class WError1 extends AbstractProcessor { @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { - Messager messager = processingEnv.getMessager(); if (++round == 1) { messager.printMessage(Diagnostic.Kind.WARNING, "round 1"); } return true; } - @Override - public SourceVersion getSupportedSourceVersion() { - return SourceVersion.latest(); - } - int round = 0; } --- 36,52 ---- import javax.annotation.processing.*; import javax.lang.model.*; import javax.lang.model.element.*; import javax.tools.*; ! public class WError1 extends JavacTestingAbstractProcessor { @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (++round == 1) { messager.printMessage(Diagnostic.Kind.WARNING, "round 1"); } return true; } int round = 0; }