inference: don't remember captured wildcard with non-proper bound (IDEA-180042)

later check could fail e.g. if bound was created inside one of nested session
This commit is contained in:
Anna.Kozlova
2017-10-17 17:03:11 +02:00
parent df2907a68e
commit 2658d37da0
2 changed files with 13 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
@@ -54,3 +55,13 @@ class TestWithNonProperTypeBeforeCapture {
return null;
}
}
class TestWithNonPropertTypeBeforeCaptureInMethodCall {
private <K, V> void test(Stream<Map.Entry<K, V>> stream, BiFunction<K, V, ?> entryMapper) {
stream.map(createToStringMapper(entryMapper));
}
private <K, V> Function<? super Map.Entry<K, V>, String> createToStringMapper(BiFunction<K, V, ?> mapper) {
return k -> toString();
}
}