जावा चल रहा है का विस्तार 1.8 JavaSE-1.8 (jdk1.8.0_20)जेनेरिक्स समारोह कॉल जावा में संकलन नहीं 8 एकाधिक इंटरफेस
इस वर्ग:
:
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 DoNothing4() {
return;
}
}
संकलन त्रुटि देता है सरल क्वेशेशन प्रकार में विधि DoNothing() तर्क के लिए लागू नहीं है()
Wh y कि एक और नहीं कुछ नहीं 2,3, और 4?
यह ग्रहण में विफल रहता है। ओरेकल कंपाइलर मेरे लिए काम करता है। मैं बग रोता हूँ! –
हालांकि, यदि आप स्पष्ट रूप से प्रकार तर्क प्रदान करते हैं तो यह काम करता है। –
जावा 7 में मेरे लिए ठीक संकलित करता है; संभावित रूप से संकलक/आईडीई में एक बग आप – Krease