private Source[] sources;
private File builddir = new File(".");
- private File sourcedir = new File(".");
+ private String sourcedir = null;
public Compiler() {
List defs = Collections.EMPTY_LIST;
public void setBuildDir(String dir) { builddir = new File(dir == null ? "." : dir); }
- public void setSourceDir(String dir) { sourcedir = new File(dir == null ? "." : dir); }
+ public void setSourceDir(String dir) { sourcedir = dir; }
/** Pass CompilerOptions.VERSION_1_*. A String of form "1.1", ".2", etc. */
public void setSource(String v) { settings.put(CompilerOptions.OPTION_Source, v); }
public void compile() {
List s = new ArrayList();
- filterSources(s, sourcedir, new char[0][]);
+ filterSources(s, new File(sourcedir), new char[0][]);
if (DEBUG) System.out.println("working with "+s.size() +" sources");
sources = new Source[s.size()]; s.toArray(sources);
ICompilationUnit[] units = new ICompilationUnit[s.size()];
private Source(File o, char[] n, char[][] p) {
orig = o; this.n = n; this.p = p;
- try { fileName = orig.getCanonicalPath().toCharArray(); } // FIXME: dont use full path
- catch (IOException e) { fileName = orig.getName().toCharArray(); }
+ String file = sourcedir;
+ file += File.separatorChar + str(p, File.separatorChar);
+ file += File.separatorChar + new String(n) + ".java";
+ fileName = file.toCharArray();
}
}
for (int i=0; i < nested.length; i++)
nested[i] = new LoadedNestedType(classes[i]);
- Constructor[] constructors = c.getConstructors();
+ Constructor[] constructors = c.getDeclaredConstructors();
Method[] methods = c.getDeclaredMethods();
if (methods.length + constructors.length > 0) {
meth = new IBinaryMethod[methods.length + constructors.length];
boolean hasErrors = false;
IProblem[] p = result.getProblems();
for (int i=0; i < p.length; i++) {
- if (p[i].isError()) hasErrors = true;
out.print(p[i].getOriginatingFileName());
out.print(':');
out.print(p[i].getSourceLineNumber());
out.print(':');
+ if (p[i].isError()) { out.print(" error: "); hasErrors = true; }
+ else out.print(" warning: ");
out.println(p[i].getMessage());
}
out.flush();