我已阅读this,它应该可以解决我的问题,但在这两种情况下我仍然会收到Confusing argument '(Class<?>[])null', unclear if a varargs or non-varargs call is desired
警告:
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);
}
完整的New.java,以防万一:http://pastebin.com/rtCVkiGX