mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-15 11:58:18 +07:00
Detect recursive type parameter definition when checking for assignability
Fixes EA-137370 - SOE: TypeConversionUtil.isNarrowingReferenceConversionAllowed
This commit is contained in:
+13
@@ -49,3 +49,16 @@ class TestNonNarrowingConversion<T extends Z> {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
class TestRecursiveTypeParameter {
|
||||
static <<error descr="Cyclic inheritance involving 'T'"></error>T extends T> void test(T t) {
|
||||
<error descr="Incompatible types. Found: 'T', required: 'java.lang.String'">String x = t;</error>
|
||||
<error descr="Incompatible types. Found: 'java.lang.String', required: 'T'">t = x</error>;
|
||||
}
|
||||
|
||||
static <<error descr="Cyclic inheritance involving 'A'"></error>A extends B, B extends A> void test(A a, B b) {
|
||||
a = b;
|
||||
b = a;
|
||||
<error descr="Incompatible types. Found: 'A', required: 'java.lang.String'">String x = a;</error>
|
||||
<error descr="Incompatible types. Found: 'java.lang.String', required: 'A'">a = x</error>;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user