If no visible constructor is discovered, an error binding is answered.
*/
public MethodBinding getConstructor(ReferenceBinding receiverType, TypeBinding[] argumentTypes, InvocationSite invocationSite) {
MethodBinding methodBinding = receiverType.getExactConstructor(argumentTypes);
if (methodBinding != null) {
if (canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this)) {
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) {