Community
Participate
Working Groups
"----------\n"
);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=273787
public void test1453() {
this.runNegativeTest(
new String[] {
"X.java",
"class X<T extends Comparable<? extends T>> {\n" +
" public void test(T v) {\n" +
" if (v instanceof Integer) {\n" +
" Object obj = Long.valueOf(((Integer) v).longValue());\n" +
" }\n" +
" <U> void test2(Comparable<? extends U> v) {\n" +
"}"
},
"----------\n" +
"1. ERROR in X.java (at line 3)\n" +
" ^^^^^^^^^^^^^^^^^^^^\n" +
"Incompatible conditional operand types T and Integer\n" +
"2. ERROR in X.java (at line 4)\n" +
" ^^^^^^^^^^^^^\n" +
"Cannot cast from T to Integer\n" +
"3. ERROR in X.java (at line 8)\n" +
"Incompatible conditional operand types Comparable<capture#1-of ? extends U> and Integer\n" +
"4. ERROR in X.java (at line 9)\n" +
"Cannot cast from Comparable<capture#2-of ? extends U> to Integer\n" +
return !isCompatibleWith(otherType);
} else {
if (!isTypeVariable() && !otherType.isTypeVariable()) {
if (!isTypeVariable()) {
// check compatibility when otherType is a type variable
// Comparable<? extends U> is then not compatible with Integer
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=273787