No output from JavacTool when trying to compile a file without .java extension
Please see the following test case:
<code>
import java.io.*;
import javax.tools.*;
public class Test7 {
public static void test(String... args) {
JavacTool javac = com.sun.tools.javac.Tool.create();
DiagnosticListener dl = new DiagnosticListener() {
public void problemFound(DiagnosticMessage message) {
System.out.println(new File(message.getSourceName().toString()).getName()+":"+
message.getStartPosition()+":"+message.getStartPosition()
+":"+message.getPosition());
System.out.println(message.toString());
System.out.format("Found problem: %s%n", message.getKey());
System.out.flush();
}
};
PrintWriter writer = new PrintWriter(new OutputStream(){
public void write(int b) {}
});
javac.run((InputLocator)null, null, dl, writer, args);
}
public static void main(String... arg){
Test3 test = new Test3();
test.test("/home/sa151881/javatrails/SWarnings/unchecked/noExtFile");
test.test("/home/sa151881/javatrails/SWarnings/unchecked/test.html");
}
}
</code>
Output of the code:
<output>
bash-2.05b$ $b/java Test7
bash-2.05b$
</output>
###@###.### 2005-04-22 05:43:36 GMT