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

GroovyRowResult not assignable to Map<String, Object> with static type checker

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.5.13
    • Fix Version/s: None
    • Component/s: Static Type Checker
    • Labels:
      None

      Description

      I don't know when it started to happen, but it worked somewhere in the past.

      This code does not compile with 2.5.13:

       

      package test
      
      import groovy.sql.Sql
      import groovy.transform.CompileStatic
      
      @CompileStatic
      public class Test {
      
      	void foo() {
      		Map<String, Object> r = new Sql((Sql) null).firstRow("")
      	}
      }
      

      The error given is:

      Groovy:[Static type checking] - Incompatible generic argument types. Cannot assign groovy.sql.GroovyRowResult to: java.util.Map <String, Object>
      

      This is probably due to the fact that GroovyRowResult implements Map as a raw type, but IMHO Map<String, Object> should be the right generic interface for it, so perhaps an improvement can be made?

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mauromol Mauro Molinari
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: