The following program generates a spurious error message:
class Foo<X extends Number&NonExistentClass> {
<X> Foo<X> m() { return null;}
Foo<?> f = m();
}
error:
TestX.java:2: cannot find symbol
class Foo<X extends Number&NonExistentClass> {
^
symbol: class NonExistentClass
TestX.java:4: type parameter ? is not within its bound
Foo<?> f = m();
^
TestX.java:4: type parameters of <X>Foo<X> cannot be determined; no unique maximal instance exists for type variable X with upper bounds <any>,Object
Foo<?> f = m();
^
where X is a type-variable:
X extends Object declared in method <X>m()
3 errors
The problematic line is this:
"instance exists for type variable X with upper bounds <any>,Object"
an erroneous type is spilling into the error message.