org.eclipse.jdt.internal.compiler.lookup.FieldBinding Java Examples
The following examples show how to use
org.eclipse.jdt.internal.compiler.lookup.FieldBinding.
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: Reference.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
void reportOnlyUselesslyReadPrivateField(BlockScope currentScope, FieldBinding fieldBinding, boolean valueRequired) { if (valueRequired) { // access is relevant, turn compound use into real use: fieldBinding.compoundUseFlag = 0; fieldBinding.modifiers |= ExtraCompilerModifiers.AccLocallyUsed; } else { if (fieldBinding.isUsedOnlyInCompound()) { fieldBinding.compoundUseFlag--; // consume one if (fieldBinding.compoundUseFlag == 0 // report only the last usage && fieldBinding.isOrEnclosedByPrivateType() && (this.implicitConversion & TypeIds.UNBOXING) == 0) // don't report if unboxing is involved (might cause NPE) { // compoundAssignment/postIncrement is the only usage of this field currentScope.problemReporter().unusedPrivateField(fieldBinding.sourceField()); fieldBinding.modifiers |= ExtraCompilerModifiers.AccLocallyUsed; // don't report again } } } }
Example #2
Source File: SingleNameReference.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo, boolean isReadAccess) { if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return; //If inlinable field, forget the access emulation, the code gen will directly target it if (this.constant != Constant.NotAConstant) return; if ((this.bits & Binding.FIELD) != 0) { FieldBinding fieldBinding = (FieldBinding) this.binding; FieldBinding codegenField = fieldBinding.original(); if (((this.bits & ASTNode.DepthMASK) != 0) && (codegenField.isPrivate() // private access || (codegenField.isProtected() // implicit protected access && codegenField.declaringClass.getPackage() != currentScope.enclosingSourceType().getPackage()))) { if (this.syntheticAccessors == null) this.syntheticAccessors = new MethodBinding[2]; this.syntheticAccessors[isReadAccess ? SingleNameReference.READ : SingleNameReference.WRITE] = ((SourceTypeBinding)currentScope.enclosingSourceType(). enclosingTypeAt((this.bits & ASTNode.DepthMASK) >> ASTNode.DepthSHIFT)).addSyntheticMethod(codegenField, isReadAccess, false /*not super access*/); currentScope.problemReporter().needToEmulateFieldAccess(codegenField, this, isReadAccess); return; } } }
Example #3
Source File: Extractor.java From javaide with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings("unused") static boolean hasSourceRetention(@NonNull AnnotationBinding a) { if (new String(a.getAnnotationType().readableName()).equals("java.lang.annotation.Retention")) { ElementValuePair[] pairs = a.getElementValuePairs(); if (pairs == null || pairs.length != 1) { warning("Expected exactly one parameter passed to @Retention"); return false; } ElementValuePair pair = pairs[0]; Object value = pair.getValue(); if (value instanceof FieldBinding) { FieldBinding field = (FieldBinding) value; if ("SOURCE".equals(new String(field.readableName()))) { return true; } } } return false; }
Example #4
Source File: Extractor.java From javaide with GNU General Public License v3.0 | 6 votes |
@Override public boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope) { Annotation[] annotations = fieldDeclaration.annotations; if (hasRelevantAnnotations(annotations)) { FieldBinding fieldBinding = fieldDeclaration.binding; if (fieldBinding == null) { return false; } String fqn = getFqn(scope); ClassKind kind = scope.referenceContext instanceof TypeDeclaration ? ClassKind.forType((TypeDeclaration) scope.referenceContext) : ClassKind.CLASS; Item item = FieldItem.create(fqn, kind, fieldBinding); if (item != null && fqn != null) { addItem(fqn, item); addAnnotations(annotations, item); } } return false; }
Example #5
Source File: SingleNameReference.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=185682 switch (this.bits & ASTNode.RestrictiveFlagMASK) { case Binding.LOCAL: LocalVariableBinding localBinding = (LocalVariableBinding) this.binding; // check if compound assignment is the only usage of this local Reference.reportOnlyUselesslyReadLocal(currentScope, localBinding, valueRequired); break; case Binding.FIELD: // check if compound assignment is the only usage of a private field reportOnlyUselesslyReadPrivateField(currentScope, (FieldBinding)this.binding, valueRequired); } this.generateCompoundAssignment( currentScope, codeStream, this.syntheticAccessors == null ? null : this.syntheticAccessors[SingleNameReference.WRITE], expression, operator, assignmentImplicitConversion, valueRequired); }
Example #6
Source File: EcjMultilineProcessor.java From datafu with Apache License 2.0 | 6 votes |
@Override public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnv) { Set<? extends Element> fields = roundEnv.getElementsAnnotatedWith(Multiline.class); for (Element field : fields) { String docComment = elementUtils.getDocComment(field); if (null != docComment) { VariableElementImpl fieldElem = (VariableElementImpl) field; FieldBinding biding = (FieldBinding) fieldElem._binding; FieldDeclaration decl = biding.sourceField(); StringLiteral string = new StringLiteral(docComment.toCharArray(), decl.sourceStart, decl.sourceEnd, decl.sourceStart); decl.initialization = string; } } return true; }
Example #7
Source File: QualifiedNameReference.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public Constant optimizedBooleanConstant() { switch (this.resolvedType.id) { case T_boolean : case T_JavaLangBoolean : if (this.constant != Constant.NotAConstant) return this.constant; switch (this.bits & ASTNode.RestrictiveFlagMASK) { case Binding.FIELD : // reading a field if (this.otherBindings == null) return ((FieldBinding)this.binding).constant(); //$FALL-THROUGH$ case Binding.LOCAL : // reading a local variable return this.otherBindings[this.otherBindings.length-1].constant(); } } return Constant.NotAConstant; }
Example #8
Source File: VariableElementImpl.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public boolean hides(Element hiddenElement) { if (_binding instanceof FieldBinding) { if (!(((ElementImpl)hiddenElement)._binding instanceof FieldBinding)) { return false; } FieldBinding hidden = (FieldBinding)((ElementImpl)hiddenElement)._binding; if (hidden.isPrivate()) { return false; } FieldBinding hider = (FieldBinding)_binding; if (hidden == hider) { return false; } if (!CharOperation.equals(hider.name, hidden.name)) { return false; } return null != hider.declaringClass.findSuperTypeOriginatingFrom(hidden.declaringClass); } // TODO: should we implement hides() for method parameters? return false; }
Example #9
Source File: SelectionOnQualifiedNameReference.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public TypeBinding resolveType(BlockScope scope) { // it can be a package, type, member type, local variable or field this.binding = scope.getBinding(this.tokens, this); if (!this.binding.isValidBinding()) { if (this.binding instanceof ProblemFieldBinding) { // tolerate some error cases if (this.binding.problemId() == ProblemReasons.NotVisible || this.binding.problemId() == ProblemReasons.InheritedNameHidesEnclosingName || this.binding.problemId() == ProblemReasons.NonStaticReferenceInConstructorInvocation || this.binding.problemId() == ProblemReasons.NonStaticReferenceInStaticContext) { throw new SelectionNodeFound(this.binding); } scope.problemReporter().invalidField(this, (FieldBinding) this.binding); } else if (this.binding instanceof ProblemReferenceBinding || this.binding instanceof MissingTypeBinding) { // tolerate some error cases if (this.binding.problemId() == ProblemReasons.NotVisible){ throw new SelectionNodeFound(this.binding); } scope.problemReporter().invalidType(this, (TypeBinding) this.binding); } else { scope.problemReporter().unresolvableReference(this, this.binding); } throw new SelectionNodeFound(); } throw new SelectionNodeFound(this.binding); }
Example #10
Source File: CodeSnippetSingleNameReference.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo, boolean isReadAccess) { if (this.delegateThis == null) { super.manageSyntheticAccessIfNecessary(currentScope, flowInfo, isReadAccess); return; } if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return; //If inlinable field, forget the access emulation, the code gen will directly target it if (this.constant != Constant.NotAConstant) return; // if field from parameterized type got found, use the original field at codegen time if (this.binding instanceof ParameterizedFieldBinding) { ParameterizedFieldBinding parameterizedField = (ParameterizedFieldBinding) this.binding; FieldBinding codegenField = parameterizedField.originalField; // extra cast needed if field type was type variable if ((codegenField.type.tagBits & TagBits.HasTypeVariable) != 0) { this.genericCast = codegenField.type.genericCast(currentScope.boxing(parameterizedField.type)); // runtimeType could be base type in boxing case } } }
Example #11
Source File: CodeSnippetQualifiedNameReference.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Check and/or redirect the field access to the delegate receiver if any */ public TypeBinding checkFieldAccess(BlockScope scope) { FieldBinding fieldBinding = (FieldBinding) this.binding; MethodScope methodScope = scope.methodScope(); TypeBinding declaringClass = fieldBinding.original().declaringClass; // check for forward references if ((this.indexOfFirstFieldBinding == 1 || declaringClass.isEnum()) && TypeBinding.equalsEquals(methodScope.enclosingSourceType(), declaringClass) && methodScope.lastVisibleFieldID >= 0 && fieldBinding.id >= methodScope.lastVisibleFieldID && (!fieldBinding.isStatic() || methodScope.isStatic)) { scope.problemReporter().forwardReference(this, this.indexOfFirstFieldBinding-1, fieldBinding); } this.bits &= ~ASTNode.RestrictiveFlagMASK; // clear bits this.bits |= Binding.FIELD; return getOtherFieldBindings(scope); }
Example #12
Source File: CodeSnippetFieldReference.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) { FieldBinding codegenBinding = this.binding.original(); if (codegenBinding.canBeSeenBy(this.actualReceiverType, this, currentScope)) { this.receiver.generateCode(currentScope, codeStream, !codegenBinding.isStatic()); assignment.expression.generateCode(currentScope, codeStream, true); fieldStore(currentScope, codeStream, codegenBinding, null, this.actualReceiverType, this.receiver.isImplicitThis(), valueRequired); } else { codeStream.generateEmulationForField(codegenBinding); this.receiver.generateCode(currentScope, codeStream, !codegenBinding.isStatic()); if (codegenBinding.isStatic()) { // need a receiver? codeStream.aconst_null(); } assignment.expression.generateCode(currentScope, codeStream, true); if (valueRequired) { switch (codegenBinding.type.id) { case TypeIds.T_long : case TypeIds.T_double : codeStream.dup2_x2(); break; default : codeStream.dup_x2(); break; } } codeStream.generateEmulatedWriteAccessForField(codegenBinding); } if (valueRequired){ codeStream.generateImplicitConversion(assignment.implicitConversion); } }
Example #13
Source File: SingleNameReference.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public TypeBinding reportError(BlockScope scope) { //=====error cases======= this.constant = Constant.NotAConstant; if (this.binding instanceof ProblemFieldBinding) { scope.problemReporter().invalidField(this, (FieldBinding) this.binding); } else if (this.binding instanceof ProblemReferenceBinding || this.binding instanceof MissingTypeBinding) { scope.problemReporter().invalidType(this, (TypeBinding) this.binding); } else { scope.problemReporter().unresolvableReference(this, this.binding); } return null; }
Example #14
Source File: FieldReference.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) { int pc = codeStream.position; FieldBinding codegenBinding = this.binding.original(); this.receiver.generateCode(currentScope, codeStream, !codegenBinding.isStatic()); codeStream.recordPositionsFrom(pc, this.sourceStart); assignment.expression.generateCode(currentScope, codeStream, true); fieldStore(currentScope, codeStream, codegenBinding, this.syntheticAccessors == null ? null : this.syntheticAccessors[FieldReference.WRITE], this.actualReceiverType, this.receiver.isImplicitThis(), valueRequired); if (valueRequired) { codeStream.generateImplicitConversion(assignment.implicitConversion); } // no need for generic cast as value got dupped }
Example #15
Source File: MessageSend.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private FlowInfo analyseNullAssertion(BlockScope currentScope, Expression argument, FlowContext flowContext, FlowInfo flowInfo, boolean expectingNull) { int nullStatus = argument.nullStatus(flowInfo, flowContext); boolean willFail = (nullStatus == (expectingNull ? FlowInfo.NON_NULL : FlowInfo.NULL)); flowInfo = argument.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits(); LocalVariableBinding local = argument.localVariableBinding(); if (local != null) {// beyond this point the argument can only be null/nonnull if (expectingNull) flowInfo.markAsDefinitelyNull(local); else flowInfo.markAsDefinitelyNonNull(local); } else { if (!expectingNull && argument instanceof Reference && currentScope.compilerOptions().enableSyntacticNullAnalysisForFields) { FieldBinding field = ((Reference)argument).lastFieldBinding(); if (field != null && (field.type.tagBits & TagBits.IsBaseType) == 0) { flowContext.recordNullCheckedFieldReference((Reference) argument, 3); // survive this assert as a MessageSend and as a Statement } } } if (willFail) flowInfo.setReachMode(FlowInfo.UNREACHABLE_BY_NULLANALYSIS); return flowInfo; }
Example #16
Source File: CodeSnippetSingleNameReference.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Check and/or redirect the field access to the delegate receiver if any */ public TypeBinding checkFieldAccess(BlockScope scope) { if (this.delegateThis == null) { return super.checkFieldAccess(scope); } FieldBinding fieldBinding = (FieldBinding) this.binding; this.bits &= ~RestrictiveFlagMASK; // clear bits this.bits |= Binding.FIELD; if (!fieldBinding.isStatic()) { // must check for the static status.... if (this.evaluationContext.isStatic) { scope.problemReporter().staticFieldAccessToNonStaticVariable( this, fieldBinding); this.constant = Constant.NotAConstant; return null; } } this.constant = fieldBinding.constant(); if (isFieldUseDeprecated(fieldBinding, scope, this.bits)) { scope.problemReporter().deprecatedField(fieldBinding, this); } return fieldBinding.type; }
Example #17
Source File: QualifiedNameReference.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
protected void setSyntheticAccessor(FieldBinding fieldBinding, int index, SyntheticMethodBinding syntheticAccessor) { if (index < 0) { // write-access ? this.syntheticWriteAccessor = syntheticAccessor; } else { if (this.syntheticReadAccessors == null) { this.syntheticReadAccessors = new SyntheticMethodBinding[this.otherBindings == null ? 1 : this.otherBindings.length + 1]; } this.syntheticReadAccessors[index] = syntheticAccessor; } }
Example #18
Source File: Extractor.java From javaide with GNU General Public License v3.0 | 5 votes |
@Nullable private static String getFieldType(FieldBinding binding) { if (binding.type != null) { return new String(binding.type.readableName()); } return null; }
Example #19
Source File: LoopingFlowContext.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Perform deferred checks relative to final variables duplicate initialization * of lack of initialization. * @param scope the scope to which this context is associated * @param flowInfo the flow info against which checks must be performed */ public void complainOnDeferredFinalChecks(BlockScope scope, FlowInfo flowInfo) { // complain on final assignments in loops for (int i = 0; i < this.assignCount; i++) { VariableBinding variable = this.finalVariables[i]; if (variable == null) continue; boolean complained = false; // remember if have complained on this final assignment if (variable instanceof FieldBinding) { if (flowInfo.isPotentiallyAssigned((FieldBinding)variable)) { complained = true; scope.problemReporter().duplicateInitializationOfBlankFinalField( (FieldBinding) variable, this.finalAssignments[i]); } } else { if (flowInfo.isPotentiallyAssigned((LocalVariableBinding)variable)) { variable.tagBits &= ~TagBits.IsEffectivelyFinal; if (variable.isFinal()) { complained = true; scope.problemReporter().duplicateInitializationOfFinalLocal( (LocalVariableBinding) variable, this.finalAssignments[i]); } } } // any reference reported at this level is removed from the parent context where it // could also be reported again if (complained) { FlowContext context = this.getLocalParent(); while (context != null) { context.removeFinalAssignmentIfAny(this.finalAssignments[i]); context = context.getLocalParent(); } } } }
Example #20
Source File: Util.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Return the java element corresponding to the given compiler binding. */ public static JavaElement getUnresolvedJavaElement(FieldBinding binding, WorkingCopyOwner workingCopyOwner, BindingsToNodesMap bindingsToNodes) { if (binding.declaringClass == null) return null; // array length JavaElement unresolvedJavaElement = getUnresolvedJavaElement(binding.declaringClass, workingCopyOwner, bindingsToNodes); if (unresolvedJavaElement == null || unresolvedJavaElement.getElementType() != IJavaElement.TYPE) { return null; } return (JavaElement) ((IType) unresolvedJavaElement).getField(String.valueOf(binding.name)); }
Example #21
Source File: QualifiedNameReference.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) { int pc = codeStream.position; FieldBinding lastFieldBinding = generateReadSequence(currentScope, codeStream); codeStream.recordPositionsFrom(pc , this.sourceStart); assignment.expression.generateCode(currentScope, codeStream, true); fieldStore(currentScope, codeStream, lastFieldBinding, this.syntheticWriteAccessor, getFinalReceiverType(), false /*implicit this*/, valueRequired); // equivalent to valuesRequired[maxOtherBindings] if (valueRequired) { codeStream.generateImplicitConversion(assignment.implicitConversion); } }
Example #22
Source File: CodeSnippetQualifiedNameReference.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Check and/or redirect the field access to the delegate receiver if any */ public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) { FieldBinding lastFieldBinding = this.otherBindings == null ? (FieldBinding) this.binding : this.otherBindings[this.otherBindings.length-1]; if (lastFieldBinding.canBeSeenBy(getFinalReceiverType(), this, currentScope)) { super.generateAssignment(currentScope, codeStream, assignment, valueRequired); return; } lastFieldBinding = generateReadSequence(currentScope, codeStream); codeStream.generateEmulationForField(lastFieldBinding); codeStream.swap(); assignment.expression.generateCode(currentScope, codeStream, true); if (valueRequired) { switch (lastFieldBinding.type.id) { case TypeIds.T_long : case TypeIds.T_double : codeStream.dup2_x2(); break; default : codeStream.dup_x2(); break; } } codeStream.generateEmulatedWriteAccessForField(lastFieldBinding); if (valueRequired) { codeStream.generateImplicitConversion(assignment.implicitConversion); } }
Example #23
Source File: QualifiedNameReference.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public FieldBinding lastFieldBinding() { if (this.otherBindings != null) { return this.otherBindings[this.otherBindings.length - 1]; } else if (this.binding != null && (this.bits & RestrictiveFlagMASK) == Binding.FIELD) { return (FieldBinding) this.binding; } return null; }
Example #24
Source File: CodeSnippetScope.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public FieldBinding getFieldForCodeSnippet(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite) { FieldBinding field = findFieldForCodeSnippet(receiverType, fieldName, invocationSite); if (field == null) return new ProblemFieldBinding(receiverType instanceof ReferenceBinding ? (ReferenceBinding) receiverType : null, fieldName, ProblemReasons.NotFound); else return field; }
Example #25
Source File: BindingComparator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
static boolean isEqual(FieldBinding fieldBinding, FieldBinding fieldBinding2) { HashSet visitedTypes = new HashSet(); return (fieldBinding.modifiers & ExtraCompilerModifiers.AccJustFlag) == (fieldBinding2.modifiers & ExtraCompilerModifiers.AccJustFlag) && CharOperation.equals(fieldBinding.name, fieldBinding2.name) && isEqual(fieldBinding.type, fieldBinding2.type, visitedTypes) && isEqual(fieldBinding.declaringClass, fieldBinding2.declaringClass, visitedTypes); }
Example #26
Source File: VariableBinding.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public ITypeBinding getDeclaringClass() { if (isField()) { if (this.declaringClass == null) { FieldBinding fieldBinding = (FieldBinding) this.binding; this.declaringClass = this.resolver.getTypeBinding(fieldBinding.declaringClass); } return this.declaringClass; } else { return null; } }
Example #27
Source File: VariableBinding.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public int getModifiers() { if (isField()) { return ((FieldBinding) this.binding).getAccessFlags() & VALID_MODIFIERS; } if (this.binding.isFinal()) { return IModifierConstants.ACC_FINAL; } return Modifier.NONE; }
Example #28
Source File: VariableBinding.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public IVariableBinding getVariableDeclaration() { if (isField()) { FieldBinding fieldBinding = (FieldBinding) this.binding; return this.resolver.getVariableBinding(fieldBinding.original()); } return this; }
Example #29
Source File: VariableBinding.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public boolean isEqualTo(IBinding other) { if (other == this) { // identical binding - equal (key or no key) return true; } if (other == null) { // other binding missing return false; } if (!(other instanceof VariableBinding)) { return false; } org.eclipse.jdt.internal.compiler.lookup.VariableBinding otherBinding = ((VariableBinding) other).binding; if (this.binding instanceof FieldBinding) { if (otherBinding instanceof FieldBinding) { return BindingComparator.isEqual((FieldBinding) this.binding, (FieldBinding) otherBinding); } else { return false; } } else { if (BindingComparator.isEqual(this.binding, otherBinding)) { IMethodBinding declaringMethod = getDeclaringMethod(); IMethodBinding otherDeclaringMethod = ((VariableBinding) other).getDeclaringMethod(); if (declaringMethod == null) { if (otherDeclaringMethod != null) { return false; } return true; } return declaringMethod.isEqualTo(otherDeclaringMethod); } return false; } }
Example #30
Source File: ASTNode.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public final boolean isFieldUseDeprecated(FieldBinding field, Scope scope, int filteredBits) { if ((this.bits & ASTNode.InsideJavadoc) == 0 // ignore references inside Javadoc comments && (filteredBits & IsStrictlyAssigned) == 0 // ignore write access && field.isOrEnclosedByPrivateType() && !scope.isDefinedInField(field)) // ignore cases where field is used from inside itself { if (((filteredBits & IsCompoundAssigned) != 0)) // used, but usage may not be relevant field.original().compoundUseFlag++; else field.original().modifiers |= ExtraCompilerModifiers.AccLocallyUsed; } if ((field.modifiers & ExtraCompilerModifiers.AccRestrictedAccess) != 0) { AccessRestriction restriction = scope.environment().getAccessRestriction(field.declaringClass.erasure()); if (restriction != null) { scope.problemReporter().forbiddenReference(field, this, restriction.classpathEntryType, restriction.classpathEntryName, restriction.getProblemId()); } } if (!field.isViewedAsDeprecated()) return false; // inside same unit - no report if (scope.isDefinedInSameUnit(field.declaringClass)) return false; // if context is deprecated, may avoid reporting if (!scope.compilerOptions().reportDeprecationInsideDeprecatedCode && scope.isInsideDeprecatedCode()) return false; return true; }