2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2015-01-08 22:01:20 -08:00
|
|
|
* @test /nodynamiccopyright/
|
2007-12-01 00:00:00 +00:00
|
|
|
* @bug 6341173 6341072
|
|
|
|
* @summary Test presence of Messager methods
|
|
|
|
* @author Joseph D. Darcy
|
2012-12-21 08:45:43 -08:00
|
|
|
* @library /tools/javac/lib
|
2015-05-21 11:41:04 -07:00
|
|
|
* @modules java.compiler
|
|
|
|
* jdk.compiler
|
2010-09-29 23:27:57 -07:00
|
|
|
* @build JavacTestingAbstractProcessor
|
2007-12-01 00:00:00 +00:00
|
|
|
* @compile MessagerBasics.java
|
|
|
|
* @compile -processor MessagerBasics -proc:only MessagerBasics.java
|
2015-01-08 22:01:20 -08:00
|
|
|
* @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
|
2015-01-08 22:01:20 -08:00
|
|
|
* @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")
|
2010-09-29 23:27:57 -07:00
|
|
|
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"))
|
2010-09-29 23:27:57 -07:00
|
|
|
messager.printMessage(ERROR, "Does not compute");
|
2007-12-01 00:00:00 +00:00
|
|
|
else {
|
2010-09-29 23:27:57 -07:00
|
|
|
messager.printMessage(NOTE, "Post no bills");
|
|
|
|
messager.printMessage(WARNING, "Beware the ides of March!");
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|