下面的 test() 方法中有 10 个方法, 你觉得哪些调用无法通过编译?
``` class MyRunableTest {
@FunctionalInterface
public interface Executor1 {
void execute(Runable1 command);
}
@FunctionalInterface
public interface Executor2 extends Executor{
void execute(Runnable command);
}
@FunctionalInterface
public interface Executor3 extends Executor2{
void execute(Runnable command);
}
public void setMy(Executor e){
}
public void setMy1(Executor1 e){
}
public void setMy2(Executor2 e){
}
@FunctionalInterface
public interface Runable1 extends Runnable{
}
@FunctionalInterface
public interface Runable2 extends Runable1{
}
public void test(){
setMy(Runnable::run);
setMy(Runable1::run);
setMy1(Runnable::run);
setMy1(Runable1::run);
setMy1(Runable2::run);
setMy2(Runnable::run);
setMy2(Runable1::run);
setMy2(new Executor3() {
@Override
public void execute(Runnable command) {
}
});
setMy2(new Executor() {
@Override
public void execute(Runnable command) {
}
});
setMy2(new Executor2() {
@Override
public void execute(Runnable command) {
}
});
}
}
``` |
|