У меня есть ниже метод, который возвращает набор перечислимого, содержащий все элементы Types
:ява EnumSet, несовместимые типы: статистические выводы переменных Й имеют несовместимые границы
@Override
public EnumSet<?> groupTypes() {
return EnumSet.allOf(Types.class);
}
И Types
является enum
, как показано ниже:
public enum Types implements GroupType {
ASG;
}
интерфейс GroupType
является:
public interface GroupType extends NamedType {
}
NamedType
интерфейс:
public interface NamedType {
String name();
}
Когда компиляции, я получил ошибку ниже:
error: incompatible types: inference variable E has incompatible bounds
return EnumSet.allOf(Types.class);
^
equality constraints: Types
upper bounds: Enum<CAP#1>,Enum<E>
where E is a type-variable:
E extends Enum<E> declared in method <E>allOf(Class<E>)
where CAP#1 is a fresh type-variable:
CAP#1 extends Enum<CAP#1> from capture of ?