groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (GROOVY-8055) @CompileStatic improperly orders parameter types
Date Thu, 26 Jul 2018 04:39:09 GMT

     [ https://issues.apache.org/jira/browse/GROOVY-8055?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Paul King closed GROOVY-8055.
-----------------------------

> @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.7, 2.4.8
>            Reporter: Marcin Grzejszczak
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 2.6.0-alpha-4, 3.0.0-alpha-3, 2.5.0-rc-3
>
>
> *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
(v7.6.3#76005)

Mime
View raw message