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

Category methods are not inherited

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6-rc-2, 1.6-rc-3
    • 1.6.1, 1.7-beta-1
    • None
    • None
    • JDK 1.6, Windows

    Description

      see the example:

      public class Foo {
        static Object foo(Object obj) {
          println "Foo.foo()"
          return obj;
        }
      }
      
      public class Bar extends Foo{
        static Object bar(Object obj) {
          println "Bar.bar()"
          return obj;
        }
      }
      
      def obj = new Object()
      
      use(Foo){
        obj.foo()
      }
      
      use(Bar){
        obj.bar()
        obj.foo() // Caught: groovy.lang.MissingMethodException: 
      }
      

      Exception

      Caught: groovy.lang.MissingMethodException: No signature of method: java.lang.Object.foo() is applicable for argument types: () values: []
      	at test$_run_closure2.doCall(test.groovy:10)
      	at test$_run_closure2.doCall(test.groovy)
      	at test.run(test.groovy:8)
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            blackdrag Jochen Theodorou
            mingfai Mingfai Ma
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment