mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 11:50:54 +07:00
revert new inference: mark erased for type params/raw types compatibility (IDEA-126379)
This commit is contained in:
@@ -75,8 +75,6 @@ public class TypeCompatibilityConstraint implements ConstraintFormula {
|
||||
if (sSubstitutor != null && PsiUtil.isRawSubstitutor(tClass, sSubstitutor)) {
|
||||
return true;
|
||||
}
|
||||
//comment in 18.2.2. Type Compatibility Constraints
|
||||
if (tClass instanceof PsiTypeParameter && ((PsiClassType)s).isRaw()) return true;
|
||||
}
|
||||
}
|
||||
else if (t instanceof PsiArrayType && t.getArrayDimensions() == s.getArrayDimensions()) {
|
||||
|
||||
@@ -7,7 +7,11 @@ class Foo<T> {
|
||||
List<Foo> elements = getElements(parent);
|
||||
|
||||
|
||||
for (<error descr="Incompatible types. Found: 'java.lang.Object', required: 'Foo'">Foo foo : getElements(parent)</error>) {
|
||||
/*for (Foo foo : getElements(parent)) {
|
||||
System.out.println(foo);
|
||||
}*/
|
||||
|
||||
for (Foo foo : getElementsArray(parent)) {
|
||||
System.out.println(foo);
|
||||
}
|
||||
}
|
||||
@@ -15,4 +19,8 @@ class Foo<T> {
|
||||
public static <E extends Foo<E>> List<E> getElements(E parent) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public static <E extends Foo<E>> E[] getElementsArray(E parent) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import java.util.*;
|
||||
|
||||
class Test {
|
||||
protected Class[] getAllInterfaces(final Set<Class> interfaces, final Class[] classes) {
|
||||
return interfaces.toArray(classes);
|
||||
}
|
||||
public static <T extends Collection<String>> T get(T out) {
|
||||
return out;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Set<String> set = get(new HashSet());
|
||||
}
|
||||
}
|
||||
@@ -184,6 +184,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testRawTypeFromParentArrayType() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user