[ 
https://issues.apache.org/jira/browse/GROOVY-7011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14979971#comment-14979971
 ] 

Jochen Theodorou commented on GROOVY-7011:
------------------------------------------

btw,  `MessageValue await(MessageValue<ICommand> pattern) { await '', pattern 
}` is imho never created

> Trait methods with default arguments do not work correctly
> ----------------------------------------------------------
>
>                 Key: GROOVY-7011
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7011
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.3.6
>         Environment: OSX 10.9, Java 1.7_67
>            Reporter: Aaron Long
>            Assignee: Cédric Champeau
>             Fix For: 2.3.10, 2.4.0-rc-1
>
>
> The following code:
> {code}
> trait HiSupport {
>    def sayHi(String msg = "hi") {
>        println msg
>    }
> }
> class A implements HiSupport { }
> new A().sayHi()
> {code}
> Produces incorrect results. The trait method is called without any 
> dispatching complaints, however it just ignores the default argument.
> If default arguments are not supported, it seems like it should be a compile 
> failure or at least a failure during dispatch.
> If the trait method has multiple arguments, the method dispatch does result 
> in a failure:
> {code}
> trait HiSupport {
>    def sayHi(String name, String msg = "hi") {
>        println msg + name
>    }
> }
> class A implements HiSupport { }
> new A().sayHi("Bob")
> {code}
> {code}
> groovy.lang.MissingMethodException: No signature of method: A.sayHi() is 
> applicable for argument types: (java.lang.String) values: [Bob]
> Possible solutions: sayHi(java.lang.String, java.lang.String), wait(), any(), 
> each(groovy.lang.Closure), asType(java.lang.Class), wait(long)
>       at ConsoleScript50.run(ConsoleScript50:9)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to