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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 10
    • None
    • tools
    • None
    • b33
    • generic
    • generic

      Unfinished leftover work from JDK-8058112.

      The following program crashes with
      LambdaConversionException: Invalid receiver type interface

      public class SortedInterfacesTest {
         <T> void forAll(Consumer<T> consumer, T... values) { }

         public void secondTest() {
             forAll(Picture::draw, new MyPicture(), new Universal());
         }

         interface Shape { void draw(); }
         interface Marker { }
         interface Picture { void draw(); }

         class MyShape implements Marker, Shape { public void draw() { } }
         class MyPicture implements Marker, Picture { public void draw() { } }
         class Universal implements Marker, Picture, Shape { public void draw() { } }

         public static void main(String[] args) {
             new SortedInterfacesTest().secondTest();
         }
      }

            sadayapalam Srikanth Adayapalam (Inactive)
            sadayapalam Srikanth Adayapalam (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: