You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Marcin Grzejszczak (JIRA)" <ji...@apache.org> on 2017/01/17 12:15:26 UTC

[jira] [Created] (GROOVY-8055) @CompileStatic improperly orders parameter types

Marcin Grzejszczak created GROOVY-8055:
------------------------------------------

             Summary: @CompileStatic improperly orders parameter types
                 Key: GROOVY-8055
                 URL: https://issues.apache.org/jira/browse/GROOVY-8055
             Project: Groovy
          Issue Type: Bug
          Components: Static compilation
    Affects Versions: 2.4.8, 2.4.7
            Reporter: Marcin Grzejszczak


*Given* the following snippet

{code}
import groovy.transform.CompileStatic

@CompileStatic
class Foo {
void isEqualTo(Number number) { println "Number" }
void isEqualTo(Object number) { println "Object" }
}

@CompileStatic
class Runner {
void run() {
new Foo().isEqualTo(4)
}
}

new Runner().run()
{code}

*When* you try to run it 
*Then* you get the following exception

{code}
[Static type checking] - Reference to method is ambiguous. Cannot choose between [void Foo#isEqualTo(java.lang.Object), void Foo#isEqualTo(java.lang.Number)]
 at line: 13, column: 1
{code}

*And* you would expect the thing to compile properly



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)