Allow special case @Callback, accepting exactly one JsonArray parameter. In this case we pass on the parameters as-is for manual processing.

This commit is contained in:
Florian Nücke
2021-08-03 00:40:20 +02:00
parent d853cb0817
commit ecafd10e6f

View File

@@ -296,6 +296,14 @@ public final class RPCDeviceBusAdapter implements Steppable {
}
final RPCParameter[] parametersSpec = method.getParameters();
// Special case: if a method takes as exactly one parameter a JsonArray, we pass
// on the parameters as-is, without automatically trying to deserialize them.
if (parametersSpec.length == 1 && parametersSpec[0].getType() == JsonArray.class) {
invokeMethod(methodInvocation, isMainThread, method, new Object[]{methodInvocation.parameters});
return;
}
if (methodInvocation.parameters.size() != parametersSpec.length) {
if (canTrailingParametersBeImplicitlyNull(methodInvocation.parameters, parametersSpec)) {
fallbacks.add(method);