FieldBinding fieldBinding = (FieldBinding) this.binding;
this.constant = fieldBinding.constant();
this.bits &= ~ASTNode.RestrictiveFlagMASK; // clear bits
this.bits |= Binding.FIELD;
MethodScope methodScope = scope.methodScope();
if (fieldBinding.isStatic()) {
// check if accessing enum static field in initializer
ReferenceBinding declaringClass = fieldBinding.declaringClass;
if (declaringClass.isEnum()) {
SourceTypeBinding sourceType = scope.enclosingSourceType();
if (this.constant == Constant.NotAConstant
&& !methodScope.isStatic
&& (TypeBinding.equalsEquals(sourceType, declaringClass) || TypeBinding.equalsEquals(sourceType.superclass, declaringClass)) // enum constant body
&& methodScope.isInsideInitializerOrConstructor()) {
scope.problemReporter().enumStaticFieldUsedDuringInitialization(fieldBinding, this);
}
}
} else {
if (scope.compilerOptions().getSeverity(CompilerOptions.UnqualifiedFieldAccess) != ProblemSeverities.Ignore) {
scope.problemReporter().unqualifiedFieldAccess(this, fieldBinding);
}
// must check for the static status....
if (methodScope.isStatic) {
scope.problemReporter().staticFieldAccessToNonStaticVariable(this, fieldBinding);
return fieldBinding.type;
} else {
scope.tagAsAccessingEnclosingInstanceStateOf(fieldBinding.declaringClass, false /* type variable access */);
}
}
if (isFieldUseDeprecated(fieldBinding, scope, this.bits))
scope.problemReporter().deprecatedField(fieldBinding, this);
if ((this.bits & ASTNode.IsStrictlyAssigned) == 0
&& TypeBinding.equalsEquals(methodScope.enclosingSourceType(), fieldBinding.original().declaringClass)
&& methodScope.lastVisibleFieldID >= 0
&& fieldBinding.id >= methodScope.lastVisibleFieldID
&& (!fieldBinding.isStatic() || methodScope.isStatic)) {
scope.problemReporter().forwardReference(this, 0, fieldBinding);
this.bits |= ASTNode.IgnoreNoEffectAssignCheck;