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

Groovy 2.3.0-beta-2 generic type checking incorrect

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.0-beta-2
    • 2.3.1
    • None
    • None

    Description

      Type checking a returned value from a generic method does not type check in Groovy 2.3.0-beta-2, but does in Groovy 2.2.2. See the following gist:

      https://gist.github.com/mperry/10692600

      The output I get is:

      D:\repositories\groovy-2.3-experimental\docs\scripts>groovy setTypeChecking.groovy
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      D:\repositories\groovy-2.3-experimental\docs\scripts\setTypeChecking.groovy: 31:
      [Static type checking] - Cannot call <T> java.util.Set <java.util.List>#equals(java.util.Set <T>) with arguments [java.util.Set <java.util.List>]
      @ line 31, column 20.
      assertTrue(s == expected)
      ^

      D:\repositories\groovy-2.3-experimental\docs\scripts\setTypeChecking.groovy: 32:
      [Static type checking] - Cannot call <T> java.util.Set <java.util.List>#equals(java.util.Set <T>) with arguments [java.util.Set <java.util.List>]
      @ line 32, column 20.
      assertTrue(create([1, 2]) == expected)
      ^

      2 errors

      I am using Windows 7.

      Note that the other lines type check pass that appear to have similar types involved.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            mperry Mark Perry
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: