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

Error in @CompileStatic when method in both Interface and Superclass

    XMLWordPrintableJSON

Details

    Description

      This seems related to GROOVY-6751.

      This file:

      import javafx.collections.FXCollections
      import groovy.transform.CompileStatic
      
      @CompileStatic
      class DupMethod
      {
        javafx.collections.ObservableList<String> tags = FXCollections.observableArrayList("first")
      
        void foo()
        {
          tags.addAll("foo")
        }
      }
      

      gives the compilation error:
      $ groovyc dupmethod.groovy
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      dupmethod.groovy: 11: [Static type checking] - Reference to method is ambiguous. Cannot choose between [boolean java.util.Collection <T>#addAll(T[]), boolean javafx.collections.ObservableList <E extends java.lang.Object>#addAll(E[])]
      @ line 11, column 5.
      tags.addAll("foo")
      ^

      1 error

      I don't get this error when compiling with Groovy version 2.2.2.

      Attachments

        Issue Links

          Activity

            People

              melix Cédric Champeau
              ngalarneau Neil Galarneau
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: