I have read this, and it should solve my problem, but I still get a Confusing argument '(Class<?>[])null', unclear if a varargs or non-varargs call is desired
warning here, in both cases:
public class MultiArgument<T, E> implements Argument {
private final Argument[] args;
private final Class<T> type;
private final New<T, E> maker;
public MultiArgument(E enclosingInstance, Class<T> type, Argument... args) throws NoSuchMethodException {
this.type = type;
this.args = args;
this.maker = New.create(enclosingInstance, type,
(Class<?>[]) (ArrayUtils.<Argument, Class<?>>transform(args, Argument::getReturnType))); // here
New.create(null, null, (Class<?>[])null); // and even here.
}
...
}
New.create
:
public static <T, E> New<T, E> create(E enclosingInstance, Class<T> type, Class<?>... argTypes) throws NoSuchMethodException {
return new New<>((Class<E>) enclosingInstance.getClass(), enclosingInstance, type, argTypes);
}
And the full New.java, just in case: http://pastebin.com/rtCVkiGX