The following program compiles without error. An error is expected.
public class Test {
interface I<T extends Class<S>, S> {}
<T extends Class<?>> void test() {
I<T,?> val;
}
}
Specifically, the type 'I<T,?>' is malformed, and so should produce an error (JLS 4.5).
"When subjected to capture conversion"
--> 'I<T,CAP>'
"each type argument Xi is a subtype of" its bound
--> T <: Class<CAP>
Because T has upper bound Class<?>, it is not a subtype of Class<CAP> -- in fact, there exists no type Foo such that T <: Class<Foo>.
(Some aspects of type variables with wildcard-parameterized bounds are under-specified, but in this case, the definition of subtyping is clear.)
This appears to be longstanding behavior, probably since Java SE 5.