[jira] [Created] (GROOVY-8787) Inconsistency in method selection with @CompileStatic

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (GROOVY-8787) Inconsistency in method selection with @CompileStatic

JIRA jira@apache.org
Daniil Ovchinnikov created GROOVY-8787:
------------------------------------------

             Summary: Inconsistency in method selection with @CompileStatic
                 Key: GROOVY-8787
                 URL: https://issues.apache.org/jira/browse/GROOVY-8787
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
    Affects Versions: 2.5.2, 2.4.15
            Reporter: Daniil Ovchinnikov


Running
{code:title=playground.groovy}
class A {
    void bar(String s) {
        println("A#bar(String)")
    }
}

class B extends A {
    void bar(Object o) {
        println("B#bar(Object)")
    }
}

//@groovy.transform.CompileStatic
void usage() {
    new B().bar("")
}
usage()
{code}
prints {{A#bar(String)}} which is correct.

And with uncommented {{@CompileStatic}}:
{noformat}
Cannot choose between [void B#bar(java.lang.Object), void A#bar(java.lang.String)]
{noformat}




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)