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

@CompileStatic incorrectly infers generic return type

    XMLWordPrintableJSON

Details

    Description

      class Test {
          @groovy.transform.CompileStatic
          public <X extends Test> X castToMe(Class<X> type, Object o) {
              return type.cast(o);
          }
      }
      

      This compiles in Java, but not in Groovy

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            ddimitrov Dimitar Dimitrov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: