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

Wrong cast for type parameter in generated stubs

    XMLWordPrintableJSON

Details

    Description

      Consider the following:

      abstract class A<T> {
        A(Class<T> t) {
        }
      }
      
      class C extends A<E> {
        C() {
          super(E) // stubgen: "super((Class<T>)null);"
        }
      }
      
      enum E {
      }
      

      When class C is used by java sources, the joint compiler / stub generator creates an error for the java source. I was only able to work around this by changing "Class<T>" to "Class" which is no longer type-safe. In the case of the example given in the comments of GROOVY-10122 where the type parameter T is the type of the constructor parameter, it would need to be changed to Object.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: