import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
public class Compiler {
+ private static final boolean DEBUG = false;
// Static Entry Point /////////////////////////////////////////////////////
public void compile() {
List s = new ArrayList();
filterSources(s, sourcedir, new char[0][]);
- System.out.println("working with "+s.size() +" sources");
+ if (DEBUG) System.out.println("working with "+s.size() +" sources");
sources = new Source[s.size()]; s.toArray(sources);
ICompilationUnit[] units = new ICompilationUnit[s.size()];
for (int i=0; i < sources.length; i++) units[i] = sources[i].unit;
- System.out.println("compiling");
org.eclipse.jdt.internal.compiler.Compiler jdt =
new org.eclipse.jdt.internal.compiler.Compiler(
env, policy, settings, results, problems);
for (int i=0; i < ex.length; i++) ex[i] = name(exs[i]);
desc = descriptor(m.getParameterTypes(), m.getReturnType());
- /*if (new String(desc).indexOf("[") > -1)
- System.out.println("method: "+m+", desc="+new String(desc));*/ // DEBUG
}
public int getModifiers() { return m.getModifiers(); }
public char[] getSelector() { return m.getName().toCharArray(); }
final INameEnvironment env = new INameEnvironment() {
public NameEnvironmentAnswer findType(char[][] c) { return findType(name(c), pack(c)); }
public NameEnvironmentAnswer findType(char[] n, char[][] p) {
- boolean DEBUG = false;
if (DEBUG) System.out.println("requesting: "+ str(p, '.') + "."+new String(n));
try {
/** Used by compiler for processing compiled classes and their errors. */
private final ICompilerRequestor results = new ICompilerRequestor() {
public void acceptResult(CompilationResult result) {
- System.out.println("got result: "+result);
+ if (DEBUG) System.out.println("got result: "+result);
if (result.hasProblems()) {
boolean hasErrors = false;
IProblem[] p = result.getProblems();
File path = builddir;
char[][] name = c[i].getCompoundName();
path = new File(builddir, str(pack(name), '/'));
- System.out.println("DEBUG: creating path "+path+", out of builddir="+builddir);
+ if (DEBUG) System.out.println("DEBUG: creating path "+path+", out of builddir="+builddir);
if (!path.exists()) path.mkdirs();
// write new class file
path = new File(path, new String(name(name)) + ".class");
- System.out.println("DEBUG: writing file "+path);
+ if (DEBUG) System.out.println("DEBUG: writing file "+path);
OutputStream o = new BufferedOutputStream(
new FileOutputStream(path));
o.write(c[i].getBytes());