小编use*_*552的帖子

泛型函数调用不在java 8中编译扩展多个接口

运行Java 1.8 JavaSE-1.8(jdk1.8.0_20)

这个班:

public class SimpleQuestion {

    public static void main(String[] args) {
        DoNothing();
        DoNothing2();
        DoNothing3();
        DoNothing4();
    }    

    public interface Interface1 {
        public void go();
    }

    public interface Interface2<X> {
        public X go2();
    }

    private static <X, T extends Interface2<X> & Interface1> void DoNothing() {
        return;
    }

    private static <X, T extends Interface2 & Interface1> void DoNothing2() {
        return;
    }

    private static <X, T extends Interface2<X>> void DoNothing3() {
        return;
    }

    private static <T extends Interface2<T> & Interface1> void …
Run Code Online (Sandbox Code Playgroud)

java eclipse generics multiple-inheritance java-8

8
推荐指数
1
解决办法
308
查看次数

标签 统计

eclipse ×1

generics ×1

java ×1

java-8 ×1

multiple-inheritance ×1