Compiling the following program:
interface List<E> {}
class Test {
<T> void merge(List<T> l1, List<T> l2) {}
void test(List<? extends Test> list) {
merge(list, list);
}
}
produces the following bad output if the compatibility mode flag (-XDoldDiags) is set:
TestX.java:6: method merge in class Test cannot be applied to given types
merge(list, list);
^
required: List<T>,List<T>
found: List<capture#0 of ? extends Test>,List<capture#0 of ? extends Test>
1 error
That is, captured var indexes are not generated correctly.