return methodBinding;
}
}
MethodBinding[] methods = receiverType.getMethods(TypeConstants.INIT);
if (methods == Binding.NO_METHODS) {
return new ProblemMethodBinding(TypeConstants.INIT, argumentTypes, ProblemReasons.NotFound);
}
MethodBinding[] compatible = new MethodBinding[methods.length];
int compatibleIndex = 0;
for (int i = 0, length = methods.length; i < length; i++) {
MethodBinding compatibleMethod = computeCompatibleMethod(methods[i], argumentTypes, invocationSite);
if (compatibleMethod != null)
compatible[compatibleIndex++] = compatibleMethod;
}
if (compatibleIndex == 0)
return new ProblemMethodBinding(TypeConstants.INIT, argumentTypes, ProblemReasons.NotFound); // need a more descriptive error... cannot convert from X to Y
MethodBinding[] visible = new MethodBinding[compatibleIndex];
int visibleIndex = 0;
for (int i = 0; i < compatibleIndex; i++) {
MethodBinding method = compatible[i];
if (canBeSeenByForCodeSnippet(method, receiverType, invocationSite, this)) {
visible[visibleIndex++] = method;
}
}
if (visibleIndex == 1) {
return visible[0];
}
if (visibleIndex == 0) {
return new ProblemMethodBinding(compatible[0], TypeConstants.INIT, compatible[0].parameters, ProblemReasons.NotVisible);
}
return mostSpecificClassMethodBinding(visible, visibleIndex, invocationSite);
}