org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope Java Examples
The following examples show how to use
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Extractor.java From javaide with GNU General Public License v3.0 | 6 votes |
@Override public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope) { Annotation[] annotations = typeDeclaration.annotations; if (hasRelevantAnnotations(annotations)) { SourceTypeBinding binding = typeDeclaration.binding; if (binding == null) { return true; } String fqn = new String(typeDeclaration.binding.readableName()); Item item = ClassItem.create(fqn, ClassKind.forType(typeDeclaration)); addItem(fqn, item); addAnnotations(annotations, item); } return true; }
Example #2
Source File: FunctionalExpression.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public int recordFunctionalType(Scope scope) { while (scope != null) { switch (scope.kind) { case Scope.METHOD_SCOPE : ReferenceContext context = ((MethodScope) scope).referenceContext; if (context instanceof LambdaExpression) { LambdaExpression expression = (LambdaExpression) context; if (expression != expression.original) // fake universe. return 0; } break; case Scope.COMPILATION_UNIT_SCOPE : CompilationUnitDeclaration unit = ((CompilationUnitScope) scope).referenceContext; return unit.record(this); } scope = scope.parent; } return 0; // not reached. }
Example #3
Source File: RecoveredTypeBinding.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public IPackageBinding getPackage() { if (this.binding != null) { switch (this.binding.kind()) { case Binding.BASE_TYPE : case Binding.ARRAY_TYPE : case Binding.TYPE_PARAMETER : // includes capture scenario case Binding.WILDCARD_TYPE : case Binding.INTERSECTION_TYPE: return null; } IPackageBinding packageBinding = this.resolver.getPackageBinding(this.binding.getPackage()); if (packageBinding != null) return packageBinding; } if (this.innerTypeBinding != null && this.dimensions > 0) { return null; } CompilationUnitScope scope = this.resolver.scope(); if (scope != null) { return this.resolver.getPackageBinding(scope.getCurrentPackage()); } return null; }
Example #4
Source File: PatchExtensionMethod.java From EasyMPermission with MIT License | 6 votes |
private static List<MethodBinding> getApplicableExtensionMethodsDefinedInProvider(EclipseNode typeNode, ReferenceBinding extensionMethodProviderBinding, TypeBinding receiverType) { List<MethodBinding> extensionMethods = new ArrayList<MethodBinding>(); CompilationUnitScope cuScope = ((CompilationUnitDeclaration) typeNode.top().get()).scope; for (MethodBinding method : extensionMethodProviderBinding.methods()) { if (!method.isStatic()) continue; if (!method.isPublic()) continue; if (method.parameters == null || method.parameters.length == 0) continue; TypeBinding firstArgType = method.parameters[0]; if (receiverType.isProvablyDistinct(firstArgType) && !receiverType.isCompatibleWith(firstArgType.erasure())) continue; TypeBinding[] argumentTypes = Arrays.copyOfRange(method.parameters, 1, method.parameters.length); if ((receiverType instanceof ReferenceBinding) && ((ReferenceBinding) receiverType).getExactMethod(method.selector, argumentTypes, cuScope) != null) continue; extensionMethods.add(method); } return extensionMethods; }
Example #5
Source File: AnnotationDiscoveryVisitor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope) { SourceTypeBinding binding = typeDeclaration.binding; if (binding == null) { return false; } Annotation[] annotations = typeDeclaration.annotations; if (annotations != null) { this.resolveAnnotations( typeDeclaration.staticInitializerScope, annotations, binding); } return true; }
Example #6
Source File: NodeSearcher.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public boolean visit( TypeDeclaration typeDeclaration, CompilationUnitScope scope) { if (typeDeclaration.declarationSourceStart <= this.position && this.position <= typeDeclaration.declarationSourceEnd) { this.enclosingType = typeDeclaration; return true; } return false; }
Example #7
Source File: DefaultBindingResolver.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Constructor for DefaultBindingResolver. */ DefaultBindingResolver(CompilationUnitScope scope, 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 = scope; this.workingCopyOwner = workingCopyOwner; this.isRecoveringBindings = isRecoveringBindings; this.fromJavaProject = fromJavaProject; }
Example #8
Source File: DefaultBindingResolver.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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; }
Example #9
Source File: DefaultBindingResolver.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public CompilationUnitScope scope() { return this.scope; }
Example #10
Source File: TypedefCollector.java From javaide with GNU General Public License v3.0 | 4 votes |
@Override public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope) { return recordTypedefs(typeDeclaration); }
Example #11
Source File: CompilationUnitDeclaration.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void traverse(ASTVisitor visitor, CompilationUnitScope unitScope, boolean skipOnError) { if (skipOnError && this.ignoreFurtherInvestigation) return; try { if (visitor.visit(this, this.scope)) { if (this.types != null && isPackageInfo()) { // resolve synthetic type declaration final TypeDeclaration syntheticTypeDeclaration = this.types[0]; // resolve javadoc package if any final MethodScope methodScope = syntheticTypeDeclaration.staticInitializerScope; // Don't traverse in null scope and invite trouble a la bug 252555. if (this.javadoc != null && methodScope != null) { this.javadoc.traverse(visitor, methodScope); } // Don't traverse in null scope and invite trouble a la bug 252555. if (this.currentPackage != null && methodScope != null) { final Annotation[] annotations = this.currentPackage.annotations; if (annotations != null) { int annotationsLength = annotations.length; for (int i = 0; i < annotationsLength; i++) { annotations[i].traverse(visitor, methodScope); } } } } if (this.currentPackage != null) { this.currentPackage.traverse(visitor, this.scope); } if (this.imports != null) { int importLength = this.imports.length; for (int i = 0; i < importLength; i++) { this.imports[i].traverse(visitor, this.scope); } } if (this.types != null) { int typesLength = this.types.length; for (int i = 0; i < typesLength; i++) { this.types[i].traverse(visitor, this.scope); } } } visitor.endVisit(this, this.scope); } catch (AbortCompilationUnit e) { // ignore } }
Example #12
Source File: CompilationUnitDeclaration.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void traverse(ASTVisitor visitor, CompilationUnitScope unitScope) { traverse(visitor, unitScope, true); }
Example #13
Source File: ASTVisitor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public boolean visit( TypeDeclaration typeDeclaration, CompilationUnitScope scope) { return true; // do nothing by default, keep traversing }
Example #14
Source File: ASTVisitor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public boolean visit(ImportReference importRef, CompilationUnitScope scope) { return true; // do nothing by default, keep traversing }
Example #15
Source File: ASTVisitor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public boolean visit( CompilationUnitDeclaration compilationUnitDeclaration, CompilationUnitScope scope) { return true; // do nothing by default, keep traversing }
Example #16
Source File: ASTVisitor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void endVisit( TypeDeclaration typeDeclaration, CompilationUnitScope scope) { // do nothing by default }
Example #17
Source File: ASTVisitor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void endVisit(ImportReference importRef, CompilationUnitScope scope) { // do nothing by default }
Example #18
Source File: ASTVisitor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void endVisit( CompilationUnitDeclaration compilationUnitDeclaration, CompilationUnitScope scope) { // do nothing by default }
Example #19
Source File: SetGeneratedByVisitor.java From EasyMPermission with MIT License | 4 votes |
@Override public boolean visit(CompilationUnitDeclaration node, CompilationUnitScope scope) { fixPositions(setGeneratedBy(node, source)); return super.visit(node, scope); }
Example #20
Source File: ThrownExceptionFinder.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope) { return visitType(typeDeclaration); }
Example #21
Source File: SetGeneratedByVisitor.java From EasyMPermission with MIT License | 4 votes |
@Override public boolean visit(TypeDeclaration node, CompilationUnitScope scope) { fixPositions(setGeneratedBy(node, source)); return super.visit(node, scope); }
Example #22
Source File: SetGeneratedByVisitor.java From EasyMPermission with MIT License | 4 votes |
@Override public boolean visit(ImportReference node, CompilationUnitScope scope) { fixPositions(setGeneratedBy(node, source)); return super.visit(node, scope); }
Example #23
Source File: BindingResolver.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 2 votes |
/** * Returns the compilation unit scope used by this binding resolver. * Returns <code>null</code> if none. * * @return the compilation unit scope by this resolver, or <code>null</code> if none. */ public CompilationUnitScope scope() { return null; }