// only complain if field reference (for local, its type got flagged already)
return null;
}
this.resolvedType = getOtherFieldBindings(scope);
if (this.resolvedType != null && (this.resolvedType.tagBits & TagBits.HasMissingType) != 0) {
FieldBinding lastField = this.otherBindings[this.otherBindings.length - 1];
scope.problemReporter().invalidField(this, new ProblemFieldBinding(lastField.declaringClass, lastField.name, ProblemReasons.NotFound), this.tokens.length, this.resolvedType.leafComponentType());
return null;
}
return this.resolvedType;
}
if (this.binding instanceof FieldBinding) {
this.bits &= ~ASTNode.RestrictiveFlagMASK; // clear bits
this.bits |= Binding.FIELD;
FieldBinding fieldBinding = (FieldBinding) this.binding;
MethodScope methodScope = scope.methodScope();
ReferenceBinding declaringClass = fieldBinding.original().declaringClass;
SourceTypeBinding sourceType = methodScope.enclosingSourceType();
// check for forward references
if ((this.indexOfFirstFieldBinding == 1 || (fieldBinding.modifiers & ClassFileConstants.AccEnum) != 0 || (!fieldBinding.isFinal() && declaringClass.isEnum())) // enum constants are checked even when qualified
&& sourceType == declaringClass
&& methodScope.lastVisibleFieldID >= 0
&& fieldBinding.id >= methodScope.lastVisibleFieldID
&& (!fieldBinding.isStatic() || methodScope.isStatic)) {
scope.problemReporter().forwardReference(this, this.indexOfFirstFieldBinding-1, fieldBinding);
}
if (isFieldUseDeprecated(fieldBinding, scope, this.indexOfFirstFieldBinding == this.tokens.length ? this.bits : 0)) {
scope.problemReporter().deprecatedField(fieldBinding, this);
}
if (fieldBinding.isStatic()) {
// only last field is actually a write access if any
// check if accessing enum static field in initializer
if (declaringClass.isEnum()) {
if ((sourceType == declaringClass || sourceType.superclass == declaringClass) // enum constant body
&& fieldBinding.constant() == Constant.NotAConstant
&& !methodScope.isStatic
&& methodScope.isInsideInitializerOrConstructor()) {
scope.problemReporter().enumStaticFieldUsedDuringInitialization(fieldBinding, this);
}
}
if (this.indexOfFirstFieldBinding > 1
&& fieldBinding.declaringClass != this.actualReceiverType
&& fieldBinding.declaringClass.canBeSeenBy(scope)) {
scope.problemReporter().indirectAccessToStaticField(this, fieldBinding);
}
} else {
if (this.indexOfFirstFieldBinding == 1 && scope.compilerOptions().getSeverity(CompilerOptions.UnqualifiedFieldAccess) != ProblemSeverities.Ignore) {
scope.problemReporter().unqualifiedFieldAccess(this, fieldBinding);
}
//must check for the static status....
if (this.indexOfFirstFieldBinding > 1 //accessing to a field using a type as "receiver" is allowed only with static field
|| scope.methodScope().isStatic) { // the field is the first token of the qualified reference....
scope.problemReporter().staticFieldAccessToNonStaticVariable(this, fieldBinding);
return null;
}
}
this.resolvedType = getOtherFieldBindings(scope);
if (this.resolvedType != null
&& (this.resolvedType.tagBits & TagBits.HasMissingType) != 0) {
FieldBinding lastField = this.indexOfFirstFieldBinding == this.tokens.length ? (FieldBinding)this.binding : this.otherBindings[this.otherBindings.length - 1];
scope.problemReporter().invalidField(this, new ProblemFieldBinding(lastField.declaringClass, lastField.name, ProblemReasons.NotFound), this.tokens.length, this.resolvedType.leafComponentType());
return null;
}
return this.resolvedType;
}