[java-incomplete-model] Assume that any unresolved class-type is assignable to java.lang.Object

Partially improves inference in incomplete mode

GitOrigin-RevId: 1d9c7c75afd524ea02980be8f96c19fba1eaaf54
This commit is contained in:
Tagir Valeev
2024-06-24 10:56:00 +02:00
committed by intellij-monorepo-bot
parent 5835df8dd6
commit 838cf2d73c
17 changed files with 26 additions and 45 deletions

View File

@@ -1,14 +0,0 @@
// "Cast argument to 'Map<Foo, Bar>'" "true-preview"
import java.util.*;
class X {
void run(Foo single) {}
void run(Map<Foo, Bar> map) {}
void test(Bar bar) {
run((Map<Foo, Bar>) Collections.singletonMap(getFoo(), bar));
}
native Foo getFoo();
}

View File

@@ -1,14 +0,0 @@
// "Cast argument to 'Map<Foo, Bar>'" "true-preview"
import java.util.*;
class X {
void run(Foo single) {}
void run(Map<Foo, Bar> map) {}
void test(Bar bar) {
run((Map<Foo, Bar>) Collections.singletonMap(getFoo(), bar));
}
native Foo getFoo();
}

View File

@@ -1,4 +1,4 @@
// "Cast argument to 'Map<Foo, Bar>'" "true-preview"
// "Cast argument to 'Map<Foo, Bar>'" "false"
import java.util.*;

View File

@@ -1,4 +1,4 @@
// "Cast argument to 'Map<Foo, Bar>'" "true-preview"
// "Cast argument to 'Map<Foo, Bar>'" "false"
import java.util.*;

View File

@@ -6,7 +6,7 @@ public class Test {
public static void main(String[] args) {
for (String module : args) {
VirtualFile[] sourceRoots = foo(module);
Arrays.stream(sourceRoots).forEach((VirtualFile sourceRoot) -> sourceRoot.substring());
Arrays.stream(sourceRoots).forEach(sourceRoot -> sourceRoot.substring());
}
}
}

View File

@@ -115,7 +115,7 @@ public class Main {
// Unresolved reference
void f(Collection<? extends Foo> c) {
R treeSet = new TreeSet();
TreeSet treeSet = new TreeSet();
for (Foo foo : c) {
treeSet.add(foo);
}