[
https://issues.apache.org/jira/browse/GROOVY-9367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17776267#comment-17776267
]
ASF GitHub Bot commented on GROOVY-9367:
----------------------------------------
asfgit closed pull request #1147: fix GROOVY-9367
URL: https://github.com/apache/groovy/pull/1147
> org.codehaus.groovy.runtime.MetaClassHelper#getClassWithNullAndWrapper should
> return NullObject when accept null
> ----------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-9367
> URL: https://issues.apache.org/jira/browse/GROOVY-9367
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Affects Versions: 2.5.6
> Reporter: XJ Chen
> Assignee: Eric Milles
> Priority: Major
> Time Spent: 2h 20m
> Remaining Estimate: 0h
>
> I have a extension class
> {code:java}
> class NumberExtension {
> static Integer plus(Integer self, NullObject right) {
> return self;
> }
> }
> {code}
> However
> {code:java}1 + null{code}
> will throw
> {code}
> Ambiguous method overloading for method java.lang.Integer#plus
> {code}
> Because
> org.codehaus.groovy.runtime.MetaClassHelper#getClassWithNullAndWrapper return
> null for null argument. Then
> org.codehaus.groovy.runtime.MetaClassHelper#calculateParameterDistance(java.lang.Class,
> org.codehaus.groovy.reflection.CachedClass) doesn't return 0 because null !=
> NullObject.class
--
This message was sent by Atlassian Jira
(v8.20.10#820010)