[ https://issues.apache.org/jira/browse/GROOVY-7420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14537389#comment-14537389 ]
ASF GitHub Bot commented on GROOVY-7420: ---------------------------------------- GitHub user fpavageau opened a pull request: https://github.com/apache/incubator-groovy/pull/10 GROOVY-7420 Add a failing test You can merge this pull request into a Git repository by running: $ git pull https://github.com/fpavageau/incubator-groovy GROOVY-7420 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-groovy/pull/10.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #10 ---- commit 78eefd25b6a544940423f1fe270ff026fced721c Author: Frank Pavageau <fpavag...@ekino.com> Date: 2015-05-10T20:40:17Z GROOVY-7420 Add a failing test ---- > Cannot choose between primitive and object variants of an overloaded method > --------------------------------------------------------------------------- > > Key: GROOVY-7420 > URL: https://issues.apache.org/jira/browse/GROOVY-7420 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker > Affects Versions: 2.4.3 > Reporter: Frank Pavageau > Assignee: Cédric Champeau > > The static type checked cannot choose which variant of a overloaded method > with both primitive and object parameters (e.g. {{long}} and {{Long}}) to use > when the actual type of the parameter is the object type (e.g. {{Long}}): > {code} > class A { > static String m(long p) { > "primitive" > } > static String m(Long p) { > "object" > } > } > Long l = 42L > A.m(l) > {code} > yields the following compilation error: > {noformat} > [Static type checking] - Reference to method is ambiguous. Cannot choose > between [java.lang.String A#m(java.lang.Long), java.lang.String A#m(long)] > {noformat} > The problem can be worked around by explicitely calling {{.longValue()}} on > the {{Long}}. -- This message was sent by Atlassian JIRA (v6.3.4#6332)