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

@TypeChecked type inference does not work with closure

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0-rc-1
    • 2.0-rc-3
    • Static Type Checker
    • None

    Description

      The following code when annotated with @TypeChecked:

      List<Integer> foo = [1, 2, 3]
      Integer bar = foo.find { it == 2 }
      ^
      

      Will not compile with the error message:
      Groovy:[Static type checking] - Cannot assign value of type java.lang.Object
      to variable of type java.lang.Integer on the second line.

      Attachments

        Activity

          People

            melix Cédric Champeau
            rgarcia Renato Garcia
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: