Ich kann nicht verstehen, warum die Methode2 nicht kompiliert, während Methode1 kompiliert. Ich bin mit Eclipse mit JavaSE 1.7 und ich bekam die folgende Fehlermeldung auf method2:Warum erweitert <T Enum <T> & SomeInterface> kompilieren, aber nicht <T erweitert SomeInterface & Enum <T>>?
Multiple markers at this line
The type Enum<T> is not an interface; it cannot be specified as a bounded parameter
Bound mismatch: The type T is not a valid substitute for the bounded parameter <E extends Enum<E>> of the type Enum<E>
public class Test {
public interface SomeInterface {
}
public static <T extends Enum<T> & SomeInterface> T method1() {
return null;
}
public static <T extends SomeInterface & Enum<T>> T method2() {
return null;
}
}
von Sekunden geschlagen. * Skeet! * \ * Schüttelt die Faust * – Radiodef