Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.5.0-beta-1
-
None
Description
Given a super type with a method that has a default argument:
@CompileStatic class SuperType { void sample(String string, Integer arg=0) {} }
And a subclass that extends the method, but omits the optional parameters:
@CompileStatic class SubType extends SuperType { @Override void sample(String string) {} }
Static type checking fails to pick which method to call in the following code:
@CompileStatic class BrokenMethods { public static void main(String[] args) { new SubType().sample('hi') } }
The error message is:
Reference to method is ambiguous. Cannot choose between [void codes.nom.broken.SubType#sample(java.lang.String), void codes.nom.broken.SubType#sample(java.lang.String)]