The following shows that javac is inconsistent in determining
which overriders are allowed:
class Box<T extends Number> {}
class T1 { // works
static class A {
void f(Box<?> box) {}
}
static class B extends A {
void f(Box<? extends Object> box) {}
}
}
class T2 { // works
static class A {
void f(Box<?> box) {}
}
static class B extends A {
void f(Box<? extends Number> box) {}
}
}
class T3 { // works
static class A {
void f(Box<? extends Object> box) {}
}
static class B extends A {
void f(Box<?> box) {}
}
}
class T4 { // works
static class A {
void f(Box<? extends Number> box) {}
}
static class B extends A {
void f(Box<?> box) {}
}
}
class T5 { // fails
static class A {
void f(Box<? extends Object> box) {}
}
static class B extends A {
void f(Box<? extends Number> box) {}
}
}