}
public void invalidField(FieldReference fieldRef, TypeBinding searchedType) {
if(isRecoveredName(fieldRef.token)) return;
int id = IProblem.UndefinedField;
FieldBinding field = fieldRef.binding;
switch (field.problemId()) {
case ProblemReasons.NotFound :
if ((searchedType.tagBits & TagBits.HasMissingType) != 0) {
this.handle(
IProblem.UndefinedType,
new String[] {new String(searchedType.leafComponentType().readableName())},
new String[] {new String(searchedType.leafComponentType().shortReadableName())},
fieldRef.receiver.sourceStart,
fieldRef.receiver.sourceEnd);
return;
}
id = IProblem.UndefinedField;
/* also need to check that the searchedType is the receiver type
if (searchedType.isHierarchyInconsistent())
severity = SecondaryError;
*/
break;
case ProblemReasons.NotVisible :
this.handle(
IProblem.NotVisibleField,
new String[] {new String(fieldRef.token), new String(field.declaringClass.readableName())},
new String[] {new String(fieldRef.token), new String(field.declaringClass.shortReadableName())},
nodeSourceStart(field, fieldRef),
nodeSourceEnd(field, fieldRef));
return;
case ProblemReasons.Ambiguous :
id = IProblem.AmbiguousField;
break;
case ProblemReasons.NonStaticReferenceInStaticContext :
id = IProblem.NonStaticFieldFromStaticInvocation;
break;
case ProblemReasons.NonStaticReferenceInConstructorInvocation :
id = IProblem.InstanceFieldDuringConstructorInvocation;
break;
case ProblemReasons.InheritedNameHidesEnclosingName :
id = IProblem.InheritedFieldHidesEnclosingName;
break;
case ProblemReasons.ReceiverTypeNotVisible :
this.handle(
IProblem.NotVisibleType, // cannot occur in javadoc comments
new String[] {new String(searchedType.leafComponentType().readableName())},
new String[] {new String(searchedType.leafComponentType().shortReadableName())},
fieldRef.receiver.sourceStart,
fieldRef.receiver.sourceEnd);
return;
case ProblemReasons.NoError : // 0
default :
needImplementation(fieldRef); // want to fail to see why we were here...
break;
}
String[] arguments = new String[] {new String(field.readableName())};
this.handle(
id,
arguments,
arguments,
nodeSourceStart(field, fieldRef),