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

Static type checking not strict enough in the presence of ambiguous method matching

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.4.8
    • Static Type Checker
    • None

    Description

      This example:

      import groovy.transform.CompileStatic
      
      interface FooA {}
      interface FooB {}
      class FooAB implements FooA, FooB {}
      @CompileStatic
      class TestGroovy {
          static void test() { println new TestGroovy().foo(new FooAB()) }
          def foo(FooB x) { 43 }
          def foo(FooA x) { 42 }
      }
      
      TestGroovy.test()
      

      Should probably throw some kind of ambiguous method error during compilation to match Java (and dynamic Groovy's runtime error).

      Attachments

        Issue Links

          Activity

            People

              jwagenleitner John Wagenleitner
              paulk Paul King
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: