import java.io.IOException; class Test { interface F { void m() throws T; } void m1() { } void m2() throws NullPointerException{ } void m3() throws IOException { } void foo(F f) throws K { } { foo(()->{}); foo(()->{throw new NullPointerException();}); foo(this::m1); foo(this::m2); foo(this::m3); } }