[ 
https://issues.apache.org/jira/browse/GROOVY-8405?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King closed GROOVY-8405.
-----------------------------

> Inherited methods with default parameters cause cause static compilation to 
> fail
> --------------------------------------------------------------------------------
>
>                 Key: GROOVY-8405
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8405
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.5.0-beta-1
>            Reporter: Nathan Harvey
>            Assignee: Daniel Sun
>            Priority: Minor
>             Fix For: 3.0.0-alpha-4, 2.5.3
>
>
> Given a super type with a method that has a default argument:
> {code}
> @CompileStatic
> class SuperType {
>       void sample(String string, Integer arg=0) {}
> }
> {code}
> And a subclass that extends the method, but omits the optional parameters:
> {code}
> @CompileStatic
> class SubType extends SuperType {
>       @Override
>       void sample(String string) {}
> }
> {code}
> Static type checking fails to pick which method to call in the following code:
> {code}
> @CompileStatic
> class BrokenMethods {
>       public static void main(String[] args) {
>               new SubType().sample('hi')
>       }
> }
> {code}
> The error message is:
> {code}
> 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)]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to