Intersection type and method ref bug ?

Remi Forax forax at
Wed Oct 24 10:05:38 UTC 2018

This bug was discovered by Francois Green when testing records, but the bug is independent of the record,
method reference and intersection type doesn't mix well.

public class RecordBadType {
  interface  I {}
  static abstract class C { }
  static class A extends C implements I { }
  static class B extends C implements I { }
  static String f(I i) { return null; }

  public static void main(String[] args) {
    Stream.of(new A(), new B())
      .map(RecordBadType::f)   // here the compiler should generate a bridge method no ?

this code compiles but you get a LambdaConversionException at runtime.


More information about the compiler-dev mailing list