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 6403459
|
|
|
|
* @summary Test that generating programs with syntax errors is a fatal condition
|
|
|
|
* @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
|
|
|
|
* @compile TestReturnCode.java
|
2007-12-01 00:00:00 +00:00
|
|
|
* @compile TestFatalityOfParseErrors.java
|
2015-01-08 22:01:20 -08:00
|
|
|
* @compile/fail/ref=TestFatalityOfParseErrors.out -XDrawDiagnostics -XprintRounds -processor TestFatalityOfParseErrors -proc:only TestFatalityOfParseErrors.java
|
2007-12-01 00:00:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
import java.util.Set;
|
|
|
|
import javax.annotation.processing.*;
|
|
|
|
import javax.lang.model.SourceVersion;
|
|
|
|
import static javax.lang.model.SourceVersion.*;
|
|
|
|
import javax.lang.model.element.*;
|
|
|
|
import javax.lang.model.util.*;
|
|
|
|
import static javax.tools.Diagnostic.Kind.*;
|
|
|
|
|
|
|
|
import java.io.PrintWriter;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Write out an incomplete source file and observe that the next round
|
|
|
|
* is marked as an error.
|
|
|
|
*/
|
2010-09-29 23:27:57 -07:00
|
|
|
public class TestFatalityOfParseErrors extends JavacTestingAbstractProcessor {
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
public boolean process(Set<? extends TypeElement> annotations,
|
|
|
|
RoundEnvironment roundEnvironment) {
|
2015-01-08 22:01:20 -08:00
|
|
|
try (PrintWriter pw = new PrintWriter(filer.createSourceFile("SyntaxError").openWriter())) {
|
|
|
|
pw.println("class SyntaxError {");
|
2007-12-01 00:00:00 +00:00
|
|
|
} catch (IOException ioException) {
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|