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

error: incompatible types on Java stubs returning generics

    XMLWordPrintableJSON

Details

    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

      Attachments

        Activity

          People

            guillaume Guillaume Sauthier
            rgarcia Renato Garcia
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: