test/tools/javac/T6873845.java

changeset 1521
71f35e4b93a5
parent 377
d9febdd5ae21
child 2525
2eb010b6cb22
equal deleted inserted replaced
1520:5c956be64b9e 1521:71f35e4b93a5
17 public void run() throws Exception { 17 public void run() throws Exception {
18 String out = compile(Arrays.asList("-XDrawDiagnostics", "-X")); 18 String out = compile(Arrays.asList("-XDrawDiagnostics", "-X"));
19 if (out.contains("sunapi")) 19 if (out.contains("sunapi"))
20 throw new Exception("unexpected output for -X"); 20 throw new Exception("unexpected output for -X");
21 21
22 String warn1 = "T6873845.java:72:9: compiler.warn.sun.proprietary: sun.misc.Unsafe" + newline; 22 String warn1 = "T6873845.java:73:9: compiler.warn.sun.proprietary: sun.misc.Unsafe" + newline;
23 String warn2 = "T6873845.java:77:9: compiler.warn.sun.proprietary: sun.misc.Unsafe" + newline; 23 String warn2 = "T6873845.java:78:9: compiler.warn.sun.proprietary: sun.misc.Unsafe" + newline;
24 String note1 = "- compiler.note.sunapi.filename: T6873845.java" + newline; 24 String note1 = "- compiler.note.sunapi.filename: T6873845.java" + newline;
25 String note2 = "- compiler.note.sunapi.recompile" + newline; 25 String note2 = "- compiler.note.sunapi.recompile" + newline;
26 26
27 test(opts(), 27 test(opts(),
28 warn1 + warn2 + "2 warnings" + newline); 28 warn1 + warn2 + "2 warnings" + newline);
50 args.add(new File(testSrc, "T6873845.java").getPath()); 50 args.add(new File(testSrc, "T6873845.java").getPath());
51 compile(args); // to verify resource strings exist 51 compile(args); // to verify resource strings exist
52 args.add(0, "-XDrawDiagnostics"); 52 args.add(0, "-XDrawDiagnostics");
53 String out = compile(args); 53 String out = compile(args);
54 if (!out.equals(expect)) 54 if (!out.equals(expect))
55 throw new Exception("unexpected output from compiler"); 55 throw new Exception("unexpected output from compiler; expected: " + expect +
56 "\n found: " + out);
56 } 57 }
57 58
58 String compile(List<String> args) throws Exception{ 59 String compile(List<String> args) throws Exception{
59 StringWriter sw = new StringWriter(); 60 StringWriter sw = new StringWriter();
60 PrintWriter pw = new PrintWriter(sw); 61 PrintWriter pw = new PrintWriter(sw);

mercurial