mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
static factory detection for top level method call (IDEA-172566)
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class Collectinator<T, A, R> {
|
||||
|
||||
private Collectinator(Collector<T, A, R> collector) { }
|
||||
|
||||
{
|
||||
|
||||
Collectinator<Foo, ?, Optional<Foo>> lastDate =
|
||||
new Collectinator<>(Collectors.maxBy(Foo::compareTo));
|
||||
|
||||
}
|
||||
|
||||
static class Bar {}
|
||||
static class Foo extends Bar{
|
||||
public int compareTo(Bar other) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -9,15 +9,14 @@ inference variable K has incompatible bounds:
|
||||
lower bounds: Holder">Result.create(h);</error>
|
||||
|
||||
Holder dataHolder = null;
|
||||
Result<String> r3 = new Result<error descr="Cannot infer arguments"><></error>(new Holder<error descr="Cannot infer arguments"><></error>(dataHolder));
|
||||
Result<String> r3 = new Result<error descr="Cannot infer arguments"><></error>(new Holder<>(dataHolder));
|
||||
Result<String> r4 = <error descr="Incompatible types. Required Result<String> but 'create' was inferred to Result<K>:
|
||||
no instance(s) of type variable(s) exist so that Holder conforms to String
|
||||
inference variable K has incompatible bounds:
|
||||
equality constraints: String
|
||||
lower bounds: Holder">Result.create(new Holder<>(dataHolder));</error>
|
||||
|
||||
Result<String> r5 = new Result<error descr="Cannot infer arguments"><></error>(<error descr="Incompatible types. Required D but 'create' was inferred to Holder<M>:
|
||||
Incompatible types: Holder is not convertible to D">Holder.create(dataHolder)</error>);
|
||||
Result<String> r5 = new Result<error descr="Cannot infer arguments"><></error>(Holder.create(dataHolder));
|
||||
Result<String> r6 = <error descr="Incompatible types. Required Result<String> but 'create' was inferred to Result<K>:
|
||||
no instance(s) of type variable(s) exist so that Holder conforms to String
|
||||
inference variable K has incompatible bounds:
|
||||
|
||||
+1
-2
@@ -29,8 +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="Cannot infer arguments"><></error>(f, consumer, <error descr="Incompatible types. Required BiOp<R> but 'arg' was inferred to BiOp<M2>:
|
||||
no instance(s) of type variable(s) K, V exist so that R conforms to ConcurrentMap<K, V>">arg(c.getOp())</error>);
|
||||
return new CImpl<error descr="Cannot infer arguments"><></error>(f, consumer, arg(c.getOp()));
|
||||
}
|
||||
|
||||
static <K, V, M2 extends ConcurrentMap<K, V>> BiOp<M2> arg(BiOp<V> op) {
|
||||
|
||||
Reference in New Issue
Block a user