36 lines
1.4 KiB
Java
Raw Normal View History

2007-12-01 00:00:00 +00:00
/*
* @test /nodynamiccopyright/
2007-12-01 00:00:00 +00:00
* @bug 6341173 6341072
* @summary Test presence of Messager methods
* @author Joseph D. Darcy
* @library /tools/javac/lib
* @build JavacTestingAbstractProcessor
2007-12-01 00:00:00 +00:00
* @compile MessagerBasics.java
* @compile -processor MessagerBasics -proc:only MessagerBasics.java
* @compile/fail/ref=MessagerBasics.out -XDrawDiagnostics -processor MessagerBasics -proc:only -AfinalError MessagerBasics.java
2007-12-01 00:00:00 +00:00
* @compile -processor MessagerBasics MessagerBasics.java
* @compile/fail/ref=MessagerBasics.out -XDrawDiagnostics -processor MessagerBasics -AfinalError MessagerBasics.java
2007-12-01 00:00:00 +00:00
*/
import java.util.Set;
import javax.annotation.processing.*;
import javax.lang.model.element.*;
import javax.lang.model.util.*;
import static javax.tools.Diagnostic.Kind.*;
@SupportedOptions("finalError")
public class MessagerBasics extends JavacTestingAbstractProcessor {
2007-12-01 00:00:00 +00:00
public boolean process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) {
if (roundEnv.processingOver()) {
if (processingEnv.getOptions().containsKey("finalError"))
messager.printMessage(ERROR, "Does not compute");
2007-12-01 00:00:00 +00:00
else {
messager.printMessage(NOTE, "Post no bills");
messager.printMessage(WARNING, "Beware the ides of March!");
2007-12-01 00:00:00 +00:00
}
}
return true;
}
}