You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Lucian Chirita (JIRA)" <ji...@apache.org> on 2016/10/25 10:11:59 UTC
[jira] [Created] (GROOVY-7974) Null operation in addition fails
with Ambiguous method overloading despite cast
Lucian Chirita created GROOVY-7974:
--------------------------------------
Summary: 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
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.4#6332)