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

Method dispatch with overloaded methods for Java types doesn't choose the most specific method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.5.4
    • 1.5.5, 1.6-rc-2
    • bytecode
    • None

    Description

      the following test fails:


      import javax.swing.*

      interface ISub extends Action {}

      class Super extends AbstractAction {}
      class Sub extends AbstractAction implements ISub {}

      static String foo(Action x)

      { "super" }

      static String foo(ISub x)

      { "sub" }

      def result = [new Super(), new Sub()].collect

      { foo(it) }

      assert ["super","sub"] == result // result is ["super","super"]


      The special thing here is that Action is a Java interface. If you use
      a Groovy interface instead, all works fine.

      Attachments

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              codevise Dierk K├Ânig
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: