mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
subtyping constraint: accept array types if left type is assignable from array, e.g Serializable (IDEA-146592)
This commit is contained in:
+5
-1
@@ -105,9 +105,13 @@ public class StrictSubtypingConstraint implements ConstraintFormula {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (myS instanceof PsiClassType) {
|
||||
}
|
||||
else if (myS instanceof PsiClassType) {
|
||||
SResult = ((PsiClassType)myS).resolveGenerics();
|
||||
}
|
||||
else if (myS instanceof PsiArrayType) {
|
||||
return myT.isAssignableFrom(myS);
|
||||
}
|
||||
|
||||
if (SResult == null) return false;
|
||||
PsiClass SClass = SResult.getElement();
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
class Test {
|
||||
public void serialize(Serializable o) {}
|
||||
|
||||
public void foo(List<String> strings) {
|
||||
serialize(strings.toArray(new String[0]));
|
||||
}
|
||||
}
|
||||
+4
@@ -307,6 +307,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testArrayTypeAssignability() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user