< prev index next >
test/tools/javac/processing/StopAfterError/StopAfterError.java
Print this page
*** 25,35 ****
* @test
* @bug 8073844
* @summary If an error is produced by an annotation processor, the code should not be Attred, \
* unless requested
* @modules jdk.compiler
! * @compile StopAfterError.java
* @compile/fail/ref=StopAfterError.out -XDrawDiagnostics -processor StopAfterError StopAfterErrorAux.java
* @compile/fail/ref=StopAfterError.out -XDshould-stop.ifError=PROCESS -XDrawDiagnostics -processor StopAfterError StopAfterErrorAux.java
* @compile/fail/ref=StopAfterErrorContinue.out -XDshould-stop.ifError=ATTR -XDrawDiagnostics -processor StopAfterError StopAfterErrorAux.java
*/
--- 25,36 ----
* @test
* @bug 8073844
* @summary If an error is produced by an annotation processor, the code should not be Attred, \
* unless requested
* @modules jdk.compiler
! * @library /tools/javac/lib
! * @build StopAfterError JavacTestingAbstractProcessor
* @compile/fail/ref=StopAfterError.out -XDrawDiagnostics -processor StopAfterError StopAfterErrorAux.java
* @compile/fail/ref=StopAfterError.out -XDshould-stop.ifError=PROCESS -XDrawDiagnostics -processor StopAfterError StopAfterErrorAux.java
* @compile/fail/ref=StopAfterErrorContinue.out -XDshould-stop.ifError=ATTR -XDrawDiagnostics -processor StopAfterError StopAfterErrorAux.java
*/
*** 40,61 ****
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.TypeElement;
import javax.tools.Diagnostic.Kind;
! @SupportedAnnotationTypes("*")
! public class StopAfterError extends AbstractProcessor {
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (roundEnv.processingOver()) {
processingEnv.getMessager().printMessage(Kind.ERROR, "Stop!");
}
return false;
}
-
- @Override
- public SourceVersion getSupportedSourceVersion() {
- return SourceVersion.latestSupported();
- }
-
}
--- 41,55 ----
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.TypeElement;
import javax.tools.Diagnostic.Kind;
! public class StopAfterError extends JavacTestingAbstractProcessor {
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (roundEnv.processingOver()) {
processingEnv.getMessager().printMessage(Kind.ERROR, "Stop!");
}
return false;
}
}
< prev index next >