Код: Выделить всё
interface SelfReferringInterface {
}
Код: Выделить всё
class RestrictingType implements SelfReferringInterface {
}
Код: Выделить всё
class Wrapper {
}
Код: Выделить всё
public class Main {
public static void main(String... args) {
// This type checks
SelfReferringInterface test1;
// This too
RestrictingType test2;
// And this
Wrapper test3;
// This fails
Wrapper> test5;
}
}
Код: Выделить всё
Main.java:23: error: type argument RestrictingType is not within bounds of type-variable T
Wrapper выходит за пределы T? И почему функционал схож? расширяет RestrictingType, нет проблем?
Подробнее здесь: [url]https://stackoverflow.com/questions/58400299/why-is-a-wild-card-type-argument-not-within-bounds-in-wrapper-around-a-selfrefer[/url]