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

NoSuchMethodError for varargs when type parameter extends interface

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.7, 2.4.0-beta-3
    • Fix Version/s: 2.5.6, 3.0.0-beta-1
    • Component/s: Static compilation
    • Labels:
      None

      Description

      Java code

      public class Foo<T extends java.io.Serializable> {
          public void bar(T... args) {}
      }
      

      Groovy code

      @groovy.transform.CompileStatic
      void test() {
          new Foo<String>().bar("a")
      }
      test()
      

      Error message

      Caught: java.lang.NoSuchMethodError: Foo.bar([Ljava/lang/Object;)V
      java.lang.NoSuchMethodError: Foo.bar([Ljava/lang/Object;)V
              at test.test(test.groovy:3)
              at test.run(test.groovy:5)
      

      This happens for these two conditions.
      1. Foo is a separate class and is not an inner class of the Groovy code
      2. T extends interface

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                paulk Paul King
                Reporter:
                yukoba Yu Kobayashi
              • Votes:
                0 Vote for this issue
                Watchers:
                3 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 - 20m
                  20m