test/tools/javac/api/6733837/T6733837.java

changeset 415
49359d0e6a9c
parent 100
37551dc0f591
child 554
9d9f26857129
equal deleted inserted replaced
414:e992e602788e 415:49359d0e6a9c
44 public static void main(String... args) { 44 public static void main(String... args) {
45 new T6733837().exec(); 45 new T6733837().exec();
46 } 46 }
47 47
48 public void exec() { 48 public void exec() {
49 JavaFileObject sfo = new SimpleJavaFileObject(URI.create(""),Kind.SOURCE) { 49 JavaFileObject sfo = new SimpleJavaFileObject(URI.create("myfo:/Test.java"),Kind.SOURCE) {
50 public CharSequence getCharContent(boolean ignoreEncodingErrors) { 50 public CharSequence getCharContent(boolean ignoreEncodingErrors) {
51 return "\tclass ErroneousWithTab"; 51 return "\tclass ErroneousWithTab";
52 }
53 @Override
54 public String getName() {
55 return "RELATIVEPATH";
56 } 52 }
57 }; 53 };
58 StringWriter sw = new StringWriter(); 54 StringWriter sw = new StringWriter();
59 PrintWriter out = new PrintWriter(sw); 55 PrintWriter out = new PrintWriter(sw);
60 List<? extends JavaFileObject> files = Arrays.asList(sfo); 56 List<? extends JavaFileObject> files = Arrays.asList(sfo);
64 } 60 }
65 catch (Throwable t) { 61 catch (Throwable t) {
66 throw new Error("Compiler threw an exception"); 62 throw new Error("Compiler threw an exception");
67 } 63 }
68 System.err.println(sw.toString()); 64 System.err.println(sw.toString());
69 if (sw.toString().contains("RELATIVEPATH")) 65 if (!sw.toString().contains("/Test.java"))
70 throw new Error("Bad source name in diagnostic"); 66 throw new Error("Bad source name in diagnostic");
71 } 67 }
72 } 68 }

mercurial