mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 00:11:26 +07:00
switch tests on new inference
(cherry picked from commit d2cbf3f2833104c3a0381059b0d6ef8ac0b3c94c)
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
class Collector<C> {
|
||||
}
|
||||
|
||||
interface Function<T, R> {
|
||||
R apply(T t);
|
||||
}
|
||||
|
||||
public final class Collectors {
|
||||
public static <T>
|
||||
Collector<List<T>> toList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static <T1, K1> Collector<Map<K1, List<T1>>> groupingBy(Function<T1, K1> classifier) {
|
||||
return groupingBy(classifier, toList());
|
||||
}
|
||||
|
||||
public static <T, K, D> Collector<Map<K, D>> groupingBy(Function<T, K> classifier,
|
||||
Collector<D> downstream) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
class Collector<C> {
|
||||
}
|
||||
|
||||
interface S<T> {
|
||||
|
||||
/**
|
||||
* Gets a result.
|
||||
*
|
||||
* @return a result
|
||||
*/
|
||||
T get();
|
||||
}
|
||||
|
||||
|
||||
interface F<TF> {}
|
||||
|
||||
public final class Collectors {
|
||||
public static <T>
|
||||
Collector<List<T>> toList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static <K1> Collector<ArrayList<K1>> groupingBy(F<K1> classifier) {
|
||||
return groupingBy(classifier, ArrayList ::new);
|
||||
}
|
||||
|
||||
public static <K, M extends ArrayList<K>>
|
||||
Collector<M> groupingBy(F<K> classifier,
|
||||
S<M> mapFactory) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
|
||||
|
||||
|
||||
|
||||
class BBB {
|
||||
|
||||
static <T> void f() {
|
||||
TerminalOp<T, LinkedHashSet<T>> <warning descr="Variable 'reduceOp' is never used">reduceOp</warning> = BBB.<T, LinkedHashSet<T>>makeRef(LinkedHashSet::new, LinkedHashSet::add, LinkedHashSet::addAll);
|
||||
}
|
||||
|
||||
public static <T, U> TerminalOp<T, U> makeRef(U <warning descr="Parameter 'seed' is never used">seed</warning>, BiFunction<U, ? super T, U> <warning descr="Parameter 'reducer' is never used">reducer</warning>, BinaryOperator<U> <warning descr="Parameter 'combiner' is never used">combiner</warning>) {
|
||||
return null;
|
||||
}
|
||||
public static <T, R> TerminalOp<T, R> makeRef(Supplier<R> <warning descr="Parameter 'seedFactory' is never used">seedFactory</warning>, BiConsumer<R, ? super T> <warning descr="Parameter 'accumulator' is never used">accumulator</warning>, BiConsumer<R,R> <warning descr="Parameter 'reducer' is never used">reducer</warning>) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
f();
|
||||
}
|
||||
}
|
||||
interface Supplier<T> {
|
||||
|
||||
T get();
|
||||
}
|
||||
interface BiFunction<T, U, R> {
|
||||
R apply(T t, U u);
|
||||
}
|
||||
|
||||
interface BinaryOperator<T> extends BiFunction<T,T,T> {}
|
||||
interface BiConsumer<T, U> {
|
||||
void accept(T t, U u);
|
||||
}
|
||||
interface TerminalOp<<warning descr="Type parameter 'E_IN' is never used">E_IN</warning>, <warning descr="Type parameter 'R' is never used">R</warning>> {}
|
||||
class LinkedHashSet<E> extends HashSet<E>{
|
||||
public LinkedHashSet(int <warning descr="Parameter 'initialCapacity' is never used">initialCapacity</warning>, float <warning descr="Parameter 'loadFactor' is never used">loadFactor</warning>) {
|
||||
}
|
||||
|
||||
|
||||
public LinkedHashSet(int <warning descr="Parameter 'initialCapacity' is never used">initialCapacity</warning>) {
|
||||
}
|
||||
|
||||
public LinkedHashSet() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class HashSet<E> extends AbstractSet<E> {
|
||||
public HashSet() {
|
||||
}
|
||||
|
||||
public HashSet(int <warning descr="Parameter 'initialCapacity' is never used">initialCapacity</warning>, float <warning descr="Parameter 'loadFactor' is never used">loadFactor</warning>) {
|
||||
}
|
||||
|
||||
public HashSet(int <warning descr="Parameter 'initialCapacity' is never used">initialCapacity</warning>) {
|
||||
}
|
||||
HashSet(int <warning descr="Parameter 'initialCapacity' is never used">initialCapacity</warning>, float <warning descr="Parameter 'loadFactor' is never used">loadFactor</warning>, boolean <warning descr="Parameter 'dummy' is never used">dummy</warning>) {
|
||||
}
|
||||
|
||||
public boolean add(E e) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
abstract class AbstractSet<E> extends AbstractCollection<E> {
|
||||
/**
|
||||
* Sole constructor. (For invocation by subclass constructors, typically
|
||||
* implicit.)
|
||||
*/
|
||||
protected AbstractSet() {
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AbstractCollection<E> implements Collection<E> {
|
||||
public boolean add(E e) {
|
||||
return true;
|
||||
}
|
||||
public boolean addAll(Collection<? extends E> <warning descr="Parameter 'c' is never used">c</warning>) {
|
||||
boolean modified = false;
|
||||
return modified;
|
||||
}
|
||||
}
|
||||
|
||||
interface Collection<<warning descr="Type parameter 'E' is never used">E</warning>> {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
public class Test<A,B> {
|
||||
public static <P,Q> Test<P,Q> left(P p) { return null; }
|
||||
public static <P,Q> Test<P,Q> right(Q q) { return null; }
|
||||
public <C> C either(Function<A, C> leftFn, Function<B, C> rightFn){ return null; }
|
||||
public Test<B,A> swap() {
|
||||
return either(Test::<B,A>right, Test::<B,A>left);
|
||||
}
|
||||
}
|
||||
|
||||
interface Function<T, R> {
|
||||
R fun(T t);
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
public abstract class Tmp<T> {
|
||||
private String concat(Tmp<String> tmp) {
|
||||
return tmp.collect(StringBuilder::new, StringBuilder::append, StringBuilder::append).toString();
|
||||
}
|
||||
|
||||
abstract <R> R collect(Supplier<R> supplier,
|
||||
BiConsumer<R, ? super T> accumulator,
|
||||
BiConsumer<R, R> combiner);
|
||||
|
||||
interface Supplier<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface BiConsumer<T, U> {
|
||||
void accept(T t, U u);
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
public class Tmp
|
||||
{
|
||||
void foo(){}
|
||||
|
||||
void foo(Object... <warning descr="Parameter 'args' is never used">args</warning>){}
|
||||
|
||||
Runnable r = this::foo;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
interface Eff<A, B> {
|
||||
B f(A a);
|
||||
}
|
||||
|
||||
class Disfunction {
|
||||
public static <A, B> Eff<A, B> vary(final Eff<? super A, ? extends B> f) {
|
||||
return a -> f.f(a);
|
||||
}
|
||||
|
||||
public static <C, A extends C, B, D extends B> Eff<Eff<C, D>, Eff<A, B>> vary() {
|
||||
return Disfunction::<A, B>vary;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
class Test22 {
|
||||
static <U> Iterable<U> map(Mapper<String, U> mapper) {
|
||||
return null;
|
||||
}
|
||||
|
||||
static void test() {
|
||||
Iterable<Integer> map = <error>map(Test22 ::length)</error>;
|
||||
}
|
||||
|
||||
public static <T> int length(String s) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
interface Mapper<T, U> {
|
||||
U map(T t);
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
interface BiFun<T, U, R> {
|
||||
R aly(T t, U u);
|
||||
}
|
||||
|
||||
class Test {
|
||||
public static <A, B> void foo() {
|
||||
BiFun<? super A, ? super B, ? extends Pair<A, B>> p = Pair::new;
|
||||
BiFun<? super A, ? super B, ? extends Pair<A, B>> p1 = Pair::create;
|
||||
}
|
||||
|
||||
private static class Pair<A, B> {
|
||||
private final A a;
|
||||
private final B b;
|
||||
|
||||
protected Pair(A a, B b) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
static <M, N> Pair<M, N> create (M m, N n) {return null;}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user