Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8009154

Missing cast in method reference bridge leads to NoSuchMethodError

    XMLWordPrintable

Details

    • b82
    • Verified

    Description

      Something is wrong in the bridging logic for method reference:

      class Test {
          interface SAM<X> {
              void m(X ss, String s);
          }

          void m(String... s) { }

          public static void main(String[] args) {
              SAM<Test> st = Test::m;
              st.m(new Test(), "");
          }
      }


      This compiles but fails to execute:

      Exception in thread "main" java.lang.NoSuchMethodError: java.lang.Object.m([Ljava/lang/String;)V
      at Test.lambda$0$bridge(Test.java:78)
      at Test$$Lambda$1.m(Unknown Source)
      at Test.main(Test.java:79)

      Attachments

        Activity

          People

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: