You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I discovered on my first usage of @RpcDefault that mobly-snippet-lib only has default type converters defined for the boxed types like Boolean, but not boolean. This ends up particularly confusing when writing snippets in Kotlin because Kotlin's "Boolean" is a JVM "boolean" primitive.
For example, the following naive Kotlin conversion of ex7_default_and_optional_rpc:
@Rpc(description = "Make a toast on screen.")
fun makeToast(
message: String, @RpcDefault("true") bool: Boolean, @RpcOptional number: Int): String {
will result in the following unless a value is provided for "bool":
java.lang.IllegalArgumentException: No predefined converter found for boolean
at com.google.android.mobly.snippet.rpc.MethodDescriptor.converterFor(MethodDescriptor.java:309)
at com.google.android.mobly.snippet.rpc.MethodDescriptor.getDefaultValue(MethodDescriptor.java:280)
at com.google.android.mobly.snippet.rpc.MethodDescriptor.invoke(MethodDescriptor.java:91)
at com.google.android.mobly.snippet.util.RpcUtil.invokeRpc(RpcUtil.java:131)
at com.google.android.mobly.snippet.util.RpcUtil.invokeRpc(RpcUtil.java:103)
at com.google.android.mobly.snippet.rpc.JsonRpcServer.handleRPCConnection(JsonRpcServer.java:83)
at com.google.android.mobly.snippet.rpc.SimpleServer$ConnectionThread.run(SimpleServer.java:109)
The text was updated successfully, but these errors were encountered:
I discovered on my first usage of @RpcDefault that mobly-snippet-lib only has default type converters defined for the boxed types like Boolean, but not boolean. This ends up particularly confusing when writing snippets in Kotlin because Kotlin's "Boolean" is a JVM "boolean" primitive.
For example, the following naive Kotlin conversion of ex7_default_and_optional_rpc:
will result in the following unless a value is provided for "bool":
The text was updated successfully, but these errors were encountered: