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

"Reference to method is ambiguous" reported for unambiguous usage of List implementors

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.1.1
    • 2.1.2
    • Static Type Checker
    • None

    Description

      For List implementors which extend Object, some methods (e.g., find) are considered ambiguous, although the List implementation should win.

      Test case:

      86 /tmp> >q.groovy
      class Mylist implements List {}
      @groovy.transform.TypeChecked class t {
         def whatthe(Mylist a) {
             a.find { true }
         }
      }
      87 /tmp> groovyc q.groovy
      
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      q.groovy: 4: [Static type checking] - Reference to method is ambiguous. Cannot choose between [java.lang.Object <T> java.util.Collection <T>#find(groovy.lang.Closure), java.lang.Object java.lang.Object#find(groovy.lang.Closure)]
      

      Attachments

        Activity

          People

            melix Cédric Champeau
            oc OC
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: