Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2503 MOP 2.0 design inflluencing issues
  3. GROOVY-5136

Method selection misbehavior with category

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Information Provided
    • 1.8.4
    • None
    • groovy-runtime
    • None
    • Windows 7

    Description

      While using a category I stumbled upon the following misbehaviour:

      class SomeCategory {
          static def method(String self, def val) {
              self + val
          }
      }
      
      use(SomeCategory) {
          // should throw a MissingMethodException but calls method() with null as param
          assert "foo".method() == "foonull"
      }
      

      I expected a MissingMethodException because a parameterless method doesn't exist.

      Am I wrong?

      Attachments

        Activity

          People

            Unassigned Unassigned
            frady Frank Hardy
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: