Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8854

MissingMethodException when a public method on a trait calls a static private one in a class hierarchy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.15, 3.0.0-alpha-3, 2.5.3
    • 5.0.0-alpha-2
    • None

    Description

      The following code fails at runtime:

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

      With this error:

      groovy.lang.MissingMethodException: No signature of method: Child.foo() is applicable for argument types: () values: []
      

      Keep in mind that the Trait method is framework-code (in this case from Grails) and DomainObject and Child classes are user-code.

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              ilopmar Iván López
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: