mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-25 14:25:04 +07:00
inference: retrieve type from containing call if the corresponding method is not generics (IDEA-151443)
This commit is contained in:
+1
-1
@@ -29,7 +29,7 @@ public class ConcurrentCollectors {
|
||||
static <T, K, D, M1 extends Map<K, D>> C<T, M1> groupingBy(F<M1> f,
|
||||
C<T, D> c,
|
||||
BiConsumer<M1, T> consumer) {
|
||||
return new CImpl<><error descr="'CImpl(ConcurrentCollectors.F<R>, ConcurrentCollectors.BiConsumer<R,T>, ConcurrentCollectors.BiOp<R>)' in 'ConcurrentCollectors.CImpl' cannot be applied to '(ConcurrentCollectors.F<M1>, ConcurrentCollectors.BiConsumer<M1,T>, ConcurrentCollectors.BiOp<ConcurrentCollectors.ConcurrentMap<java.lang.Object,D>>)'">(f, consumer, arg(c.getOp()))</error>;
|
||||
return new CImpl<>(f, consumer, arg<error descr="'arg(ConcurrentCollectors.BiOp<V>)' in 'ConcurrentCollectors.Test3' cannot be applied to '(ConcurrentCollectors.BiOp<D>)'">(c.getOp())</error>);
|
||||
}
|
||||
|
||||
static <K, V, M2 extends ConcurrentMap<K, V>> BiOp<M2> arg(BiOp<V> op) {
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
class Main {
|
||||
|
||||
public static void main(String[] args) throws ExecutionException, InterruptedException {
|
||||
Foo foo = first().get();
|
||||
System.out.println(foo.getClass());
|
||||
}
|
||||
|
||||
static CompletableFuture<Foo> first() {
|
||||
return second().thenCompose(maybe -> maybe.map(bar -> CompletableFuture.completedFuture(new Foo()))
|
||||
.orElseGet(() -> CompletableFuture.completedFuture(new FooExt())));
|
||||
}
|
||||
|
||||
static CompletableFuture<Optional<Bar>> second() {
|
||||
return CompletableFuture.completedFuture(Optional.empty());
|
||||
}
|
||||
|
||||
|
||||
static void simplified(final Optional<CompletableFuture<Foo>> future) {
|
||||
future.orElseGet(() -> CompletableFuture.completedFuture(new FooExt()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Foo {
|
||||
}
|
||||
|
||||
class FooExt extends Foo {
|
||||
|
||||
}
|
||||
|
||||
class Bar {
|
||||
}
|
||||
Reference in New Issue
Block a user