mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 23:39:39 +07:00
new inference: avoid inferring partly raw types (in case of unchecked conversion resolve to eq/low bound or null if only upper is present) as these types won't be treated as wildcard parameterized ever (IDEA-150167)
This commit is contained in:
@@ -7,8 +7,8 @@ public class Sample {
|
||||
<B> B bar(G<B> gb) {return null;}
|
||||
|
||||
void f(G1 g1) {
|
||||
<error descr="Incompatible types. Found: 'java.lang.Object', required: 'Sample.G<java.lang.String>'">G<String> l11 = bar(g1);</error>
|
||||
<error descr="Incompatible types. Found: 'java.lang.Object', required: 'java.lang.String'">String l1 = bar(g1);</error>
|
||||
G<String> l11 = bar<error descr="'bar(Sample.G<B>)' in 'Sample' cannot be applied to '(Sample.G1)'">(g1)</error>;
|
||||
String l1 = bar<error descr="'bar(Sample.G<B>)' in 'Sample' cannot be applied to '(Sample.G1)'">(g1)</error>;
|
||||
Object o = bar(g1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
class Test2 {
|
||||
{
|
||||
System.out.println(Optional.of(new Either())
|
||||
.map(either -> Test2.foo(either))
|
||||
.orElse("Hello"));
|
||||
Optional.of(new Either())
|
||||
.map(either -> Test2.foo(either))
|
||||
.orElse("Hello");
|
||||
|
||||
System.out.println(Optional.of(new Either())
|
||||
.map(Test2::foo)
|
||||
.orElse("Hello"));
|
||||
Optional.of(new Either())
|
||||
.map(Test2::foo)
|
||||
.orElse("Hello");
|
||||
}
|
||||
|
||||
private static <X extends Exception, A> A foo(Either<X, A> either) throws X { return null; }
|
||||
}
|
||||
|
||||
class Either<L, R> { }
|
||||
@@ -4,7 +4,7 @@ import java.util.Set;
|
||||
abstract class Test {
|
||||
|
||||
public void foo(List list) {
|
||||
set<error descr="Ambiguous method call: both 'Test.set(Set<List>, List)' and 'Test.set(Set, List)' match">(get(), list)</error>;
|
||||
set<error descr="Ambiguous method call: both 'Test.set(Set<List>, List)' and 'Test.set(Set<Object>, List<?>)' match">(get(), list)</error>;
|
||||
}
|
||||
|
||||
abstract <Y> Set<Y> get();
|
||||
|
||||
Reference in New Issue
Block a user