[ https://issues.apache.org/jira/browse/GROOVY-7481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14608196#comment-14608196 ]
Paul King commented on GROOVY-7481: ----------------------------------- If you're not relying on duck-typing between those interface types, just cast to the one you are (probably) using, e.g.: {code} class MyCollection extends ArrayList { boolean addAll(Iterable items) { super.addAll(items) } boolean addAll(Collection items) { super.addAll(items?:[]) } } new MyCollection().addAll((Collection)null) {code} > Update to Groovy 2.4.3 breaks existing code > ------------------------------------------- > > Key: GROOVY-7481 > URL: https://issues.apache.org/jira/browse/GROOVY-7481 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime > Affects Versions: 2.4.3 > Reporter: Alexander Veit > > After update to Groovy 2.4.3 coll.addAll() fails for null values. > groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method > our.package.OurCollection#addAll. > Cannot resolve which method to invoke for [null] due to overlapping > prototypes between: > [interface java.util.Collection] > [interface java.lang.Iterable] > [interface java.util.Iterator] > at > groovy.lang.MetaClassImpl.chooseMostSpecificParams(MetaClassImpl.java:3238) > at > groovy.lang.MetaClassImpl.chooseMethodInternal(MetaClassImpl.java:3191) > at groovy.lang.MetaClassImpl.chooseMethod(MetaClassImpl.java:3134) > at > groovy.lang.MetaClassImpl.getMethodWithCachingInternal(MetaClassImpl.java:1325) > at groovy.lang.MetaClassImpl.createPojoCallSite(MetaClassImpl.java:3367) > at > org.codehaus.groovy.runtime.callsite.CallSiteArray.createPojoSite(CallSiteArray.java:129) > at > org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:163) > at > org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) > at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:110) > at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:122) > at test.run(test.groovy:62) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589) > at groovy.lang.GroovyShell.evaluate(GroovyShell.java:636) > ... -- This message was sent by Atlassian JIRA (v6.3.4#6332)