You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Iván López (JIRA)" <ji...@apache.org> on 2018/10/23 07:18:00 UTC

[jira] [Created] (GROOVY-8854) MissingMethodException when a public method on a trait calls a static private one in a class hierarchy

Iván López created GROOVY-8854:
----------------------------------

             Summary: MissingMethodException when a public method on a trait calls a static private one in a class hierarchy
                 Key: GROOVY-8854
                 URL: https://issues.apache.org/jira/browse/GROOVY-8854
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 2.5.3, 2.4.15
            Reporter: Iván López


The following code fails at runtime:
{code:java}
trait Validateable {

    boolean validate() {
        return foo()
    }

    private static boolean foo() {
        return false
    }
}

class DomainObject implements Validateable {
    String name
}

class Child extends DomainObject {
}

def child = new Child(name: 'name')
child.validate()
{code}

With this error:
{code}
groovy.lang.MissingMethodException: No signature of method: Child.foo() is applicable for argument types: () values: []
{code}

Keep in mind that the Trait method is _framework-code_ (in this case from Grails) and {{DomainObject}} and {{Child}} classes are _user-code_.







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