1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| public class Test {
public interface I1 {
}
// Ca j'ai pas le droit
// The type A1 may not subclass Enum explicitly
public abstract class A1 extends Enum {
}
public interface I2<C extends Enum<C>> {
}
public enum E1 implements I1 {
TOTO
}
public enum E2 implements I2 {
TOTO
}
public enum E3
public void callWithEnum(Enum<?> enume) {
}
public void test() {
callWithEnum(E1.TOTO); // Ca j'ai le droit
}
public void callWithInterface(I1 i1, I2 i2) {
// Ca j'ai pas le droit parce que mon interface
// ne dis pas que ce sont des enums derriere
// The method callWithEnum(Enum<?>) in the type Test is not
// applicable for the arguments (Test.I1)
callWithEnum(i1);
// Idem
callWithEnum(i2);
}
} |