captured wildcards: don't open unpredictably, treat as type, not type argument (IDEA-148348)

This commit is contained in:
Anna Kozlova
2015-11-26 19:23:09 +01:00
parent f7e9660f0d
commit e43fad4277
12 changed files with 63 additions and 25 deletions
@@ -22,8 +22,8 @@ class TestIDEA128101 {
construct(String.class, createPath(integerAttribute), createPath(stringAttribute));
construct1(String.class, createPath<error descr="'createPath(TestIDEA128101.Attribute<Y>)' in 'TestIDEA128101' cannot be applied to '(TestIDEA128101.Attribute<java.lang.Integer>)'">(integerAttribute)</error>, createPath(stringAttribute));
construct2(String.class, createPath(integerAttribute), createPath(stringAttribute));
<error descr="Type parameter K has incompatible upper bounds: Integer and String">construct3(String.class, createPath(integerAttribute), createPath(stringAttribute));</error>
<error descr="Type parameter K has incompatible upper bounds: Integer and String">construct4(String.class, createPath(integerAttribute), createPath(stringAttribute));</error>
construct3<error descr="'construct3(java.lang.Class<java.lang.String>, TestIDEA128101.Path<? super K>...)' in 'TestIDEA128101' cannot be applied to '(java.lang.Class<java.lang.String>, TestIDEA128101.Path<java.lang.Integer>, TestIDEA128101.Path<java.lang.String>)'">(String.class, createPath(integerAttribute), createPath(stringAttribute))</error>;
construct4<error descr="'construct4(java.lang.Class<java.lang.String>, TestIDEA128101.Path<? super K>, TestIDEA128101.Path<? super K>)' in 'TestIDEA128101' cannot be applied to '(java.lang.Class<java.lang.String>, TestIDEA128101.Path<java.lang.Integer>, TestIDEA128101.Path<java.lang.String>)'">(String.class, createPath(integerAttribute), createPath(stringAttribute))</error>;
}
}
@@ -34,7 +34,7 @@ class Test1111 {
}
public void test(I<?> i) {
bar<error descr="'bar(Test1111.I<? super A>)' in 'Test1111' cannot be applied to '(Test1111.I<capture<?>>)'">(i)</error>;
bar(i);
}
public static <A> void bar(I<? super A> i) {}
@@ -19,7 +19,7 @@ class Test {
public static <T> BigDecimal add(Collection<T> objectsThatHaveBigDecimals, Function<T, ? extends BigDecimal> functionToGet) {
return objectsThatHaveBigDecimals == null ? null : objectsThatHaveBigDecimals.stream().map(functionToGet).reduce(null, Test::add);
return objectsThatHaveBigDecimals == null ? null : objectsThatHaveBigDecimals.stream().map(functionToGet).reduce(null, <error descr="Bad return type in method reference: cannot convert java.math.BigDecimal to ? extends java.math.BigDecimal">Test::add</error>);
}
public static BigDecimal add(BigDecimal... sequence) {