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

STC: call to static method fails with incompatible generics error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5.14, 3.0.7, 4.0.0-alpha-2
    • 4.0.0-alpha-3, 3.0.9, 2.5.19
    • None
    • None

    Description

      Consider the following:

      @groovy.transform.CompileStatic
      class C {
        void m() {
          init(Collections.emptyList())
        }
        private static void init(List<String> strings) {
          print strings
        }
      }
      new C().m()
      

      Call to "init" is fails to match Collections.emptyList() to List<String>. If "init" is non-static, it works fine. Error displayed is:

      Static type checking] - Cannot call C#init(java.util.List <java.lang.String>) with arguments [java.util.List <T extends java.lang.Object>]
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h