import java.util.function.Supplier; import java.io.IOException; interface A { } interface B extends A { } interface D { T foo() throws E; } class E { void bar(D d) { foobar(supplier(() -> { try { return d.foo(); } catch (RuntimeException e) { throw e; } })); foobar(supplier(() -> { return d.foo(); })); foobar(supplier(() -> d.foo())); foobar(supplier(d::foo)); foobar(supplier(() -> { throw new RuntimeException(); })); } Supplier supplier(Supplier s) { return s; } void foobar(Supplier s) { } } class Test { interface A { } interface B extends A { } interface D { T foo() throws IOException; } class E { void bar(D d) { foobar(supplier(() -> { try { return d.foo(); } catch (IOException e) { throw new RuntimeException(); } })); } Supplier supplier(Supplier s) { return s; } void foobar(Supplier s) { } } } class TestNoTypeParameterBounds { interface A { } interface B extends A { } interface D { T foo() throws E; } class E { void bar(D d) { foobar(supplier(() -> { try { return d.foo(); } catch (RuntimeException e) { throw e; } })); foobar(supplier(() -> { return d.foo(); })); foobar(supplier(() -> d.foo())); foobar(supplier(d::foo)); foobar(supplier(() -> { throw new RuntimeException(); })); } Supplier supplier(Supplier s) { return s; } void foobar(Supplier s) { } } }