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

generic bounds ignored by type checking

    XMLWordPrintableJSON

Details

    Description

      class A{}
      class B{}
      
      @groovy.transform.CompileStatic
      class Helper<V extends A> {
                 public Helper(Closure<V> cl) {}
             }
      @groovy.transform.CompileStatic
             static <C extends B> void extensionMethod(Closure<C> cl) {
                 new Helper<C>(cl)
             }
      

      The example is inspired by the fix done for GROOVY-6657, not sure versions before are affected, since this kind of code failed before. So it might be seen as regression.

      Anyway, the code above should not compile, since Helper cannot extend A and B at the same time.

      Attachments

        Activity

          People

            Unassigned Unassigned
            blackdrag Jochen Theodorou
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: