unit.scope.faultInTypes(); unit.scope.verifyMethods(lookupEnvironment.methodVerifier());
private Binding findSingleImport(char[][] compoundName, int mask, boolean findStaticImports) { if (compoundName.length == 1) { // findType records the reference // the name cannot be a package if (compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) return new ProblemReferenceBinding(compoundName, null, ProblemReasons.NotFound); ReferenceBinding typeBinding = findType(compoundName[0], this.environment.defaultPackage, this.fPackage); if (typeBinding == null) return new ProblemReferenceBinding(compoundName, null, ProblemReasons.NotFound); return typeBinding; } if (findStaticImports) return findSingleStaticImport(compoundName, mask); return findImport(compoundName, compoundName.length); } private Binding findSingleStaticImport(char[][] compoundName, int mask) {
public void buildTypeBindings(CompilationUnitDeclaration unit, AccessRestriction accessRestriction) { CompilationUnitScope scope = new CompilationUnitScope(unit, this); scope.buildTypeBindings(accessRestriction); int unitsLength = this.units.length; if (++this.lastUnitIndex >= unitsLength) System.arraycopy(this.units, 0, this.units = new CompilationUnitDeclaration[2 * unitsLength], 0, unitsLength); this.units[this.lastUnitIndex] = unit; }
public void completeTypeBindings(CompilationUnitDeclaration parsedUnit, boolean buildFieldsAndMethods) { if (parsedUnit.scope == null) return; // parsing errors were too severe (this.unitBeingCompleted = parsedUnit).scope.checkAndSetImports(); parsedUnit.scope.connectTypeHierarchy(); parsedUnit.scope.checkParameterizedTypes(); if (buildFieldsAndMethods) parsedUnit.scope.buildFieldsAndMethods(); this.unitBeingCompleted = null; }
public Binding findImport(char[][] compoundName, boolean findStaticImports, boolean onDemand) { if(onDemand) { return findImport(compoundName, compoundName.length); } else { return findSingleImport(compoundName, Binding.TYPE | Binding.FIELD | Binding.METHOD, findStaticImports); } } private Binding findImport(char[][] compoundName, int length) {
@Override public void process(CompilationUnitDeclaration unit, int unitNumber) { mCurrentUnit = lookupEnvironment.unitBeingCompleted = unit; parser.getMethodBodies(unit); if (unit.scope != null) { unit.scope.faultInTypes(); unit.scope.verifyMethods(lookupEnvironment.methodVerifier()); } unit.resolve(); unit.analyseCode(); // This is where we differ from super: DON'T call generateCode(). // Sadly we can't just set ignoreMethodBodies=true to have the same effect, // since that would also skip the analyseCode call, which we DO, want: // unit.generateCode(); if (options.produceReferenceInfo && unit.scope != null) { unit.scope.storeDependencyInfo(); } unit.finalizeProblems(); unit.compilationResult.totalUnitsKnown = totalUnits; lookupEnvironment.unitBeingCompleted = null; }
public void completeTypeBindings(CompilationUnitDeclaration parsedUnit) { if (this.stepCompleted == BUILD_FIELDS_AND_METHODS) { // This can only happen because the original set of units are completely built and // are now being processed, so we want to treat all the additional units as a group // until they too are completely processed. completeTypeBindings(); } else { if (parsedUnit.scope == null) return; // parsing errors were too severe if (this.stepCompleted >= CHECK_AND_SET_IMPORTS) (this.unitBeingCompleted = parsedUnit).scope.checkAndSetImports(); if (this.stepCompleted >= CONNECT_TYPE_HIERARCHY) (this.unitBeingCompleted = parsedUnit).scope.connectTypeHierarchy(); this.unitBeingCompleted = null; } }
protected CompilationUnitDeclaration buildBindings(ICompilationUnit compilationUnit, boolean isTopLevelOrMember) throws JavaModelException { // source unit org.eclipse.jdt.internal.compiler.env.ICompilationUnit sourceUnit = (org.eclipse.jdt.internal.compiler.env.ICompilationUnit) compilationUnit; CompilationResult compilationResult = new CompilationResult(sourceUnit, 1, 1, 0); CompilationUnitDeclaration unit = isTopLevelOrMember ? this.locator.basicParser().dietParse(sourceUnit, compilationResult) : this.locator.basicParser().parse(sourceUnit, compilationResult); if (unit != null) { this.locator.lookupEnvironment.buildTypeBindings(unit, null /*no access restriction*/); this.locator.lookupEnvironment.completeTypeBindings(unit, !isTopLevelOrMember); if (!isTopLevelOrMember) { if (unit.scope != null) unit.scope.faultInTypes(); // fault in fields & methods unit.resolve(); } } return unit; } public char[][][] collect() throws JavaModelException {
/** * Perform deferred check specific to parameterized types: bound checks, supertype collisions */ void checkParameterizedTypes() { if (compilerOptions().sourceLevel < ClassFileConstants.JDK1_5) return; for (int i = 0, length = this.topLevelTypes.length; i < length; i++) { ClassScope scope = this.topLevelTypes[i].scope; scope.checkParameterizedTypeBounds(); scope.checkParameterizedSuperTypeCollisions(); } } /*
DefaultBindingResolver(LookupEnvironment lookupEnvironment, WorkingCopyOwner workingCopyOwner, BindingTables bindingTables, boolean isRecoveringBindings, boolean fromJavaProject) { this.newAstToOldAst = new HashMap(); this.astNodesToBlockScope = new HashMap(); this.bindingsToAstNodes = new HashMap(); this.bindingTables = bindingTables; this.scope = new CompilationUnitScope(new CompilationUnitDeclaration(null, null, -1), lookupEnvironment); this.workingCopyOwner = workingCopyOwner; this.isRecoveringBindings = isRecoveringBindings; this.fromJavaProject = fromJavaProject; }
Binding someBinding = cuDeclaration.scope.findImport(chars, false, false); if (someBinding != null && someBinding.isValidBinding() && someBinding instanceof PackageBinding) { packageBinding = (PackageBinding) someBinding;
public void completeTypeBindings(CompilationUnitDeclaration parsedUnit, boolean buildFieldsAndMethods) { if (parsedUnit.scope == null) return; // parsing errors were too severe (this.unitBeingCompleted = parsedUnit).scope.checkAndSetImports(); parsedUnit.scope.connectTypeHierarchy(); parsedUnit.scope.checkParameterizedTypes(); if (buildFieldsAndMethods) parsedUnit.scope.buildFieldsAndMethods(); this.unitBeingCompleted = null; }
unit.scope.faultInTypes(); unit.scope.verifyMethods(this.lookupEnvironment.methodVerifier()); unit.scope.storeDependencyInfo();
public final Binding getImport(char[][] compoundName, boolean onDemand, boolean isStaticImport) { if (onDemand) return findImport(compoundName, compoundName.length); return findSingleImport(compoundName, Binding.TYPE | Binding.FIELD | Binding.METHOD, isStaticImport); }
public void completeTypeBindings(CompilationUnitDeclaration parsedUnit) { if (this.stepCompleted == BUILD_FIELDS_AND_METHODS) { // This can only happen because the original set of units are completely built and // are now being processed, so we want to treat all the additional units as a group // until they too are completely processed. completeTypeBindings(); } else { if (parsedUnit.scope == null) return; // parsing errors were too severe if (this.stepCompleted >= CHECK_AND_SET_IMPORTS) (this.unitBeingCompleted = parsedUnit).scope.checkAndSetImports(); if (this.stepCompleted >= CONNECT_TYPE_HIERARCHY) (this.unitBeingCompleted = parsedUnit).scope.connectTypeHierarchy(); this.unitBeingCompleted = null; } }
private boolean checkForCNF(TypeReference ref, CompilationUnitDeclaration parsedUnit, boolean showAll) { this.lookupEnvironment.buildTypeBindings(parsedUnit, null); this.lookupEnvironment.completeTypeBindings(parsedUnit, true); parsedUnit.resolve(); if ((this.unitScope = parsedUnit.scope) != null) { if (showAll) { char[][] tokens = ref.getTypeName(); char[] typeName = CharOperation.concatWithAll(tokens, '.'); if (typeName.length == 0) { buildContext(ref, null, parsedUnit, null, null); this.completionToken = new char[] {'*'}; findTypesAndPackages(this.completionToken, this.unitScope, true, true, new ObjectVector()); return true; } } parsedUnit.scope.faultInTypes(); } return false; // should not come here - will throw exception }
/** * Perform deferred check specific to parameterized types: bound checks, supertype collisions */ void checkParameterizedTypes() { if (compilerOptions().sourceLevel < ClassFileConstants.JDK1_5) return; for (int i = 0, length = this.topLevelTypes.length; i < length; i++) { ClassScope scope = this.topLevelTypes[i].scope; scope.checkParameterizedTypeBounds(); scope.checkParameterizedSuperTypeCollisions(); } } /*
DefaultBindingResolver(LookupEnvironment lookupEnvironment, WorkingCopyOwner workingCopyOwner, BindingTables bindingTables, boolean isRecoveringBindings, boolean fromJavaProject) { this.newAstToOldAst = new HashMap(); this.astNodesToBlockScope = new HashMap(); this.bindingsToAstNodes = new HashMap(); this.bindingTables = bindingTables; this.scope = new CompilationUnitScope(new CompilationUnitDeclaration(null, null, -1), lookupEnvironment); this.workingCopyOwner = workingCopyOwner; this.isRecoveringBindings = isRecoveringBindings; this.fromJavaProject = fromJavaProject; }
public void completeTypeBindings(CompilationUnitDeclaration parsedUnit, boolean buildFieldsAndMethods) { if (parsedUnit.scope == null) return; // parsing errors were too severe LookupEnvironment rootEnv = this.root; (rootEnv.unitBeingCompleted = parsedUnit).scope.checkAndSetImports(); parsedUnit.scope.connectTypeHierarchy(); parsedUnit.scope.checkParameterizedTypes(); if (buildFieldsAndMethods) parsedUnit.scope.buildFieldsAndMethods(); rootEnv.unitBeingCompleted = null; }
unit.scope.faultInTypes(); unit.scope.verifyMethods(this.lookupEnvironment.methodVerifier()); unit.scope.storeDependencyInfo();