mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
new inference: reject partial computation
This commit is contained in:
+2
-2
@@ -1,8 +1,8 @@
|
||||
class IntStream {
|
||||
private void foo(IntStream s) {
|
||||
s.map<error descr="Ambiguous method call: both 'IntStream.map(IntUnaryOperator)' and 'IntStream.map(ObjIntFunction<Integer>)' match">(i -> 1 << i)</error>;
|
||||
s.map(i -> <error descr="Operator '<<' cannot be applied to 'int', '<lambda parameter>'">1 << i</error>);
|
||||
s.map<error descr="Ambiguous method call: both 'IntStream.map(IntUnaryOperator)' and 'IntStream.map(ObjIntFunction<Integer>)' match">(i -> 1)</error>;
|
||||
s.map<error descr="Ambiguous method call: both 'IntStream.map(IntUnaryOperator)' and 'IntStream.map(ObjIntFunction<Integer>)' match">(i -> i)</error>;
|
||||
s.map<error descr="Ambiguous method call: both 'IntStream.map(IntUnaryOperator)' and 'IntStream.map(ObjIntFunction<T>)' match">(i -> i)</error>;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ class ReturnTypeIncompatibility {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
call<error descr="Ambiguous method call: both 'ReturnTypeIncompatibility.call(I1<Integer>)' and 'ReturnTypeIncompatibility.call(I2<P>)' match">(i-> {return i;})</error>;
|
||||
call<error descr="Ambiguous method call: both 'ReturnTypeIncompatibility.call(I1<P>)' and 'ReturnTypeIncompatibility.call(I2<P>)' match">(i-> {return i;})</error>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.BinaryOperator;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collector;
|
||||
|
||||
class Stuff {
|
||||
public enum Type { A }
|
||||
private final int value;
|
||||
private final Type type;
|
||||
public Stuff(int value, Type type) {
|
||||
this.value = value;
|
||||
this.type = type;
|
||||
}
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
class FakeErrors {
|
||||
{
|
||||
|
||||
Collector<Stuff, ?, Map<Stuff.Type, Optional<Stuff>>> collector =
|
||||
groupingBy(Stuff::getType,
|
||||
reducing((d1, d2) -> {
|
||||
boolean b = d1.getValue() > d2.getValue();
|
||||
return d1;
|
||||
}));
|
||||
}
|
||||
|
||||
public static <T> Collector<T, ?, Optional<Stuff>> reducing(BinaryOperator<T> op) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T, K, A, D>
|
||||
Collector<T, ?, Map<K, D>> groupingBy(Function<? super T, ? extends K> classifier,
|
||||
Collector<? super T, A, D> downstream) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user