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

Paul King closed GROOVY-7974.
-----------------------------

> Null operation in addition fails with Ambiguous method overloading despite 
> cast
> -------------------------------------------------------------------------------
>
>                 Key: GROOVY-7974
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7974
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.7
>            Reporter: Lucian Chirita
>            Assignee: Jochen Theodorou
>         Attachments: A.groovy
>
>
> Doing something like 5 + (n as Number) where Object n = null fails with 
> {noformat}
> Ambiguous method overloading for method java.lang.Integer#plus.
> Cannot resolve which method to invoke for [null] due to overlapping 
> prototypes between:
>       [class java.lang.Character]
>       [class java.lang.String]
>       [class java.lang.Number]
> {noformat}
> A similar call works when you have a regular method overloaded for Character, 
> String and Number.
> Also, trying to do 5.plus(n as Number) fails with
> {noformat}
> java.lang.ClassCastException: 
> org.codehaus.groovy.runtime.wrappers.PojoWrapper cannot be cast to 
> java.lang.Number
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to