// walks the source units
this.requestedSources = new HashtableOfObject();
for (int i = 0; i < sourceLength; i++) {
org.eclipse.jdt.internal.compiler.env.ICompilationUnit sourceUnit = sourceUnits[i];
CompilationUnitDeclaration parsedUnit;
CompilationResult unitResult =
new CompilationResult(sourceUnit, index++, maxUnits, this.options.maxProblemsPerUnit);
try {
if (this.options.verbose) {
this.out.println(
Messages.bind(Messages.compilation_request,
new String[] {
String.valueOf(index++ + 1),
String.valueOf(maxUnits),
new String(sourceUnit.getFileName())
}));
}
// diet parsing for large collection of units
if (this.totalUnits < this.parseThreshold) {
parsedUnit = this.parser.parse(sourceUnit, unitResult);
} else {
parsedUnit = this.parser.dietParse(sourceUnit, unitResult);
}
// initial type binding creation
this.lookupEnvironment.buildTypeBindings(parsedUnit, null /*no access restriction*/);
addCompilationUnit(sourceUnit, parsedUnit);
this.requestedSources.put(unitResult.getFileName(), sourceUnit);
worked(1);
} finally {
sourceUnits[i] = null; // no longer hold onto the unit
}
}
// walk the binding keys
this.requestedKeys = new HashtableOfObject();
for (int i = 0; i < keyLength; i++) {
BindingKeyResolver resolver = new BindingKeyResolver(bindingKeys[i], this, this.lookupEnvironment);
resolver.parse(true/*pause after fully qualified name*/);
// If it doesn't have a type name, then it is either an array type, package or base type, which will definitely not have a compilation unit.
// Skipping it will speed up performance because the call will open jars. (theodora)
CompilationUnitDeclaration parsedUnit = resolver.hasTypeName() ? resolver.getCompilationUnitDeclaration() : null;
if (parsedUnit != null) {
char[] fileName = parsedUnit.compilationResult.getFileName();
Object existing = this.requestedKeys.get(fileName);
if (existing == null)
this.requestedKeys.put(fileName, resolver);