ICOMM - Inaccessible Constructor Or Method Matches

Overload resolution only considers constructors and methods are visible at the point of the call. If however, all the constructors and methods were considered, there may be more matches. This rule is violated in this case.

Imagine that ClassB is in a different package than ClassA. Then the allocation of ClassB violates this rule since the second constructor is not visible at the point of the allocation, but it still matches the allocation (based on signature). Also the call to oper in ClassB violates this rule since the second and the third declarations of oper is not visible at the point of the call, but it still matches the call (based on signature).

Wrong

`public class ClassA {
public ClassA (int param) {}
ClassA (char param) {}
ClassA (short param) {}
public void oper (int param) {}
void oper (char param) {}
void oper (short param) {}
}`

Tip: Either give such methods or constructors equal visibility or change their signature.

Right

`public class ClassA {
ClassA (int param) {}
public ClassA (char param) {}
public ClassA (short param) {}
public void oper (int param) {}
void doOper (char param) {}
void doOper (short param) {}
}`