List of usage examples for org.eclipse.jdt.internal.core.util BindingKeyResolver compoundName
null compoundName
To view the source code for org.eclipse.jdt.internal.core.util BindingKeyResolver compoundName.
Click Source Link
From source file:org.eclipse.jdt.core.dom.CompilationUnitResolver.java
License:Open Source License
/** * Add the initial set of compilation units into the loop * -> build compilation unit declarations, their bindings and record their results. */// ww w . j ava 2 s . co m protected void beginToCompile(org.eclipse.jdt.internal.compiler.env.ICompilationUnit[] sourceUnits, String[] bindingKeys) { int sourceLength = sourceUnits.length; int keyLength = bindingKeys.length; int maxUnits = sourceLength + keyLength; this.totalUnits = 0; this.unitsToProcess = new CompilationUnitDeclaration[maxUnits]; int index = 0; // 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); else if (existing instanceof ArrayList) ((ArrayList) existing).add(resolver); else { ArrayList list = new ArrayList(); list.add(existing); list.add(resolver); this.requestedKeys.put(fileName, list); } } else { char[] key = resolver.hasTypeName() ? resolver.getKey().toCharArray() // binary binding : CharOperation.concatWith(resolver.compoundName(), '.'); // package binding or base type binding this.requestedKeys.put(key, resolver); } worked(1); } // binding resolution this.lookupEnvironment.completeTypeBindings(); }