groovy
  1. groovy
  2. GROOVY-5439

error: incompatible types on Java stubs returning generics

    Details

    • Number of attachments :
      0

      Description

      The following class definition fails to compile the Java stubs:

      class GenericReturn {
          public <T extends List> T foo() {
              null
          }
      }
      

      Error:

      tmp/groovy-java-stubs/GenericReturn.java:16: error: incompatible types
      public <T extends java.util.List> T foo() { return (java.util.List)null;}
                                                         ^
        required: T
        found:    List
        where T is a type-variable:
          T extends List declared in method <T>foo()
      
      

      It compiles with no errors on 2.0-beta-2 and 1.8.6

        Activity

          People

          • Assignee:
            Guillaume Laforge
            Reporter:
            Renato Garcia
          • Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: