try {
// Parse all source files.
while (sourceFilesIterator.hasNext()) {
File sourceFile = (File) sourceFilesIterator.next();
UnitCompiler uc = new UnitCompiler(this.parseCompilationUnit(
sourceFile, // sourceFile
this.optionalCharacterEncoding // optionalCharacterEncoding
), this.iClassLoader);
this.parsedCompilationUnits.add(uc);
++sourceFileCount;
}
} finally {
this.benchmark.endReporting("Parsed " + sourceFileCount + " source file(s)");
}
// Traverse the parsed compilation units.
this.benchmark.beginReporting();
try {
for (Iterator it = this.parsedCompilationUnits.iterator(); it.hasNext();) {
final UnitCompiler uc = (UnitCompiler) it.next();
this.benchmark.beginReporting("Grepping \"" + uc.compilationUnit.optionalFileName + "\"");
class UCE extends RuntimeException {
final CompileException ce;
UCE(CompileException ce) { this.ce = ce; }
}
try {
new Traverser() {
// "method(...)", "x.method(...)"
public void traverseMethodInvocation(Java.MethodInvocation mi) {
try {
this.match(mi, uc.findIMethod(mi));
} catch (CompileException ex) {
throw new UCE(ex);
}
super.traverseMethodInvocation(mi);
}
// "super.method(...)"
public void traverseSuperclassMethodInvocation(Java.SuperclassMethodInvocation scmi) {
try {
this.match(scmi, uc.findIMethod(scmi));
} catch (CompileException ex) {
throw new UCE(ex);
}
super.traverseSuperclassMethodInvocation(scmi);
}