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

STC: cannot infer list or map type for method return

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5.15, 4.0.0-beta-1, 3.0.9
    • 4.0.0-beta-2, 3.0.20
    • Static Type Checker
    • None

    Description

      Follow up from GROOVY-6408, GROOVY-7106, GROOVY-7274, GROOVY-7468, GROOVY-8909, GROOVY-8961, GROOVY-9734, GROOVY-9844, GROOVY-9915

      Consider the following:

      @groovy.transform.TypeChecked
      Map<String, Object> m(Date date, String query, String source)
      {
        return [date: date, query: query, source: source]
      }
      

      STC emits error "Incompatible generic argument types. Cannot assign java.util.LinkedHashMap<java.lang.String, java.io.Serializable<? extends java.io.Serializable<java.util.Date>>> to: java.util.Map<java.lang.String, java.lang.Object>". It should be subject to same result type inference of assignment.

      Attachments

        Activity

          People

            emilles Eric Milles
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: