author | akulyakh |
Thu, 21 May 2015 11:41:04 -0700 | |
changeset 30730 | d3ce7619db2c |
parent 28335 | 0b37a4232e35 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
28335
0b37a4232e35
8058373: Group 10a: golden files for tests in tools/javac dir
sogoel
parents:
14963
diff
changeset
|
2 |
* @test /nodynamiccopyright/ |
10 | 3 |
* @bug 6403459 |
4 |
* @summary Test that generating programs with syntax errors is a fatal condition |
|
5 |
* @author Joseph D. Darcy |
|
14963
974d4423c999
8005282: Use @library tag with non-relative path for javac tests
darcy
parents:
6720
diff
changeset
|
6 |
* @library /tools/javac/lib |
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
28335
diff
changeset
|
7 |
* @modules java.compiler |
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
28335
diff
changeset
|
8 |
* jdk.compiler |
6720 | 9 |
* @build JavacTestingAbstractProcessor |
10 |
* @compile TestReturnCode.java |
|
10 | 11 |
* @compile TestFatalityOfParseErrors.java |
28335
0b37a4232e35
8058373: Group 10a: golden files for tests in tools/javac dir
sogoel
parents:
14963
diff
changeset
|
12 |
* @compile/fail/ref=TestFatalityOfParseErrors.out -XDrawDiagnostics -XprintRounds -processor TestFatalityOfParseErrors -proc:only TestFatalityOfParseErrors.java |
10 | 13 |
*/ |
14 |
||
15 |
import java.util.Set; |
|
16 |
import javax.annotation.processing.*; |
|
17 |
import javax.lang.model.SourceVersion; |
|
18 |
import static javax.lang.model.SourceVersion.*; |
|
19 |
import javax.lang.model.element.*; |
|
20 |
import javax.lang.model.util.*; |
|
21 |
import static javax.tools.Diagnostic.Kind.*; |
|
22 |
||
23 |
import java.io.PrintWriter; |
|
24 |
import java.io.IOException; |
|
25 |
||
26 |
/** |
|
27 |
* Write out an incomplete source file and observe that the next round |
|
28 |
* is marked as an error. |
|
29 |
*/ |
|
6720 | 30 |
public class TestFatalityOfParseErrors extends JavacTestingAbstractProcessor { |
10 | 31 |
|
32 |
public boolean process(Set<? extends TypeElement> annotations, |
|
33 |
RoundEnvironment roundEnvironment) { |
|
28335
0b37a4232e35
8058373: Group 10a: golden files for tests in tools/javac dir
sogoel
parents:
14963
diff
changeset
|
34 |
try (PrintWriter pw = new PrintWriter(filer.createSourceFile("SyntaxError").openWriter())) { |
0b37a4232e35
8058373: Group 10a: golden files for tests in tools/javac dir
sogoel
parents:
14963
diff
changeset
|
35 |
pw.println("class SyntaxError {"); |
10 | 36 |
} catch (IOException ioException) { |
37 |
} |
|
38 |
return true; |
|
39 |
} |
|
40 |
} |