public void invalidField(QualifiedNameReference nameRef, FieldBinding field, int index, TypeBinding searchedType) {
	//the resolution of the index-th field of qname failed
	//qname.otherBindings[index] is the binding that has produced the error

	//The different targetted errors should be :
	//UndefinedField
	//NotVisibleField
	//AmbiguousField

	if (isRecoveredName(nameRef.tokens)) return;

	if (searchedType.isBaseType()) {
		this.handle(
			IProblem.NoFieldOnBaseType,
			new String[] {
				new String(searchedType.readableName()),
				CharOperation.toString(CharOperation.subarray(nameRef.tokens, 0, index)),
				new String(nameRef.tokens[index])},
			new String[] {
				new String(searchedType.sourceName()),
				CharOperation.toString(CharOperation.subarray(nameRef.tokens, 0, index)),
				new String(nameRef.tokens[index])},
				ProblemSeverities.Ignore,
			nameRef.sourceStart,
			(int) nameRef.sourcePositions[index]);
		return;
	}

	int id = IProblem.UndefinedField;
	switch (field.problemId()) {
		case ProblemReasons.NotFound :
			id = IProblem.UndefinedField;
/* also need to check that the searchedType is the receiver type
			if (searchedType.isHierarchyInconsistent())
				severity = SecondaryError;
*/
			break;
		case ProblemReasons.NotVisible :
			String fieldName = new String(nameRef.tokens[index]);
			this.handle(
				IProblem.NotVisibleField,
				new String[] {fieldName, new String(field.declaringClass.readableName())},
				new String[] {fieldName, new String(field.declaringClass.shortReadableName())},
				ProblemSeverities.Ignore,
				nodeSourceStart(field, nameRef),
				nodeSourceEnd(field, nameRef));
			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,
				new String[] {new String(searchedType.leafComponentType().readableName())},
				new String[] {new String(searchedType.leafComponentType().shortReadableName())},
				ProblemSeverities.Ignore,
				nameRef.sourceStart,
				nameRef.sourceEnd);
			return;
		case ProblemReasons.NoError : // 0
		default :
			needImplementation(); // want to fail to see why we were here...
			break;
	}
	String[] arguments = new String[] {CharOperation.toString(CharOperation.subarray(nameRef.tokens, 0, index + 1))};
	this.handle(
		id,
		arguments,
		arguments,
		ProblemSeverities.Ignore,
		nameRef.sourceStart,
		(int) nameRef.sourcePositions[index]);
}
//public void invalidMethod(MessageSend messageSend, MethodBinding method) {
//	if (isRecoveredName(messageSend.selector)) return;
//
//	boolean isFunction = method.declaringClass==null;
//	int id = isFunction? IProblem.UndefinedFunction : IProblem.UndefinedMethod; //default...
//    MethodBinding shownMethod = method;
//
//	switch (method.problemId()) {
//		case ProblemReasons.NotFound :
//			id = isFunction? IProblem.UndefinedFunction : IProblem.UndefinedMethod;
//			ProblemMethodBinding problemMethod = (ProblemMethodBinding) method;
//			if (problemMethod.closestMatch != null) {
//			    	shownMethod = problemMethod.closestMatch;
//					String closestParameterTypeNames = typesAsString(shownMethod.isVarargs(), shownMethod.parameters, false);
//					String parameterTypeNames = typesAsString(false, problemMethod.parameters, false);
//					String closestParameterTypeShortNames = typesAsString(shownMethod.isVarargs(), shownMethod.parameters, true);
//					String parameterTypeShortNames = typesAsString(false, problemMethod.parameters, true);
//					this.handle(
//						IProblem.ParameterMismatch,
//						new String[] {
//							new String(shownMethod.declaringClass.readableName()),
//							new String(shownMethod.selector),
//							closestParameterTypeNames,
//							parameterTypeNames
//						},
//						new String[] {
//							new String(shownMethod.declaringClass.shortReadableName()),
//							new String(shownMethod.selector),
//							closestParameterTypeShortNames,
//							parameterTypeShortNames
//						},
//						ProblemSeverities.Ignore,
//						(int) (messageSend.nameSourcePosition >>> 32),
//						(int) messageSend.nameSourcePosition);
//					return;
//			}
//			break;
//		case ProblemReasons.NotVisible :
//			id = IProblem.NotVisibleMethod;
//			problemMethod = (ProblemMethodBinding) method;
//			if (problemMethod.closestMatch != null) {
//			    shownMethod = problemMethod.closestMatch.original();
//		    }
//			break;
//		case ProblemReasons.Ambiguous :
//			id = IProblem.AmbiguousMethod;
//			break;
//		case ProblemReasons.NotAFunction :
//			id = IProblem.NotAFunction;
//			break;
//		case ProblemReasons.InheritedNameHidesEnclosingName :
//			id = IProblem.InheritedMethodHidesEnclosingName;
//			break;
//		case ProblemReasons.NonStaticReferenceInConstructorInvocation :
//			id = IProblem.InstanceMethodDuringConstructorInvocation;
//			break;
//		case ProblemReasons.NonStaticReferenceInStaticContext :
//			id = IProblem.StaticMethodRequested;
//			break;
//		case ProblemReasons.ReceiverTypeNotVisible :
//			this.handle(
//				IProblem.NotVisibleType,	// cannot occur in javadoc comments
//				new String[] {new String(method.declaringClass.leafComponentType().readableName())},
//				new String[] {new String(method.declaringClass.leafComponentType().shortReadableName())},
//				ProblemSeverities.Ignore,
//				messageSend.receiver.sourceStart,
//				messageSend.receiver.sourceEnd);
//			return;
//		case ProblemReasons.NoError : // 0
//		default :
//			needImplementation(); // want to fail to see why we were here...
//			break;
//	}
//
//	String shortName=""; //$NON-NLS-1$
//	String readableName=""; //$NON-NLS-1$
//	String methodName=(shownMethod.selector!=null)? new String(shownMethod.selector):""; //$NON-NLS-1$
//	if (method.declaringClass!=null)
//	{
//		shortName=		readableName=new String(method.declaringClass.readableName());
//
//	}
//	this.handle(
//		id,
//		new String[] {
//				readableName,
//				shortName, typesAsString(shownMethod.isVarargs(), shownMethod.parameters, false)},
//		new String[] {
//				shortName,
//				methodName, typesAsString(shownMethod.isVarargs(), shownMethod.parameters, true)},
//				ProblemSeverities.Ignore,
//		(int) (messageSend.nameSourcePosition >>> 32),
//		(int) messageSend.nameSourcePosition);
//}