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

Missing cast in method reference bridge leads to NoSuchMethodError

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 8, 8-repo-lambda
    • Fix Version/s: 8
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b82
    • Verification:
      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

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

              Dates

              Created:
              Updated:
              Resolved: