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

LambdaConversionException: Invalid receiver type not a subtype of implementation type interface

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 11.0.1
    • Fix Version/s: 12
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b23
    • Verification:
      Verified

      Description

      The stack trace is similar to JDK-8023558, JDK-8191655, and JDK-8207320, but the other issues are fixed and this one reproduces with 11.0.1+13.

      ```
      import java.util.Arrays;
      import java.util.List;

      abstract class A {}

      interface B {
        boolean g();
      }

      class C extends A implements B {
        public boolean g() {
          return true;
        }
      }

      class D<R extends A & B> {
        public long f(List<? extends R> xs) {
          return xs.stream().filter(B::g).count();
        }

        public static void main(String[] args) {
          long count = new D<C>().f(Arrays.asList(new C()));
          System.err.println(count);
        }
      }
      ```

      ```
      $ javac -fullversion
      javac full version "11.0.1+13"
      $ java D
      Exception in thread "main" java.lang.BootstrapMethodError: bootstrap method initialization exception
      at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:194)
      at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:307)
      at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:258)
      at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:248)
      at D.f(T.java:18)
      at D.main(T.java:22)
      Caused by: java.lang.invoke.LambdaConversionException: Invalid receiver type class A; not a subtype of implementation type interface B
      at java.base/java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:254)
      at java.base/java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:328)
      at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:127)
      ... 5 more
      ```

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vromero Vicente Arturo Romero Zaldivar
                Reporter:
                cushon Liam Miller-Cushon
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: