/** * Checks if the qualified name reference is a problem field binding and have a valid field. * * @param qualifiedNameReference * Reference which should contains a problem field binding. * @return true if the qualified name reference is a valid problem field binding. */ static boolean isValidProblemBindingField(QualifiedNameReference qualifiedNameReference) { return qualifiedNameReference.binding instanceof ProblemFieldBinding && !((FieldBinding) qualifiedNameReference.binding).declaringClass.isAnonymousType() && qualifiedNameReference.tokens.length - 1 == ((FieldBinding) qualifiedNameReference.binding).declaringClass.compoundName.length && CharOperation .equals(CharOperation.subarray(qualifiedNameReference.tokens, 0, qualifiedNameReference.tokens.length - 1), ((FieldBinding) qualifiedNameReference.binding).declaringClass.compoundName); }
@Override public NestingKind getNestingKind() { ReferenceBinding refBinding = (ReferenceBinding)_binding; if (refBinding.isAnonymousType()) { return NestingKind.ANONYMOUS; } else if (refBinding.isLocalType()) { return NestingKind.LOCAL; } else if (refBinding.isMemberType()) { return NestingKind.MEMBER; } return NestingKind.TOP_LEVEL; }
@Override public NestingKind getNestingKind() { ReferenceBinding refBinding = (ReferenceBinding)_binding; if (refBinding.isAnonymousType()) { return NestingKind.ANONYMOUS; } else if (refBinding.isLocalType()) { return NestingKind.LOCAL; } else if (refBinding.isMemberType()) { return NestingKind.MEMBER; } return NestingKind.TOP_LEVEL; }
@Override public NestingKind getNestingKind() { ReferenceBinding refBinding = (ReferenceBinding)_binding; if (refBinding.isAnonymousType()) { return NestingKind.ANONYMOUS; } else if (refBinding.isLocalType()) { return NestingKind.LOCAL; } else if (refBinding.isMemberType()) { return NestingKind.MEMBER; } return NestingKind.TOP_LEVEL; }
@Override public NestingKind getNestingKind() { ReferenceBinding refBinding = (ReferenceBinding)_binding; if (refBinding.isAnonymousType()) { return NestingKind.ANONYMOUS; } else if (refBinding.isLocalType()) { return NestingKind.LOCAL; } else if (refBinding.isMemberType()) { return NestingKind.MEMBER; } return NestingKind.TOP_LEVEL; }
@Override public NestingKind getNestingKind() { ReferenceBinding refBinding = (ReferenceBinding)_binding; if (refBinding.isAnonymousType()) { return NestingKind.ANONYMOUS; } else if (refBinding.isLocalType()) { return NestingKind.LOCAL; } else if (refBinding.isMemberType()) { return NestingKind.MEMBER; } return NestingKind.TOP_LEVEL; }
@Override public NestingKind getNestingKind() { ReferenceBinding refBinding = (ReferenceBinding)_binding; if (refBinding.isAnonymousType()) { return NestingKind.ANONYMOUS; } else if (refBinding.isLocalType()) { return NestingKind.LOCAL; } else if (refBinding.isMemberType()) { return NestingKind.MEMBER; } return NestingKind.TOP_LEVEL; }
@NonNull @Override public String getName() { if (mName == null) { if (mMethodBinding.isConstructor()) { ReferenceBinding cls = mMethodBinding.declaringClass; while (cls != null && cls.isAnonymousType()) { cls = cls.superclass(); } if (cls != null) { char[][] compoundName = cls.compoundName; mName = new String(compoundName[compoundName.length - 1]); return mName; } } mName = new String(mMethodBinding.selector); } return mName; }
@Override public boolean isAnonymous() { if (isClass() || isInterface() || isEnum()) { ReferenceBinding referenceBinding = (ReferenceBinding) this.binding; return referenceBinding.isAnonymousType(); } return false; }
public boolean isAnonymous() { if (isClass() || isInterface() || isEnum()) { ReferenceBinding referenceBinding = (ReferenceBinding) this.binding; return referenceBinding.isAnonymousType(); } return false; }
public boolean isAnonymous() { if (isClass() || isInterface() || isEnum()) { ReferenceBinding referenceBinding = (ReferenceBinding) this.binding; return referenceBinding.isAnonymousType(); } return false; }
public boolean isAnonymous() { if (isClass() || isInterface() || isEnum()) { ReferenceBinding referenceBinding = (ReferenceBinding) this.binding; return referenceBinding.isAnonymousType(); } return false; }
public boolean isAnonymous() { if (isClass() || isInterface() || isEnum()) { ReferenceBinding referenceBinding = (ReferenceBinding) this.binding; return referenceBinding.isAnonymousType(); } return false; }
public boolean isAnonymous() { if (isClass() || isInterface() || isEnum()) { ReferenceBinding referenceBinding = (ReferenceBinding) this.binding; return referenceBinding.isAnonymousType(); } return false; }
public void noSuchEnclosingInstance(TypeBinding targetType, ASTNode location, boolean isConstructorCall) { int id; if (isConstructorCall) { //28 = No enclosing instance of type {0} is available due to some intermediate constructor invocation id = IProblem.EnclosingInstanceInConstructorCall; } else if ((location instanceof ExplicitConstructorCall) && ((ExplicitConstructorCall) location).accessMode == ExplicitConstructorCall.ImplicitSuper) { //20 = No enclosing instance of type {0} is accessible to invoke the super constructor. Must define a constructor and explicitly qualify its super constructor invocation with an instance of {0} (e.g. x.super() where x is an instance of {0}). id = IProblem.MissingEnclosingInstanceForConstructorCall; } else if (location instanceof AllocationExpression && (((AllocationExpression) location).binding.declaringClass.isMemberType() || (((AllocationExpression) location).binding.declaringClass.isAnonymousType() && ((AllocationExpression) location).binding.declaringClass.superclass().isMemberType()))) { //21 = No enclosing instance of type {0} is accessible. Must qualify the allocation with an enclosing instance of type {0} (e.g. x.new A() where x is an instance of {0}). id = IProblem.MissingEnclosingInstance; } else { // default //22 = No enclosing instance of the type {0} is accessible in scope id = IProblem.IncorrectEnclosingInstanceReference; } this.handle( id, new String[] { new String(targetType.readableName())}, new String[] { new String(targetType.shortReadableName())}, location.sourceStart, location.sourceEnd); } public void notCompatibleTypesError(EqualExpression expression, TypeBinding leftType, TypeBinding rightType) {
public void noSuchEnclosingInstance(TypeBinding targetType, ASTNode location, boolean isConstructorCall) { int id; if (isConstructorCall) { //28 = No enclosing instance of type {0} is available due to some intermediate constructor invocation id = IProblem.EnclosingInstanceInConstructorCall; } else if ((location instanceof ExplicitConstructorCall) && ((ExplicitConstructorCall) location).accessMode == ExplicitConstructorCall.ImplicitSuper) { //20 = No enclosing instance of type {0} is accessible to invoke the super constructor. Must define a constructor and explicitly qualify its super constructor invocation with an instance of {0} (e.g. x.super() where x is an instance of {0}). id = IProblem.MissingEnclosingInstanceForConstructorCall; } else if (location instanceof AllocationExpression && (((AllocationExpression) location).binding.declaringClass.isMemberType() || (((AllocationExpression) location).binding.declaringClass.isAnonymousType() && ((AllocationExpression) location).binding.declaringClass.superclass().isMemberType()))) { //21 = No enclosing instance of type {0} is accessible. Must qualify the allocation with an enclosing instance of type {0} (e.g. x.new A() where x is an instance of {0}). id = IProblem.MissingEnclosingInstance; } else { // default //22 = No enclosing instance of the type {0} is accessible in scope id = IProblem.IncorrectEnclosingInstanceReference; } this.handle( id, new String[] { new String(targetType.readableName())}, new String[] { new String(targetType.shortReadableName())}, location.sourceStart, location.sourceEnd); } public void notCompatibleTypesError(EqualExpression expression, TypeBinding leftType, TypeBinding rightType) {
public void noSuchEnclosingInstance(TypeBinding targetType, ASTNode location, boolean isConstructorCall) { int id; if (isConstructorCall) { //28 = No enclosing instance of type {0} is available due to some intermediate constructor invocation id = IProblem.EnclosingInstanceInConstructorCall; } else if ((location instanceof ExplicitConstructorCall) && ((ExplicitConstructorCall) location).accessMode == ExplicitConstructorCall.ImplicitSuper) { //20 = No enclosing instance of type {0} is accessible to invoke the super constructor. Must define a constructor and explicitly qualify its super constructor invocation with an instance of {0} (e.g. x.super() where x is an instance of {0}). id = IProblem.MissingEnclosingInstanceForConstructorCall; } else if (location instanceof AllocationExpression && (((AllocationExpression) location).binding.declaringClass.isMemberType() || (((AllocationExpression) location).binding.declaringClass.isAnonymousType() && ((AllocationExpression) location).binding.declaringClass.superclass().isMemberType()))) { //21 = No enclosing instance of type {0} is accessible. Must qualify the allocation with an enclosing instance of type {0} (e.g. x.new A() where x is an instance of {0}). id = IProblem.MissingEnclosingInstance; } else { // default //22 = No enclosing instance of the type {0} is accessible in scope id = IProblem.IncorrectEnclosingInstanceReference; } this.handle( id, new String[] { new String(targetType.readableName())}, new String[] { new String(targetType.shortReadableName())}, location.sourceStart, location.sourceEnd); } public void notCompatibleTypesError(EqualExpression expression, TypeBinding leftType, TypeBinding rightType) {
public void noSuchEnclosingInstance(TypeBinding targetType, ASTNode location, boolean isConstructorCall) { int id; if (isConstructorCall) { //28 = No enclosing instance of type {0} is available due to some intermediate constructor invocation id = IProblem.EnclosingInstanceInConstructorCall; } else if ((location instanceof ExplicitConstructorCall) && ((ExplicitConstructorCall) location).accessMode == ExplicitConstructorCall.ImplicitSuper) { //20 = No enclosing instance of type {0} is accessible to invoke the super constructor. Must define a constructor and explicitly qualify its super constructor invocation with an instance of {0} (e.g. x.super() where x is an instance of {0}). id = IProblem.MissingEnclosingInstanceForConstructorCall; } else if (location instanceof AllocationExpression && (((AllocationExpression) location).binding.declaringClass.isMemberType() || (((AllocationExpression) location).binding.declaringClass.isAnonymousType() && ((AllocationExpression) location).binding.declaringClass.superclass().isMemberType()))) { //21 = No enclosing instance of type {0} is accessible. Must qualify the allocation with an enclosing instance of type {0} (e.g. x.new A() where x is an instance of {0}). id = IProblem.MissingEnclosingInstance; } else { // default //22 = No enclosing instance of the type {0} is accessible in scope id = IProblem.IncorrectEnclosingInstanceReference; } this.handle( id, new String[] { new String(targetType.readableName())}, new String[] { new String(targetType.shortReadableName())}, location.sourceStart, location instanceof LambdaExpression ? ((LambdaExpression)location).diagnosticsSourceEnd() : location.sourceEnd); } public void notCompatibleTypesError(EqualExpression expression, TypeBinding leftType, TypeBinding rightType) {
public void noSuchEnclosingInstance(TypeBinding targetType, ASTNode location, boolean isConstructorCall) { int id; if (isConstructorCall) { //28 = No enclosing instance of type {0} is available due to some intermediate constructor invocation id = IProblem.EnclosingInstanceInConstructorCall; } else if ((location instanceof ExplicitConstructorCall) && ((ExplicitConstructorCall) location).accessMode == ExplicitConstructorCall.ImplicitSuper) { //20 = No enclosing instance of type {0} is accessible to invoke the super constructor. Must define a constructor and explicitly qualify its super constructor invocation with an instance of {0} (e.g. x.super() where x is an instance of {0}). id = IProblem.MissingEnclosingInstanceForConstructorCall; } else if (location instanceof AllocationExpression && (((AllocationExpression) location).binding.declaringClass.isMemberType() || (((AllocationExpression) location).binding.declaringClass.isAnonymousType() && ((AllocationExpression) location).binding.declaringClass.superclass().isMemberType()))) { //21 = No enclosing instance of type {0} is accessible. Must qualify the allocation with an enclosing instance of type {0} (e.g. x.new A() where x is an instance of {0}). id = IProblem.MissingEnclosingInstance; } else { // default //22 = No enclosing instance of the type {0} is accessible in scope id = IProblem.IncorrectEnclosingInstanceReference; } this.handle( id, new String[] { new String(targetType.readableName())}, new String[] { new String(targetType.shortReadableName())}, location.sourceStart, location instanceof LambdaExpression ? ((LambdaExpression)location).diagnosticsSourceEnd() : location.sourceEnd); } public void notCompatibleTypesError(EqualExpression expression, TypeBinding leftType, TypeBinding rightType) {
@Override public int getModifiers() { if (isClass()) { ReferenceBinding referenceBinding = (ReferenceBinding) this.binding; final int accessFlags = referenceBinding.getAccessFlags() & VALID_MODIFIERS; if (referenceBinding.isAnonymousType()) { return accessFlags & ~Modifier.FINAL; } return accessFlags; } else if (isAnnotation()) { ReferenceBinding referenceBinding = (ReferenceBinding) this.binding; final int accessFlags = referenceBinding.getAccessFlags() & VALID_MODIFIERS; // clear the AccAbstract, AccAnnotation and the AccInterface bits return accessFlags & ~(ClassFileConstants.AccAbstract | ClassFileConstants.AccInterface | ClassFileConstants.AccAnnotation); } else if (isInterface()) { ReferenceBinding referenceBinding = (ReferenceBinding) this.binding; final int accessFlags = referenceBinding.getAccessFlags() & VALID_MODIFIERS; // clear the AccAbstract and the AccInterface bits return accessFlags & ~(ClassFileConstants.AccAbstract | ClassFileConstants.AccInterface); } else if (isEnum()) { ReferenceBinding referenceBinding = (ReferenceBinding) this.binding; final int accessFlags = referenceBinding.getAccessFlags() & VALID_MODIFIERS; // clear the AccEnum bits return accessFlags & ~ClassFileConstants.AccEnum; } else { return Modifier.NONE; } }