You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2018/05/11 15:48:00 UTC

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

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

Daniel Sun resolved GROOVY-8055.
--------------------------------
       Resolution: Fixed
         Assignee: Daniel Sun
    Fix Version/s: 2.5.0-rc-3
                   3.0.0-alpha-3
                   2.6.0-alpha-4

Fixed by https://github.com/apache/groovy/commit/fc1b21fb1960191ba269fac7069bc677b14388ca

> @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)