mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-25 14:25:04 +07:00
old inference: include type parameter's bounds in result as intersection if inference from parent type was started (IDEA-153411)
This commit is contained in:
+1
-1
@@ -3,5 +3,5 @@ class Neg06 {
|
||||
static class CSuperFoo<X> {}
|
||||
static class CFoo<X extends Number> extends CSuperFoo<X> {}
|
||||
|
||||
CSuperFoo<String> csf1 = new CFoo<<error descr="Type parameter 'java.lang.String' is not within its bound; should extend 'java.lang.Number'"></error>>();
|
||||
<error descr="Incompatible types. Found: 'Neg06.CFoo<java.lang.String>', required: 'Neg06.CSuperFoo<java.lang.String>'">CSuperFoo<String> csf1 = new CFoo<>();</error>
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import java.util.Map;
|
||||
class Test {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Map<Integer, Object> map = <error descr="Inferred type 'java.lang.Object' for type parameter 'V' is not within its bound; should implement 'java.lang.Comparable'">make()</error>;
|
||||
<error descr="Incompatible types. Found: 'java.util.Map<java.lang.Integer,java.lang.Comparable>', required: 'java.util.Map<java.lang.Integer,java.lang.Object>'">Map<Integer, Object> map = make();</error>
|
||||
}
|
||||
|
||||
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
class Main {
|
||||
<T extends Runnable> List<T> foo(T t) {
|
||||
t.run();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
<T extends Serializable> void m(Object[] obj) {
|
||||
List<?> r1 = foo(null);
|
||||
List<? extends Serializable> r2 = foo(null);
|
||||
List<? super String> r3 = foo<error descr="'foo(? super java.lang.String & java.lang.Runnable)' in 'Main' cannot be applied to '()'">( )</error>;
|
||||
List<? extends Runnable> r4 = foo(null);
|
||||
}
|
||||
}
|
||||
|
||||
class Main2 {
|
||||
<T extends Serializable> List<T> foo(Class<T> c, String b, Object ... a) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
<T extends Serializable> List<T> foo(String b, Object ... a) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
<T extends Serializable> void m(Object[] obj) {
|
||||
List r1 = foo("", obj);
|
||||
List<T> r2 = foo("", obj);
|
||||
List<?> r3 = foo("", obj);
|
||||
<error descr="Incompatible types. Found: 'java.util.List<java.io.Serializable>', required: 'java.util.List<java.lang.Object>'">List<Object> r4 = foo("", obj);</error>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user