diff --git a/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/VersionSpecificApi.kt b/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/VersionSpecificApi.kt index 755fd8691..e974a91bb 100644 --- a/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/VersionSpecificApi.kt +++ b/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/VersionSpecificApi.kt @@ -5,6 +5,8 @@ package kotlinx.rpc.codegen import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext +import org.jetbrains.kotlin.cli.common.messages.MessageCollector +import org.jetbrains.kotlin.config.CompilerConfigurationKey import org.jetbrains.kotlin.ir.builders.declarations.IrFieldBuilder import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.IrCall @@ -42,6 +44,8 @@ interface VersionSpecificApi { var IrConstructor.isPrimaryVS: Boolean + val messageCollectorKey: CompilerConfigurationKey + companion object { lateinit var INSTANCE: VersionSpecificApi } diff --git a/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/RPCIrContext.kt b/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/RPCIrContext.kt index ca2ac1b0e..6d9fcee3c 100644 --- a/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/RPCIrContext.kt +++ b/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/RPCIrContext.kt @@ -6,15 +6,15 @@ package kotlinx.rpc.codegen.extension import kotlinx.rpc.codegen.VersionSpecificApi import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext -import org.jetbrains.kotlin.ir.declarations.IrEnumEntry -import org.jetbrains.kotlin.ir.declarations.IrProperty import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction import org.jetbrains.kotlin.ir.symbols.IrClassSymbol +import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.types.classOrNull import org.jetbrains.kotlin.ir.types.makeNullable import org.jetbrains.kotlin.ir.util.functions import org.jetbrains.kotlin.ir.util.isVararg +import org.jetbrains.kotlin.ir.util.nestedClasses import org.jetbrains.kotlin.ir.util.properties import org.jetbrains.kotlin.platform.konan.isNative import org.jetbrains.kotlin.types.Variance @@ -53,10 +53,18 @@ internal class RPCIrContext( getIrClassSymbol("kotlin", "Function0") } + val function1 by lazy { + getIrClassSymbol("kotlin", "Function1") + } + val suspendFunction0 by lazy { getIrClassSymbol("kotlin.coroutines", "SuspendFunction0") } + val suspendFunction2 by lazy { + getIrClassSymbol("kotlin.coroutines", "SuspendFunction2") + } + val flow by lazy { getIrClassSymbol("kotlinx.coroutines.flow", "Flow") } @@ -78,45 +86,55 @@ internal class RPCIrContext( } val rpcClient by lazy { - getRpcIrClassSymbol("RPCClient") + getRpcIrClassSymbol("RpcClient") } val rpcCall by lazy { - getRpcIrClassSymbol("RPCCall") + getRpcIrClassSymbol("RpcCall") + } + + val withServiceDescriptor by lazy { + getRpcIrClassSymbol("WithServiceDescriptor", "internal") } - val rpcCallType by lazy { - getRpcIrClassSymbol("RPCCall.Type") + val rpcEagerFieldAnnotation by lazy { + getRpcIrClassSymbol("RPCEagerField") } - val rpcCallTypeMethod by lazy { - rpcCallType.owner.declarations.filterIsInstance().single { - it.name.asString() == "Method" - }.symbol + val rpcServiceDescriptor by lazy { + getRpcIrClassSymbol("RpcServiceDescriptor", "descriptor") } - val rpcField by lazy { - getRpcIrClassSymbol("RPCField") + val rpcCallable by lazy { + getRpcIrClassSymbol("RpcCallable", "descriptor") } - val withRPCStubObjectAnnotation by lazy { - getRpcIrClassSymbol("WithRPCStubObject", "internal") + private val rpcInvokator by lazy { + getRpcIrClassSymbol("RpcInvokator", "descriptor") } - val rpcEagerFieldAnnotation by lazy { - getRpcIrClassSymbol("RPCEagerField") + val rpcInvokatorMethod by lazy { + rpcInvokator.subClass("Method") } - val rpcStubObject by lazy { - getRpcIrClassSymbol("RPCStubObject", "internal") + val rpcInvokatorField by lazy { + rpcInvokator.subClass("Field") + } + + val rpcParameter by lazy { + getRpcIrClassSymbol("RpcParameter", "descriptor") } val rpcDeferredField by lazy { - getRpcIrClassSymbol("RPCDeferredField", "internal") + getRpcIrClassSymbol("RpcDeferredField", "internal") } - val rpcMethodClassArguments by lazy { - getRpcIrClassSymbol("RPCMethodClassArguments", "internal") + val fieldDataObject by lazy { + getRpcIrClassSymbol("FieldDataObject", "internal") + } + + val rpcMethodClass by lazy { + getRpcIrClassSymbol("RpcMethodClass", "internal") } fun isJsTarget(): Boolean { @@ -135,15 +153,19 @@ internal class RPCIrContext( inner class Functions { val registerPlainFlowField by lazy { - rpcClient.namedFunction("registerPlainFlowField") + namedFunction("kotlinx.rpc", "registerPlainFlowField") } val registerSharedFlowField by lazy { - rpcClient.namedFunction("registerSharedFlowField") + namedFunction("kotlinx.rpc", "registerSharedFlowField") } val registerStateFlowField by lazy { - rpcClient.namedFunction("registerStateFlowField") + namedFunction("kotlinx.rpc", "registerStateFlowField") + } + + val dataCast by lazy { + namedFunction("kotlinx.rpc.internal", "dataCast") } val rpcClientCall by lazy { @@ -155,7 +177,7 @@ internal class RPCIrContext( } val asArray by lazy { - rpcMethodClassArguments.namedFunction("asArray") + rpcMethodClass.namedFunction("asArray") } val typeOf by lazy { @@ -217,7 +239,7 @@ internal class RPCIrContext( private fun namedFunction( packageName: String, name: String, - filterOverloads: ((IrSimpleFunctionSymbol) -> Boolean)? = null + filterOverloads: ((IrSimpleFunctionSymbol) -> Boolean)? = null, ): IrSimpleFunctionSymbol { val found = versionSpecificApi.referenceFunctions(pluginContext, packageName, name) @@ -232,17 +254,25 @@ internal class RPCIrContext( rpcClient.namedProperty("coroutineContext") } - private fun IrClassSymbol.namedProperty(name: String): IrProperty { - return owner.properties.single { it.name.asString() == name } + val rpcServiceDescriptorFqName by lazy { + rpcServiceDescriptor.namedProperty("fqName") + } + + private fun IrClassSymbol.namedProperty(name: String): IrPropertySymbol { + return owner.properties.single { it.name.asString() == name }.symbol } } + private fun IrClassSymbol.subClass(name: String): IrClassSymbol { + return owner.nestedClasses.single { it.name.asString() == name }.symbol + } + private fun getRpcIrClassSymbol(name: String, subpackage: String? = null): IrClassSymbol { val suffix = subpackage?.let { ".$subpackage" } ?: "" return getIrClassSymbol("kotlinx.rpc$suffix", name) } - fun getIrClassSymbol(packageName: String, name: String): IrClassSymbol { + private fun getIrClassSymbol(packageName: String, name: String): IrClassSymbol { return versionSpecificApi.referenceClass(pluginContext, packageName, name) ?: error("Unable to find symbol. Package: $packageName, name: $name") } diff --git a/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/RPCIrExtension.kt b/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/RPCIrExtension.kt index 6a45a044f..f528b676b 100644 --- a/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/RPCIrExtension.kt +++ b/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/RPCIrExtension.kt @@ -7,13 +7,12 @@ package kotlinx.rpc.codegen.extension import kotlinx.rpc.codegen.VersionSpecificApi import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext -import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.ir.declarations.IrModuleFragment class RPCIrExtension(configuration: CompilerConfiguration) : IrGenerationExtension { - private val logger = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.NONE) + private val logger = configuration.get(VersionSpecificApi.INSTANCE.messageCollectorKey, MessageCollector.NONE) override fun generate( moduleFragment: IrModuleFragment, diff --git a/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/RPCStubGenerator.kt b/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/RPCStubGenerator.kt index 00ad159ee..f8a73d825 100644 --- a/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/RPCStubGenerator.kt +++ b/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/RPCStubGenerator.kt @@ -17,9 +17,7 @@ import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.builders.* import org.jetbrains.kotlin.ir.builders.declarations.* import org.jetbrains.kotlin.ir.declarations.* -import org.jetbrains.kotlin.ir.expressions.IrCall -import org.jetbrains.kotlin.ir.expressions.IrExpression -import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin +import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrSymbol @@ -30,14 +28,21 @@ import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.SpecialNames import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.util.OperatorNameConventions +import org.jetbrains.kotlin.utils.memoryOptimizedPlus import kotlin.properties.Delegates -private const val CLIENT_PROPERTY = "__rpc_client" -private const val STUB_ID_PROPERTY = "__rpc_stub_id" -private const val METHOD_NAMES_PROPERTY = "methodNames" -private const val METHOD_TYPE_OF_FUNCTION = "methodTypeOf" -private const val WITH_CLIENT_METHOD = "withClient" -private const val RPC_FIELDS_METHOD = "rpcFields" +private object Stub { + const val CLIENT = "__rpc_client" + const val STUB_ID = "__rpc_stub_id" +} + +private object Descriptor { + const val CALLABLE_MAP = "callableMap" + const val FQ_NAME = "fqName" + const val GET_FIELDS = "getFields" + const val GET_CALLABLE = "getCallable" + const val CREATE_INSTANCE = "createInstance" +} @Suppress("detekt.LargeClass", "detekt.TooManyFunctions") internal class RPCStubGenerator( @@ -81,7 +86,7 @@ internal class RPCStubGenerator( * Constructor of a stub service: * * ```kotlin - * class MyServiceStub(private val __rpc_stub_id: Long, private val __rpc_client: RPCClient) : MyService + * class `$rpcServiceStub`(private val __rpc_stub_id: Long, private val __rpc_client: RpcClient) : MyService * ``` */ private fun IrClass.generateStubConstructor() { @@ -90,12 +95,12 @@ internal class RPCStubGenerator( isPrimary = true }.apply { stubIdValueParameter = addValueParameter { - name = Name.identifier(STUB_ID_PROPERTY) + name = Name.identifier(Stub.STUB_ID) type = ctx.irBuiltIns.longType } clientValueParameter = addValueParameter { - name = Name.identifier(CLIENT_PROPERTY) + name = Name.identifier(Stub.CLIENT) type = ctx.rpcClient.defaultType } @@ -131,11 +136,11 @@ internal class RPCStubGenerator( * __rpc_stub_id property from the constructor * * ```kotlin - * class MyServiceStub(private val __rpc_stub_id: Long, private val __rpc_client: RPCClient) : MyService + * class `$rpcServiceStub`(private val __rpc_stub_id: Long, private val __rpc_client: RpcClient) : MyService * ``` */ private fun IrClass.stubIdProperty() { - stubIdProperty = addConstructorProperty(STUB_ID_PROPERTY, ctx.irBuiltIns.longType, stubIdValueParameter) + stubIdProperty = addConstructorProperty(Stub.STUB_ID, ctx.irBuiltIns.longType, stubIdValueParameter) } private var clientProperty: IrProperty by Delegates.notNull() @@ -144,11 +149,11 @@ internal class RPCStubGenerator( * __rpc_client property from the constructor * * ```kotlin - * class MyServiceStub(private val __rpc_stub_id: Long, private val __rpc_client: RPCClient) : MyService + * class `$rpcServiceStub`(private val __rpc_stub_id: Long, private val __rpc_client: RpcClient) : MyService * ``` */ private fun IrClass.clientProperty() { - clientProperty = addConstructorProperty(CLIENT_PROPERTY, ctx.rpcClient.defaultType, clientValueParameter) + clientProperty = addConstructorProperty(Stub.CLIENT, ctx.rpcClient.defaultType, clientValueParameter) } private fun IrClass.addConstructorProperty( @@ -207,7 +212,7 @@ internal class RPCStubGenerator( visibility = DescriptorVisibilities.PUBLIC modality = Modality.FINAL }.apply { - overriddenSymbols = listOf(ctx.properties.rpcClientCoroutineContext.symbol) + overriddenSymbols = listOf(ctx.properties.rpcClientCoroutineContext) addBackingFieldUtil { visibility = DescriptorVisibilities.PRIVATE @@ -252,8 +257,10 @@ internal class RPCStubGenerator( * ``` kotlin * final override val : by lazy { * client.registerFlowField( - * this, // CoroutineScope - * RPCField("", __rpc_stub_id, "", typeOf<>()) + * serviceScope = this, // CoroutineScope + * descriptor = Companion, + * fieldName = "", + * serviceId = __rpc_stub_id, * ) * } * ``` @@ -263,8 +270,10 @@ internal class RPCStubGenerator( * ```kotlin * final override val : = * client.registerFlowField( - * this, // CoroutineScope - * RPCField("", __rpc_stub_id, "", typeOf<>()) + * serviceScope = this, // CoroutineScope + * descriptor = Companion, + * fieldName = "", + * serviceId = __rpc_stub_id, * ) * ``` * @@ -272,7 +281,6 @@ internal class RPCStubGenerator( * - `` - the name of the RPC field * - `` - actual type of the field. Can be either Flot, SharedFlow or StateFlow * - `` - [ServiceDeclaration.FlowField.Kind] - * - `` - FQ name of the RPC service */ @Suppress( "detekt.NestedBlockDepth", @@ -302,7 +310,7 @@ internal class RPCStubGenerator( ServiceDeclaration.FlowField.Kind.Plain -> ctx.functions.registerPlainFlowField ServiceDeclaration.FlowField.Kind.Shared -> ctx.functions.registerSharedFlowField ServiceDeclaration.FlowField.Kind.State -> ctx.functions.registerStateFlowField - }.symbol + } val registerCall = IrCallImpl( startOffset = UNDEFINED_OFFSET, @@ -310,9 +318,9 @@ internal class RPCStubGenerator( type = fieldType, symbol = registerFunction, typeArgumentsCount = 1, - valueArgumentsCount = 2, + valueArgumentsCount = 4, ).apply { - dispatchReceiver = irCallProperty(stubClass, clientProperty) + extensionReceiver = irCallProperty(stubClass, clientProperty) putTypeArgument(0, fieldTypeParameter.typeOrFail) putValueArgument( @@ -325,34 +333,11 @@ internal class RPCStubGenerator( ), ) - val fieldArgument = IrConstructorCallImpl( - startOffset = UNDEFINED_OFFSET, - endOffset = UNDEFINED_OFFSET, - type = ctx.rpcField.defaultType, - symbol = ctx.rpcField.constructors.single(), - typeArgumentsCount = 0, - constructorTypeArgumentsCount = 0, - valueArgumentsCount = 4, - ).apply { - putValueArgument(0, stringConst(declaration.service.kotlinFqName.asString())) - putValueArgument(1, irCallProperty(stubClass, stubIdProperty)) - putValueArgument(2, stringConst(field.property.name.asString())) - - val typeOfCall = IrCallImpl( - startOffset = UNDEFINED_OFFSET, - endOffset = UNDEFINED_OFFSET, - type = ctx.kTypeClass.defaultType, - symbol = ctx.functions.typeOf, - typeArgumentsCount = 1, - valueArgumentsCount = 0, - ).apply { - putTypeArgument(0, fieldType) - } + putValueArgument(1, irGetDescriptor()) - putValueArgument(3, typeOfCall) - } + putValueArgument(2, stringConst(field.property.name.asString())) - putValueArgument(1, fieldArgument) + putValueArgument(3, irCallProperty(stubClass, stubIdProperty)) } if (!isLazy) { @@ -508,14 +493,11 @@ internal class RPCStubGenerator( * ```kotlin * final override suspend fun (): { * return scopedClientCall(this) { // this: CoroutineScope - * __rpc_client.call(RPCCall( - * "", - * __rpc_stub_id, - * "", - * RPCCall.Type.Method, - * (()|), - * typeOf<>(), - * typeOf<>(), + * __rpc_client.call(RpcCall( + * descriptor = Companion, + * callableName = "", + * data = (()|), + * serviceId = __rpc_stub_id, * )) * } * } @@ -525,8 +507,7 @@ internal class RPCStubGenerator( * - `` - the name of the RPC method * - `` - array of arguments for the method * - `` - the return type of the method - * - `` - FQ name of the RPC service - * - ``/`` - generated class or object for this method + * - `` or `` - generated class or object for this method */ @Suppress( "detekt.NestedBlockDepth", @@ -654,13 +635,13 @@ internal class RPCStubGenerator( val methodClass = findDeclaration { it.name == methodClassName } ?: error( "Expected $methodClassName class to be present in stub class " + - "${declaration.service.name}${declaration.stubClass.name}" + "${declaration.service.name}${stubClass.name}" ) methodClasses.add(methodClass) val methodClassThisReceiver = methodClass.thisReceiver - ?: error("Expected ${methodClass.name} of ${declaration.stubClass.name} to have a thisReceiver") + ?: error("Expected ${methodClass.name} of ${stubClass.name} to have a thisReceiver") val properties = if (methodClass.isClass) { val argNames = method.arguments.memoryOptimizedMap { it.value.name }.toSet() @@ -689,7 +670,7 @@ internal class RPCStubGenerator( emptyList() } - methodClass.superTypes += ctx.rpcMethodClassArguments.defaultType + methodClass.superTypes += ctx.rpcMethodClass.defaultType methodClass.addFunction { name = ctx.functions.asArray.name @@ -740,14 +721,11 @@ internal class RPCStubGenerator( * Part of [generateRpcMethod] that generates next call: * * ```kotlin - * __rpc_client.call(RPCCall( - * "", - * __rpc_stub_id, - * "", - * RPCCall.Type.Method, - * (()|), - * typeOf<>(), - * typeOf<>(), + * __rpc_client.call(RpcCall( + * descriptor = Companion, + * callableName = "", + * data = (()|), + * serviceId = __rpc_stub_id, * )) * ``` */ @@ -779,29 +757,14 @@ internal class RPCStubGenerator( ).apply { putValueArgument( index = 0, - valueArgument = stringConst(declaration.service.kotlinFqName.asString()), + valueArgument = irGetDescriptor(), ) putValueArgument( index = 1, - valueArgument = irCallProperty(stubClass, stubIdProperty, symbol = functionThisReceiver.symbol), - ) - - putValueArgument( - index = 2, valueArgument = stringConst(method.function.name.asString()), ) - putValueArgument( - index = 3, - valueArgument = IrGetEnumValueImpl( - startOffset = UNDEFINED_OFFSET, - endOffset = UNDEFINED_OFFSET, - type = ctx.rpcCallType.defaultType, - symbol = ctx.rpcCallTypeMethod, - ), - ) - val dataParameter = if (isMethodObject) { irGetObject(methodClass.symbol) } else { @@ -818,32 +781,32 @@ internal class RPCStubGenerator( } } - putValueArgument(4, dataParameter) - - putValueArgument( - index = 5, - valueArgument = irCall( - ctx.functions.typeOf, - ).apply { - putTypeArgument(0, methodClass.defaultType) - }, - ) + putValueArgument(2, dataParameter) putValueArgument( - index = 6, - valueArgument = irCall( - ctx.functions.typeOf, - ).apply { - putTypeArgument(0, method.function.returnType) - }, + index = 3, + valueArgument = irCallProperty(stubClass, stubIdProperty, symbol = functionThisReceiver.symbol), ) } putValueArgument(0, rpcCallConstructor) } + return call } + private fun irGetDescriptor(): IrExpression { + val companion = stubClass.companionObject() + ?: error("Expected companion object in ${stubClass.name}") + + return IrGetObjectValueImpl( + startOffset = UNDEFINED_OFFSET, + endOffset = UNDEFINED_OFFSET, + type = companion.symbol.defaultType, + symbol = companion.symbol, + ) + } + private fun irCallProperty( clazz: IrClass, property: IrProperty, @@ -887,7 +850,7 @@ internal class RPCStubGenerator( * The empty object should already be generated * * ```kotlin - * companion object : RPCStubObject + * companion object : RpcServiceDescriptor * ``` */ private fun IrClass.generateCompanionObject() { @@ -899,13 +862,13 @@ internal class RPCStubGenerator( stubCompanionObjectThisReceiver = thisReceiver ?: error("Stub companion object expected to have thisReceiver: ${name.asString()}") - superTypes = listOf(ctx.rpcStubObject.typeWith(declaration.serviceType)) + superTypes = listOf(ctx.rpcServiceDescriptor.typeWith(declaration.serviceType)) generateCompanionObjectConstructor() generateCompanionObjectContent() - addAnyOverrides(ctx.rpcStubObject.owner) + addAnyOverrides(ctx.rpcServiceDescriptor.owner) } ?: error("Expected companion object to be present") } @@ -921,53 +884,251 @@ internal class RPCStubGenerator( } private fun IrClass.generateCompanionObjectContent() { - generateMethodNamesProperty() + generateFqName() + + generateInvokators() + + generateCallableMapProperty() + + generateGetCallableFunction() + + generateCreateInstanceFunction() + + generateGetFieldsFunction() + } + + /** + * `fqName` property of the descriptor. + * + * ```kotlin + * override val fqName = "MyService" + * ``` + */ + private fun IrClass.generateFqName() { + addProperty { + name = Name.identifier(Descriptor.FQ_NAME) + visibility = DescriptorVisibilities.PUBLIC + }.apply { + overriddenSymbols = listOf(ctx.properties.rpcServiceDescriptorFqName) + + addBackingFieldUtil { + visibility = DescriptorVisibilities.PRIVATE + type = ctx.irBuiltIns.stringType + vsApi { isFinalVS = true } + }.apply { + initializer = factory.createExpressionBody( + stringConst(declaration.fqName) + ) + } + + addDefaultGetter(this@generateFqName, ctx.irBuiltIns) { + visibility = DescriptorVisibilities.PUBLIC + overriddenSymbols = listOf(ctx.properties.rpcServiceDescriptorFqName.owner.getterOrFail.symbol) + } + } + } + + private val invokators = mutableMapOf() + + private fun IrClass.generateInvokators() { + (declaration.methods memoryOptimizedPlus declaration.fields).forEachIndexed { i, callable -> + generateInvokator(i, callable) + } + } + + /** + * Generates an invokator (`RpcInvokator`) for this callable. + * + * For methods: + * ```kotlin + * private val Invokator = RpcInvokator.Method { + * service: MyService, data: Any? -> + * + * val dataCasted = data.dataCast<>( + * "", + * "", + * ) + * + * service.(dataCasted., ..., $completion) + * } + * ``` + * + * Where: + * - `` - the name of the method + * - `` - type of the corresponding method class + * - `` - name of the service + * - `$completion` - Continuation parameter + * + * For fields: + * ```kotlin + * private val Invokator = RpcInvokator.Field { service: MyService -> + * service. + * } + * ``` + * Where: + * - `` - the name of the field + */ + private fun IrClass.generateInvokator(i: Int, callable: ServiceDeclaration.Callable) { + invokators[callable.name] = addProperty { + name = Name.identifier("${callable.name}Invokator") + visibility = DescriptorVisibilities.PRIVATE + }.apply { + val propertyTypeSymbol = when (callable) { + is ServiceDeclaration.Method -> ctx.rpcInvokatorMethod + is ServiceDeclaration.FlowField -> ctx.rpcInvokatorField + } + + val propertyType = propertyTypeSymbol.typeWith(declaration.serviceType) + + addBackingFieldUtil { + visibility = DescriptorVisibilities.PRIVATE + type = propertyType + vsApi { isFinalVS = true } + }.apply backingField@{ + val functionLambda = factory.buildFun { + origin = IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA + name = SpecialNames.ANONYMOUS + visibility = DescriptorVisibilities.LOCAL + modality = Modality.FINAL + returnType = ctx.anyNullable + if (callable is ServiceDeclaration.Method) { + isSuspend = true + } + }.apply { + parent = this@backingField - generateMethodTypeOfFunction() + val serviceParameter = addValueParameter { + name = Name.identifier("service") + type = declaration.serviceType + } + + val dataParameter = if (callable is ServiceDeclaration.Method) { + addValueParameter { + name = Name.identifier("data") + type = ctx.anyNullable + } + } else { + null + } + + body = irBuilder(symbol).irBlockBody { + val call = when (callable) { + is ServiceDeclaration.Method -> { + val methodClass = methodClasses[i] + val dataCasted = irTemporary( + value = irCall(ctx.functions.dataCast, type = methodClass.defaultType).apply { + dataParameter ?: error("unreachable") + extensionReceiver = irGet(dataParameter) + + putTypeArgument(0, methodClass.defaultType) + + putValueArgument(0, stringConst(callable.name)) + putValueArgument(1, stringConst(declaration.fqName)) + }, + nameHint = "dataCasted", + irType = methodClass.defaultType, + ) + + irCall(callable.function).apply { + dispatchReceiver = irGet(serviceParameter) + + callable.arguments.forEachIndexed { i, arg -> + putValueArgument( + index = i, + valueArgument = irCallProperty( + receiver = irGet(dataCasted), + property = methodClass.properties.single { it.name == arg.value.name }, + ), + ) + } + } + } + + is ServiceDeclaration.FlowField -> { + irCall(callable.property.getterOrFail).apply { + dispatchReceiver = irGet(serviceParameter) + } + } + } + + +irReturn(call) + } + } + + val lambdaType = when (callable) { + is ServiceDeclaration.Method -> ctx.suspendFunction2.typeWith( + declaration.serviceType, // service + ctx.anyNullable, // data + ctx.anyNullable, // returnType + ) + + is ServiceDeclaration.FlowField -> ctx.function1.typeWith( + declaration.serviceType, // service + ctx.anyNullable, // returnType + ) + } + + val lambda = IrFunctionExpressionImpl( + startOffset = UNDEFINED_OFFSET, + endOffset = UNDEFINED_OFFSET, + type = lambdaType, + origin = IrStatementOrigin.LAMBDA, + function = functionLambda, + ) - generateWithClientFunction() + initializer = factory.createExpressionBody( + IrTypeOperatorCallImpl( + startOffset = UNDEFINED_OFFSET, + endOffset = UNDEFINED_OFFSET, + type = propertyType, + operator = IrTypeOperator.SAM_CONVERSION, + typeOperand = propertyType, + argument = lambda, + ) + ) + } - generateRpcFieldsFunction() + addDefaultGetter(this@generateInvokator, ctx.irBuiltIns) { + visibility = DescriptorVisibilities.PRIVATE + } + } } - private var methodNamesMap: IrProperty by Delegates.notNull() + private var callableMap: IrProperty by Delegates.notNull() /** - * Method names property. - * A map that holds a KType of the method class by method string name + * Callable names map. + * A map that holds an RpcCallable that describes it. * * ```kotlin - * private val methodNames: Map = mapOf( - * Pair("", typeOf<>()), + * private val callableMap: Map> = mapOf( + * Pair("", RpcCallable(...)), * ... - * Pair("", typeOf<>()), + * Pair("", RpcCallable(...)), * ) * * // when n=0: - * private val methodNames: Map = emptyMap() + * private val callableMap: Map> = emptyMap() * ``` * * Where: - * - `` - the name of the k-th method in the service - * - `` - the method class for the k-th method in the service + * - `` - the name of the k-th callable in the service */ - private fun IrClass.generateMethodNamesProperty() { - methodNamesMap = addProperty { - name = Name.identifier(METHOD_NAMES_PROPERTY) + private fun IrClass.generateCallableMapProperty() { + callableMap = addProperty { + name = Name.identifier(Descriptor.CALLABLE_MAP) visibility = DescriptorVisibilities.PRIVATE modality = Modality.FINAL }.apply { - val mapType = ctx.irBuiltIns.mapClass.typeWith( - ctx.irBuiltIns.stringType, - ctx.kTypeClass.defaultType, - ) + val rpcCallableType = ctx.rpcCallable.typeWith(declaration.serviceType) + val mapType = ctx.irBuiltIns.mapClass.typeWith(ctx.irBuiltIns.stringType, rpcCallableType) addBackingFieldUtil { type = mapType vsApi { isFinalVS = true } visibility = DescriptorVisibilities.PRIVATE }.apply { - val isEmpty = declaration.methods.isEmpty() + val isEmpty = declaration.methods.isEmpty() && declaration.fields.isEmpty() initializer = factory.createExpressionBody( IrCallImpl( @@ -979,25 +1140,24 @@ internal class RPCStubGenerator( typeArgumentsCount = 2, ).apply mapApply@{ putTypeArgument(0, ctx.irBuiltIns.stringType) - putTypeArgument(1, ctx.kTypeClass.defaultType) + putTypeArgument(1, rpcCallableType) if (isEmpty) { return@mapApply } - val pairType = ctx.pair.typeWith( - ctx.irBuiltIns.stringType, - ctx.kTypeClass.defaultType, - ) + val pairType = ctx.pair.typeWith(ctx.irBuiltIns.stringType, rpcCallableType) val varargType = ctx.irBuiltIns.arrayClass.typeWith(pairType, Variance.OUT_VARIANCE) + val callables = declaration.methods memoryOptimizedPlus declaration.fields + val vararg = IrVarargImpl( startOffset = UNDEFINED_OFFSET, endOffset = UNDEFINED_OFFSET, type = varargType, varargElementType = pairType, - elements = declaration.methods.memoryOptimizedMapIndexed { i, method -> + elements = callables.memoryOptimizedMapIndexed { i, callable -> IrCallImpl( startOffset = UNDEFINED_OFFSET, endOffset = UNDEFINED_OFFSET, @@ -1007,22 +1167,11 @@ internal class RPCStubGenerator( valueArgumentsCount = 1, ).apply { putTypeArgument(0, ctx.irBuiltIns.stringType) - putTypeArgument(1, ctx.kTypeClass.defaultType) - - extensionReceiver = stringConst(method.function.name.asString()) + putTypeArgument(1, rpcCallableType) - val type = IrCallImpl( - startOffset = UNDEFINED_OFFSET, - endOffset = UNDEFINED_OFFSET, - type = ctx.kTypeClass.defaultType, - symbol = ctx.functions.typeOf, - typeArgumentsCount = 1, - valueArgumentsCount = 0, - ).apply { - putTypeArgument(0, methodClasses[i].defaultType) - } + extensionReceiver = stringConst(callable.name) - putValueArgument(0, type) + putValueArgument(0, irRpcCallable(i, callable)) } }, ) @@ -1032,30 +1181,146 @@ internal class RPCStubGenerator( ) } - addDefaultGetter(this@generateMethodNamesProperty, ctx.irBuiltIns) { + addDefaultGetter(this@generateCallableMapProperty, ctx.irBuiltIns) { visibility = DescriptorVisibilities.PRIVATE } } } /** - * Accessor function for `methodNames` map - * Defined in `RPCStubObject` + * A call to constructor of the RpcCallable. * * ```kotlin - * final override fun methodTypeOf(methodName: String): KType? = methodNames[methodName] + * RpcCallable( + * name = "", + * dataType = typeOf<>(), + * returnType = typeOf<>(), + * invokator = , + * parameters = arrayOf( // or emptyArray() + * RpcParameter( + * "", + * typeOf<>(), + * ), + * ... + * ), + * ) + *``` + * + * Where: + * - `` - the name of the method (field) + * - `` - a method class for a method and `FieldDataObject` for fields + * - `` - the return type for the method and the field type for a field + * - `` - an invokator, previously generated by [generateInvokators] + * - `` - if a method, its k-th parameter name + * - `` - if a method, its k-th parameter type + */ + private fun irRpcCallable(i: Int, callable: ServiceDeclaration.Callable): IrExpression { + return IrConstructorCallImpl( + startOffset = UNDEFINED_OFFSET, + endOffset = UNDEFINED_OFFSET, + type = ctx.rpcCallable.typeWith(declaration.serviceType), + symbol = ctx.rpcCallable.constructors.single(), + typeArgumentsCount = 1, + valueArgumentsCount = 5, + constructorTypeArgumentsCount = 1, + ).apply { + putConstructorTypeArgument(0, declaration.serviceType) + + putValueArgument(0, stringConst(callable.name)) + + val dataType = when (callable) { + is ServiceDeclaration.Method -> methodClasses[i].defaultType + is ServiceDeclaration.FlowField -> ctx.fieldDataObject.defaultType + } + + putValueArgument(1, irTypeOfCall(dataType)) + + val returnType = when (callable) { + is ServiceDeclaration.Method -> callable.function.returnType + is ServiceDeclaration.FlowField -> callable.property.getterOrFail.returnType + } + + putValueArgument(2, irTypeOfCall(returnType)) + + val invokator = invokators[callable.name] + ?: error("Expected invokator for ${callable.name} in ${declaration.service.name}") + + putValueArgument(3, irCallProperty(stubCompanionObject.owner, invokator)) + + val parameters = (callable as? ServiceDeclaration.Method)?.arguments + ?: emptyList() + + val callee = if (parameters.isEmpty()) { + ctx.functions.emptyArray + } else { + ctx.irBuiltIns.arrayOf + } + + val arrayParametersType = ctx.irBuiltIns.arrayClass.typeWith( + ctx.rpcParameter.defaultType, + Variance.OUT_VARIANCE, + ) + + val arrayOfCall = IrCallImpl( + startOffset = UNDEFINED_OFFSET, + endOffset = UNDEFINED_OFFSET, + type = arrayParametersType, + symbol = callee, + typeArgumentsCount = 1, + valueArgumentsCount = if (parameters.isEmpty()) 0 else 1, + ).apply arrayOfCall@{ + putTypeArgument(0, ctx.rpcParameter.defaultType) + + if (parameters.isEmpty()) { + return@arrayOfCall + } + + val vararg = IrVarargImpl( + startOffset = UNDEFINED_OFFSET, + endOffset = UNDEFINED_OFFSET, + type = arrayParametersType, + varargElementType = ctx.rpcParameter.defaultType, + elements = parameters.memoryOptimizedMap { parameter -> + IrConstructorCallImpl( + startOffset = UNDEFINED_OFFSET, + endOffset = UNDEFINED_OFFSET, + type = ctx.rpcParameter.defaultType, + symbol = ctx.rpcParameter.constructors.single(), + typeArgumentsCount = 0, + constructorTypeArgumentsCount = 0, + valueArgumentsCount = 2, + ).apply { + putValueArgument(0, stringConst(parameter.value.name.asString())) + putValueArgument(1, irTypeOfCall(parameter.type)) + } + }, + ) + + putValueArgument(0, vararg) + } + + putValueArgument(4, arrayOfCall) + } + } + + /** + * Accessor function for the `callableMap` property + * Defined in `RpcServiceDescriptor` + * + * ```kotlin + * final override fun getCallable(name: String): RpcCallable? = callableMap[name] * ``` */ - private fun IrClass.generateMethodTypeOfFunction() { - val kTypeNullable = ctx.kTypeClass.createType(hasQuestionMark = true, emptyList()) + private fun IrClass.generateGetCallableFunction() { + val resultType = ctx.rpcCallable.createType(hasQuestionMark = true, emptyList()) addFunction { - name = Name.identifier(METHOD_TYPE_OF_FUNCTION) + name = Name.identifier(Descriptor.GET_CALLABLE) visibility = DescriptorVisibilities.PUBLIC modality = Modality.OPEN - returnType = kTypeNullable + returnType = resultType }.apply { - overriddenSymbols = listOf(ctx.rpcStubObject.functionByName(METHOD_TYPE_OF_FUNCTION)) + overriddenSymbols = listOf(ctx.rpcServiceDescriptor.functionByName(Descriptor.GET_CALLABLE)) val functionThisReceiver = vsApi { stubCompanionObjectThisReceiver.copyToVS(this@apply, origin = IrDeclarationOrigin.DEFINED) @@ -1063,23 +1328,23 @@ internal class RPCStubGenerator( dispatchReceiverParameter = it } - val methodName = addValueParameter { - name = Name.identifier("methodName") + val parameter = addValueParameter { + name = Name.identifier("name") type = ctx.irBuiltIns.stringType } body = irBuilder(symbol).irBlockBody { +irReturn( - irCall(ctx.functions.mapGet.symbol, kTypeNullable).apply { + irCall(ctx.functions.mapGet.symbol, resultType).apply { vsApi { originVS = IrStatementOrigin.GET_ARRAY_ELEMENT } dispatchReceiver = irCallProperty( - clazz = this@generateMethodTypeOfFunction, - property = methodNamesMap, + clazz = this@generateGetCallableFunction, + property = callableMap, symbol = functionThisReceiver.symbol, ) - putValueArgument(0, irGet(methodName)) + putValueArgument(0, irGet(parameter)) } ) } @@ -1090,19 +1355,19 @@ internal class RPCStubGenerator( * Factory method for creating a new instance of RPC service * * ```kotlin - * final override fun withClient(serviceId: Long, client: RPCClient): MyService { - * return MyServiceStub(serviceId, client) + * final override fun createInstance(serviceId: Long, client: RpcClient): MyService { + * return `$rpcServiceStub`(serviceId, client) * } * ``` */ - private fun IrClass.generateWithClientFunction() { + private fun IrClass.generateCreateInstanceFunction() { addFunction { - name = Name.identifier(WITH_CLIENT_METHOD) + name = Name.identifier(Descriptor.CREATE_INSTANCE) visibility = DescriptorVisibilities.PUBLIC modality = Modality.OPEN returnType = declaration.serviceType }.apply { - overriddenSymbols = listOf(ctx.rpcStubObject.functionByName(WITH_CLIENT_METHOD)) + overriddenSymbols = listOf(ctx.rpcServiceDescriptor.functionByName(Descriptor.CREATE_INSTANCE)) dispatchReceiverParameter = vsApi { stubCompanionObjectThisReceiver.copyToVS(this@apply, origin = IrDeclarationOrigin.DEFINED) @@ -1133,32 +1398,32 @@ internal class RPCStubGenerator( } /** - * Function for getting a list of all RPC fields in a given service as [RPCDeferredField<*>] + * Function for getting a list of all RPC fields in a given service as [RpcDeferredField<*>] * * ```kotlin - * final override fun rpcFields(service: MyService): List> { + * final override fun getFields(service: MyService): List> { * return listOf( // or emptyList() if no fields * service., * ... * service., - * ) as List> + * ) as List> * } * ``` * * Where: - * - `` - k-th field of a given service + * - `` - the k-th field of a given service */ - private fun IrClass.generateRpcFieldsFunction() { + private fun IrClass.generateGetFieldsFunction() { val listType = ctx.irBuiltIns.listClass.typeWith(ctx.rpcDeferredField.starProjectedType) addFunction { - name = Name.identifier(RPC_FIELDS_METHOD) + name = Name.identifier(Descriptor.GET_FIELDS) visibility = DescriptorVisibilities.PUBLIC modality = Modality.OPEN returnType = listType }.apply { - overriddenSymbols = listOf(ctx.rpcStubObject.functionByName(RPC_FIELDS_METHOD)) + overriddenSymbols = listOf(ctx.rpcServiceDescriptor.functionByName(Descriptor.GET_FIELDS)) dispatchReceiverParameter = vsApi { stubCompanionObjectThisReceiver.copyToVS(this@apply, origin = IrDeclarationOrigin.DEFINED) @@ -1216,8 +1481,8 @@ internal class RPCStubGenerator( service.annotations += IrConstructorCallImpl( startOffset = service.startOffset, endOffset = service.endOffset, - type = ctx.withRPCStubObjectAnnotation.defaultType, - symbol = ctx.withRPCStubObjectAnnotation.constructors.single(), + type = ctx.withServiceDescriptor.defaultType, + symbol = ctx.withServiceDescriptor.constructors.single(), typeArgumentsCount = 0, constructorTypeArgumentsCount = 0, valueArgumentsCount = 1, @@ -1236,6 +1501,22 @@ internal class RPCStubGenerator( } } + /** + * IR call of the `typeOf<...>()` function + */ + private fun irTypeOfCall(type: IrType): IrCall { + return IrCallImpl( + startOffset = UNDEFINED_OFFSET, + endOffset = UNDEFINED_OFFSET, + type = ctx.kTypeClass.defaultType, + symbol = ctx.functions.typeOf, + typeArgumentsCount = 1, + valueArgumentsCount = 0, + ).apply { + putTypeArgument(0, type) + } + } + // default constructor implementation private fun IrClass.addDefaultConstructor(constructor: IrConstructor) { constructor.body = irBuilder(constructor.symbol).irBlockBody { diff --git a/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/ServiceDeclaration.kt b/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/ServiceDeclaration.kt index 042cc6e39..3c3dce74a 100644 --- a/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/ServiceDeclaration.kt +++ b/compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/ServiceDeclaration.kt @@ -10,6 +10,7 @@ import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction import org.jetbrains.kotlin.ir.declarations.IrValueParameter import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.util.defaultType +import org.jetbrains.kotlin.ir.util.kotlinFqName class ServiceDeclaration( val service: IrClass, @@ -17,13 +18,20 @@ class ServiceDeclaration( val methods: List, val fields: List, ) { - val simpleName: String = service.name.asString() + val fqName = service.kotlinFqName.asString() + val serviceType = service.defaultType + sealed interface Callable { + val name: String + } + class Method( val function: IrSimpleFunction, val arguments: List, - ) { + ) : Callable { + override val name: String = function.name.asString() + class Argument( val value: IrValueParameter, val type: IrType, @@ -33,7 +41,9 @@ class ServiceDeclaration( class FlowField( val property: IrProperty, val flowKind: Kind, - ) { + ) : Callable { + override val name: String = property.name.asString() + enum class Kind { Plain, Shared, State; } diff --git a/compiler-plugin/compiler-plugin-backend/src/main/latest/kotlinx/rpc/codegen/VersionSpecificApiImpl.kt b/compiler-plugin/compiler-plugin-backend/src/main/latest/kotlinx/rpc/codegen/VersionSpecificApiImpl.kt index e6aa10de6..75c16ab32 100644 --- a/compiler-plugin/compiler-plugin-backend/src/main/latest/kotlinx/rpc/codegen/VersionSpecificApiImpl.kt +++ b/compiler-plugin/compiler-plugin-backend/src/main/latest/kotlinx/rpc/codegen/VersionSpecificApiImpl.kt @@ -6,6 +6,9 @@ package kotlinx.rpc.codegen import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext import org.jetbrains.kotlin.backend.common.ir.addExtensionReceiver +import org.jetbrains.kotlin.cli.common.messages.MessageCollector +import org.jetbrains.kotlin.config.CommonConfigurationKeys +import org.jetbrains.kotlin.config.CompilerConfigurationKey import org.jetbrains.kotlin.ir.builders.declarations.IrFieldBuilder import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.IrCall @@ -77,4 +80,7 @@ object VersionSpecificApiImpl : VersionSpecificApi { override fun IrSimpleFunction.addExtensionReceiverVS(type: IrType, origin: IrDeclarationOrigin): IrValueParameter { return addExtensionReceiver(type, origin) } + + override val messageCollectorKey: CompilerConfigurationKey + get() = CommonConfigurationKeys.MESSAGE_COLLECTOR_KEY } diff --git a/compiler-plugin/compiler-plugin-backend/src/main/pre_2_0_10/kotlinx/rpc/codegen/VersionSpecificApiImpl.kt b/compiler-plugin/compiler-plugin-backend/src/main/pre_2_0_10/kotlinx/rpc/codegen/VersionSpecificApiImpl.kt new file mode 100644 index 000000000..8b36e8b67 --- /dev/null +++ b/compiler-plugin/compiler-plugin-backend/src/main/pre_2_0_10/kotlinx/rpc/codegen/VersionSpecificApiImpl.kt @@ -0,0 +1,86 @@ +/* + * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package kotlinx.rpc.codegen + +import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext +import org.jetbrains.kotlin.backend.common.ir.addExtensionReceiver +import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys +import org.jetbrains.kotlin.cli.common.messages.MessageCollector +import org.jetbrains.kotlin.config.CompilerConfigurationKey +import org.jetbrains.kotlin.ir.builders.declarations.IrFieldBuilder +import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.expressions.IrCall +import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin +import org.jetbrains.kotlin.ir.symbols.IrClassSymbol +import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol +import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.copyTo +import org.jetbrains.kotlin.name.CallableId +import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.platform.TargetPlatform +import org.jetbrains.kotlin.platform.isJs +import org.jetbrains.kotlin.platform.isWasm + +object VersionSpecificApiImpl : VersionSpecificApi { + override fun isJs(platform: TargetPlatform?): Boolean { + return platform.isJs() + } + + override fun isWasm(platform: TargetPlatform?): Boolean { + return platform.isWasm() + } + + override var IrFieldBuilder.isFinalVS: Boolean + get() = isFinal + set(value) { + isFinal = value + } + + override var IrCall.originVS: IrStatementOrigin? + get() = origin + set(value) { origin = value } + + override var IrConstructor.isPrimaryVS: Boolean + get() = isPrimary + set(value) { + isPrimary = value + } + + override fun referenceClass(context: IrPluginContext, packageName: String, name: String): IrClassSymbol? { + return context.referenceClass( + ClassId( + FqName(packageName), + FqName(name), + false + ) + ) + } + + override fun referenceFunctions( + context: IrPluginContext, + packageName: String, + name: String + ): Collection { + return context.referenceFunctions( + CallableId( + FqName(packageName), + Name.identifier(name), + ) + ) + } + + override fun IrValueParameter.copyToVS(irFunction: IrFunction, origin: IrDeclarationOrigin): IrValueParameter { + return copyTo(irFunction, origin) + } + + override fun IrSimpleFunction.addExtensionReceiverVS(type: IrType, origin: IrDeclarationOrigin): IrValueParameter { + return addExtensionReceiver(type, origin) + } + + override val messageCollectorKey: CompilerConfigurationKey + get() = CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY +} diff --git a/core/api/core.api b/core/api/core.api index dba97ab59..6432b7a07 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -6,70 +6,43 @@ public final class kotlinx/rpc/AwaitFieldInitializationKt { public abstract interface class kotlinx/rpc/RPC : kotlinx/coroutines/CoroutineScope { } -public final class kotlinx/rpc/RPCCall { - public fun (Ljava/lang/String;JLjava/lang/String;Lkotlinx/rpc/RPCCall$Type;Ljava/lang/Object;Lkotlin/reflect/KType;Lkotlin/reflect/KType;)V - public final fun component1 ()Ljava/lang/String; - public final fun component2 ()J - public final fun component3 ()Ljava/lang/String; - public final fun component4 ()Lkotlinx/rpc/RPCCall$Type; - public final fun component5 ()Ljava/lang/Object; - public final fun component6 ()Lkotlin/reflect/KType; - public final fun component7 ()Lkotlin/reflect/KType; - public final fun copy (Ljava/lang/String;JLjava/lang/String;Lkotlinx/rpc/RPCCall$Type;Ljava/lang/Object;Lkotlin/reflect/KType;Lkotlin/reflect/KType;)Lkotlinx/rpc/RPCCall; - public static synthetic fun copy$default (Lkotlinx/rpc/RPCCall;Ljava/lang/String;JLjava/lang/String;Lkotlinx/rpc/RPCCall$Type;Ljava/lang/Object;Lkotlin/reflect/KType;Lkotlin/reflect/KType;ILjava/lang/Object;)Lkotlinx/rpc/RPCCall; - public fun equals (Ljava/lang/Object;)Z - public final fun getCallableName ()Ljava/lang/String; - public final fun getData ()Ljava/lang/Object; - public final fun getDataType ()Lkotlin/reflect/KType; - public final fun getReturnType ()Lkotlin/reflect/KType; - public final fun getServiceId ()J - public final fun getServiceTypeString ()Ljava/lang/String; - public final fun getType ()Lkotlinx/rpc/RPCCall$Type; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; +public abstract interface annotation class kotlinx/rpc/RPCEagerField : java/lang/annotation/Annotation { } -public final class kotlinx/rpc/RPCCall$Type : java/lang/Enum { - public static final field Field Lkotlinx/rpc/RPCCall$Type; - public static final field Method Lkotlinx/rpc/RPCCall$Type; - public static fun getEntries ()Lkotlin/enums/EnumEntries; - public static fun valueOf (Ljava/lang/String;)Lkotlinx/rpc/RPCCall$Type; - public static fun values ()[Lkotlinx/rpc/RPCCall$Type; +public abstract interface class kotlinx/rpc/RPCServer : kotlinx/coroutines/CoroutineScope { + public abstract fun registerService (Lkotlin/reflect/KClass;Lkotlin/jvm/functions/Function1;)V } -public abstract interface class kotlinx/rpc/RPCClient : kotlinx/coroutines/CoroutineScope { - public abstract fun call (Lkotlinx/rpc/RPCCall;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public abstract fun provideStubContext (J)Lkotlin/coroutines/CoroutineContext; - public abstract fun registerPlainFlowField (Lkotlinx/coroutines/CoroutineScope;Lkotlinx/rpc/RPCField;)Lkotlinx/coroutines/flow/Flow; - public abstract fun registerSharedFlowField (Lkotlinx/coroutines/CoroutineScope;Lkotlinx/rpc/RPCField;)Lkotlinx/coroutines/flow/SharedFlow; - public abstract fun registerStateFlowField (Lkotlinx/coroutines/CoroutineScope;Lkotlinx/rpc/RPCField;)Lkotlinx/coroutines/flow/StateFlow; +public final class kotlinx/rpc/RegisterFieldKt { + public static final fun registerPlainFlowField (Lkotlinx/rpc/RpcClient;Lkotlinx/coroutines/CoroutineScope;Lkotlinx/rpc/descriptor/RpcServiceDescriptor;Ljava/lang/String;J)Lkotlinx/coroutines/flow/Flow; + public static final fun registerSharedFlowField (Lkotlinx/rpc/RpcClient;Lkotlinx/coroutines/CoroutineScope;Lkotlinx/rpc/descriptor/RpcServiceDescriptor;Ljava/lang/String;J)Lkotlinx/coroutines/flow/SharedFlow; + public static final fun registerStateFlowField (Lkotlinx/rpc/RpcClient;Lkotlinx/coroutines/CoroutineScope;Lkotlinx/rpc/descriptor/RpcServiceDescriptor;Ljava/lang/String;J)Lkotlinx/coroutines/flow/StateFlow; } -public abstract interface annotation class kotlinx/rpc/RPCEagerField : java/lang/annotation/Annotation { +public abstract interface class kotlinx/rpc/RemoteService : kotlinx/coroutines/CoroutineScope { } -public final class kotlinx/rpc/RPCField { - public fun (Ljava/lang/String;JLjava/lang/String;Lkotlin/reflect/KType;)V - public final fun component1 ()Ljava/lang/String; - public final fun component2 ()J - public final fun component3 ()Ljava/lang/String; - public final fun component4 ()Lkotlin/reflect/KType; - public final fun copy (Ljava/lang/String;JLjava/lang/String;Lkotlin/reflect/KType;)Lkotlinx/rpc/RPCField; - public static synthetic fun copy$default (Lkotlinx/rpc/RPCField;Ljava/lang/String;JLjava/lang/String;Lkotlin/reflect/KType;ILjava/lang/Object;)Lkotlinx/rpc/RPCField; +public final class kotlinx/rpc/RpcCall { + public fun (Lkotlinx/rpc/descriptor/RpcServiceDescriptor;Ljava/lang/String;Ljava/lang/Object;J)V + public final fun component1 ()Lkotlinx/rpc/descriptor/RpcServiceDescriptor; + public final fun component2 ()Ljava/lang/String; + public final fun component3 ()Ljava/lang/Object; + public final fun component4 ()J + public final fun copy (Lkotlinx/rpc/descriptor/RpcServiceDescriptor;Ljava/lang/String;Ljava/lang/Object;J)Lkotlinx/rpc/RpcCall; + public static synthetic fun copy$default (Lkotlinx/rpc/RpcCall;Lkotlinx/rpc/descriptor/RpcServiceDescriptor;Ljava/lang/String;Ljava/lang/Object;JILjava/lang/Object;)Lkotlinx/rpc/RpcCall; public fun equals (Ljava/lang/Object;)Z - public final fun getName ()Ljava/lang/String; + public final fun getCallableName ()Ljava/lang/String; + public final fun getData ()Ljava/lang/Object; + public final fun getDescriptor ()Lkotlinx/rpc/descriptor/RpcServiceDescriptor; public final fun getServiceId ()J - public final fun getServiceTypeString ()Ljava/lang/String; - public final fun getType ()Lkotlin/reflect/KType; public fun hashCode ()I public fun toString ()Ljava/lang/String; } -public abstract interface class kotlinx/rpc/RPCServer : kotlinx/coroutines/CoroutineScope { - public abstract fun registerService (Lkotlin/reflect/KClass;Lkotlin/jvm/functions/Function1;)V -} - -public abstract interface class kotlinx/rpc/RemoteService : kotlinx/coroutines/CoroutineScope { +public abstract interface class kotlinx/rpc/RpcClient : kotlinx/coroutines/CoroutineScope { + public abstract fun call (Lkotlinx/rpc/RpcCall;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public abstract fun callAsync (Lkotlinx/coroutines/CoroutineScope;Lkotlinx/rpc/RpcCall;)Lkotlinx/coroutines/Deferred; + public abstract fun provideStubContext (J)Lkotlin/coroutines/CoroutineContext; } public final class kotlinx/rpc/UninitializedRPCFieldException : java/lang/Exception { @@ -78,10 +51,48 @@ public final class kotlinx/rpc/UninitializedRPCFieldException : java/lang/Except } public final class kotlinx/rpc/WithServiceKt { - public static final fun withService (Lkotlinx/rpc/RPCClient;Lkotlin/reflect/KClass;)Lkotlinx/rpc/RemoteService; - public static final fun withService (Lkotlinx/rpc/RPCClient;Lkotlin/reflect/KType;)Lkotlinx/rpc/RemoteService; + public static final fun withService (Lkotlinx/rpc/RpcClient;Lkotlin/reflect/KClass;)Lkotlinx/rpc/RemoteService; + public static final fun withService (Lkotlinx/rpc/RpcClient;Lkotlin/reflect/KType;)Lkotlinx/rpc/RemoteService; } public abstract interface annotation class kotlinx/rpc/annotations/Rpc : java/lang/annotation/Annotation { } +public final class kotlinx/rpc/descriptor/RpcCallable { + public fun (Ljava/lang/String;Lkotlin/reflect/KType;Lkotlin/reflect/KType;Lkotlinx/rpc/descriptor/RpcInvokator;[Lkotlinx/rpc/descriptor/RpcParameter;)V + public final fun getDataType ()Lkotlin/reflect/KType; + public final fun getInvokator ()Lkotlinx/rpc/descriptor/RpcInvokator; + public final fun getName ()Ljava/lang/String; + public final fun getParameters ()[Lkotlinx/rpc/descriptor/RpcParameter; + public final fun getReturnType ()Lkotlin/reflect/KType; +} + +public abstract interface class kotlinx/rpc/descriptor/RpcInvokator { +} + +public abstract interface class kotlinx/rpc/descriptor/RpcInvokator$Field : kotlinx/rpc/descriptor/RpcInvokator { + public abstract fun call (Lkotlinx/rpc/RemoteService;)Ljava/lang/Object; +} + +public abstract interface class kotlinx/rpc/descriptor/RpcInvokator$Method : kotlinx/rpc/descriptor/RpcInvokator { + public abstract fun call (Lkotlinx/rpc/RemoteService;Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; +} + +public final class kotlinx/rpc/descriptor/RpcParameter { + public fun (Ljava/lang/String;Lkotlin/reflect/KType;)V + public final fun getName ()Ljava/lang/String; + public final fun getType ()Lkotlin/reflect/KType; +} + +public abstract interface class kotlinx/rpc/descriptor/RpcServiceDescriptor { + public abstract fun createInstance (JLkotlinx/rpc/RpcClient;)Lkotlinx/rpc/RemoteService; + public abstract fun getCallable (Ljava/lang/String;)Lkotlinx/rpc/descriptor/RpcCallable; + public abstract fun getFields (Lkotlinx/rpc/RemoteService;)Ljava/util/List; + public abstract fun getFqName ()Ljava/lang/String; +} + +public final class kotlinx/rpc/descriptor/RpcServiceDescriptorKt { + public static final fun serviceDescriptorOf (Lkotlin/reflect/KClass;)Lkotlinx/rpc/descriptor/RpcServiceDescriptor; + public static final fun serviceDescriptorOf (Lkotlin/reflect/KType;)Lkotlinx/rpc/descriptor/RpcServiceDescriptor; +} + diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 265cb43e9..f8c29adfe 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -4,12 +4,9 @@ import util.applyAtomicfuPlugin -/* - * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - plugins { alias(libs.plugins.conventions.kmp) + alias(libs.plugins.serialization) } applyAtomicfuPlugin() diff --git a/core/src/commonMain/kotlin/kotlinx/rpc/RPCCall.kt b/core/src/commonMain/kotlin/kotlinx/rpc/RPCCall.kt deleted file mode 100644 index d2aace238..000000000 --- a/core/src/commonMain/kotlin/kotlinx/rpc/RPCCall.kt +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - -package kotlinx.rpc - -import kotlin.reflect.KType - -/** - * Represents a method or field call of an RPC service. - * Contains all types and values information for the call, so it can be passed to a server. - * - * @property serviceTypeString The service type as a string. - * @property serviceId The id of a service that is unique within [RPCClient] services - * @property callableName The name of the callable. Can be the name of the method or field. - * @property type The type of call; - * @property data The data for the call. - * It may be a generated class with all parameters and their values or empty class for fields. - * @property dataType The [KType] of the [data]. - * @property returnType The [KType] of the return type. - */ -public data class RPCCall( - val serviceTypeString: String, - val serviceId: Long, - val callableName: String, - val type: Type, - val data: Any, - val dataType: KType, - val returnType: KType, -) { - public enum class Type { - Method, Field; - } -} - -/** - * Represents a field of the RPC service. - * Can be internally converted to a [RPCCall], but it depends on a specific [RPCClient] implementation. - * - * @property serviceTypeString The service type as a string. - * @property serviceId The id of a service that is unique within [RPCClient] services - * @property name The name of the field. - * @property type The [KType] of the field. - */ -public data class RPCField( - val serviceTypeString: String, - val serviceId: Long, - val name: String, - val type: KType -) diff --git a/core/src/commonMain/kotlin/kotlinx/rpc/RPCClient.kt b/core/src/commonMain/kotlin/kotlinx/rpc/RPCClient.kt deleted file mode 100644 index 8dd4ed0ce..000000000 --- a/core/src/commonMain/kotlin/kotlinx/rpc/RPCClient.kt +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - -package kotlinx.rpc - -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.SharedFlow -import kotlinx.coroutines.flow.StateFlow -import kotlin.coroutines.CoroutineContext - -/** - * RPCClient represents an abstraction of a RPC client, that can handle requests from several RPC services, - * transform them, send to the server and handle responses and errors. - * [CoroutineScope] defines the lifetime of the client. - */ -public interface RPCClient : CoroutineScope { - /** - * This method is used by generated clients to perform a call to the server. - * - * @param T type of the result - * @param call an object that contains all required information about the called method, - * that is needed to route it properly to the server. - * @return actual result of the call, e.g. data from the server. - */ - public suspend fun call(call: RPCCall): T - - /** - * Registers Flow field of the interface. Sends initialization request, subscribes to emitted values - * and returns the instance of the flow to be consumed - * - * @param T type parameter for Flow - * @param serviceScope Service's coroutine scope - * @param field object that contains information about the field, - * that is used to be mapped to the corresponding field pn server. - * @return Flow instance to be consumed. - */ - public fun registerPlainFlowField(serviceScope: CoroutineScope, field: RPCField): Flow - - /** - * Registers SharedFlow field of the interface. Sends initialization request, subscribes to emitted values - * and returns the instance of the flow to be consumed - * - * @param T type parameter for SharedFlow - * @param serviceScope Service's coroutine scope - * @param field object that contains information about the field, - * that is used to be mapped to the corresponding field pn server. - * @return SharedFlow instance to be consumed. - */ - public fun registerSharedFlowField(serviceScope: CoroutineScope, field: RPCField): SharedFlow - - /** - * Registers StateFlow field of the interface. Sends initialization request, subscribes to emitted values - * and returns the instance of the flow to be consumed - * - * @param T type parameter for StateFlow - * @param serviceScope Service's coroutine scope - * @param field object that contains information about the field, - * that is used to be mapped to the corresponding field pn server. - * @return StateFlow instance to be consumed. - */ - public fun registerStateFlowField(serviceScope: CoroutineScope, field: RPCField): StateFlow - - /** - * Provides child [CoroutineContext] for a new [RemoteService] service stub. - * - * This function shouldn't be called directly. - * - * @param serviceId id of the new service. Used for service cancellation messages. - */ - public fun provideStubContext(serviceId: Long): CoroutineContext -} diff --git a/core/src/commonMain/kotlin/kotlinx/rpc/RpcCall.kt b/core/src/commonMain/kotlin/kotlinx/rpc/RpcCall.kt new file mode 100644 index 000000000..7c08860ba --- /dev/null +++ b/core/src/commonMain/kotlin/kotlinx/rpc/RpcCall.kt @@ -0,0 +1,22 @@ +/* + * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package kotlinx.rpc + +import kotlinx.rpc.descriptor.RpcServiceDescriptor + +/** + * Represents a method or field call of an RPC service. + * + * @property descriptor [RpcServiceDescriptor] of a service that made the call. + * @property callableName The name of the callable. Can be the name of the method or field. + * @property data The data for the call. + * @property serviceId id of the service, that made the call. + */ +public data class RpcCall( + val descriptor: RpcServiceDescriptor<*>, + val callableName: String, + val data: Any, + val serviceId: Long, +) diff --git a/core/src/commonMain/kotlin/kotlinx/rpc/RpcClient.kt b/core/src/commonMain/kotlin/kotlinx/rpc/RpcClient.kt new file mode 100644 index 000000000..84ee9e252 --- /dev/null +++ b/core/src/commonMain/kotlin/kotlinx/rpc/RpcClient.kt @@ -0,0 +1,46 @@ +/* + * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package kotlinx.rpc + +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Deferred +import kotlin.coroutines.CoroutineContext + +/** + * [RpcClient] represents an abstraction of an RPC client, that can handle requests from several RPC services, + * transform them, send to the server and handle responses and errors. + * [CoroutineScope] defines the lifetime of the client. + */ +public interface RpcClient : CoroutineScope { + /** + * This method is used by generated clients to perform a call to the server. + * + * @param T type of the result + * @param call an object that contains all required information about the called method, + * that is needed to route it properly to the server. + * @return actual result of the call, for example, data from the server. + */ + public suspend fun call(call: RpcCall): T + + /** + * This method is used by generated clients to perform a call to the server. + * + * @param T type of the result + * @param serviceScope service's coroutine scope + * @param call an object that contains all required information about the called method, + * that is needed to route it properly to the server. + * @return actual result of the call, for example, data from the server + */ + public fun callAsync(serviceScope: CoroutineScope, call: RpcCall): Deferred + + /** + * Provides child [CoroutineContext] for a new [RemoteService] service stub. + * + * This function shouldn't be called directly. + * + * @param serviceId id of the new service. Used for service cancellation messages. + */ + public fun provideStubContext(serviceId: Long): CoroutineContext +} diff --git a/core/src/commonMain/kotlin/kotlinx/rpc/annotations/Rpc.kt b/core/src/commonMain/kotlin/kotlinx/rpc/annotations/Rpc.kt index 04566ee87..a42a48309 100644 --- a/core/src/commonMain/kotlin/kotlinx/rpc/annotations/Rpc.kt +++ b/core/src/commonMain/kotlin/kotlinx/rpc/annotations/Rpc.kt @@ -23,7 +23,7 @@ import kotlinx.rpc.RemoteService * suspend fun sayHello(firstName: String, lastName: String, age: Int): String * } * // client code - * val rpcClient: RPCClient + * val rpcClient: RpcClient * val myService = rpcClient.withService() * val greetingFromServer = myService.sayHello("Alex", "Smith", 35) * // server code diff --git a/core/src/commonMain/kotlin/kotlinx/rpc/awaitFieldInitialization.kt b/core/src/commonMain/kotlin/kotlinx/rpc/awaitFieldInitialization.kt index 9961247da..ca8b1f241 100644 --- a/core/src/commonMain/kotlin/kotlinx/rpc/awaitFieldInitialization.kt +++ b/core/src/commonMain/kotlin/kotlinx/rpc/awaitFieldInitialization.kt @@ -4,10 +4,8 @@ package kotlinx.rpc -import kotlinx.rpc.internal.RPCDeferredField -import kotlinx.rpc.internal.RPCServiceFieldsProvider -import kotlinx.rpc.internal.findRPCStubProvider -import kotlinx.rpc.internal.utils.safeCast +import kotlinx.rpc.descriptor.serviceDescriptorOf +import kotlinx.rpc.internal.RpcDeferredField import kotlin.reflect.KClass /** @@ -31,9 +29,9 @@ import kotlin.reflect.KClass public suspend fun T.awaitFieldInitialization(getter: T.() -> R): R { val field = getter() - if (field is RPCDeferredField<*>) { + if (field is RpcDeferredField<*>) { @Suppress("UNCHECKED_CAST") - return (field as RPCDeferredField).await() + return (field as RpcDeferredField).await() } error("Please choose required field for a valid RPC client generated by RPCClient.withService method") @@ -81,8 +79,8 @@ public suspend inline fun T.awaitFieldInitialization * @return specified service, after all of it's field were initialized. */ public suspend fun T.awaitFieldInitialization(kClass: KClass): T { - findRPCStubProvider>(kClass, RPCServiceFieldsProvider::class.safeCast()) - .rpcFields(this) + serviceDescriptorOf(kClass) + .getFields(this) .forEach { field -> field.await() } diff --git a/core/src/commonMain/kotlin/kotlinx/rpc/descriptor/RpcServiceDescriptor.kt b/core/src/commonMain/kotlin/kotlinx/rpc/descriptor/RpcServiceDescriptor.kt new file mode 100644 index 000000000..a4cb35735 --- /dev/null +++ b/core/src/commonMain/kotlin/kotlinx/rpc/descriptor/RpcServiceDescriptor.kt @@ -0,0 +1,77 @@ +/* + * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package kotlinx.rpc.descriptor + +import kotlinx.rpc.RemoteService +import kotlinx.rpc.RpcClient +import kotlinx.rpc.internal.* +import kotlinx.rpc.internal.utils.ExperimentalRPCApi +import kotlinx.rpc.internal.utils.InternalRPCApi +import kotlin.reflect.KClass +import kotlin.reflect.KType + +@ExperimentalRPCApi +public inline fun serviceDescriptorOf(): RpcServiceDescriptor { + return serviceDescriptorOf(T::class) +} + +@ExperimentalRPCApi +public fun serviceDescriptorOf(kType: KType): RpcServiceDescriptor { + return serviceDescriptorOf(kType.kClass()) +} + +@ExperimentalRPCApi +public fun serviceDescriptorOf(kClass: KClass): RpcServiceDescriptor { + val maybeDescriptor = internalServiceDescriptorOf(kClass) + ?: internalError("Unable to find a service descriptor of the $kClass") + + if (maybeDescriptor is RpcServiceDescriptor<*>) { + @Suppress("UNCHECKED_CAST") + return maybeDescriptor as RpcServiceDescriptor + } + + internalError( + "Located descriptor object is not of a desired type ${RpcServiceDescriptor::class}, " + + "instead found $maybeDescriptor of the class " + + (maybeDescriptor::class.qualifiedClassNameOrNull ?: maybeDescriptor::class) + ) +} + +@ExperimentalRPCApi +public interface RpcServiceDescriptor { + public val fqName: String + + @InternalRPCApi + public fun getFields(service: T): List> + + public fun getCallable(name: String): RpcCallable? + + public fun createInstance(serviceId: Long, client: RpcClient): T +} + +@ExperimentalRPCApi +public class RpcCallable( + public val name: String, + public val dataType: KType, + public val returnType: KType, + public val invokator: RpcInvokator, + public val parameters: Array, +) + +@ExperimentalRPCApi +public sealed interface RpcInvokator { + @ExperimentalRPCApi + public fun interface Method : RpcInvokator { + public suspend fun call(service: T, data: Any?): Any? + } + + @ExperimentalRPCApi + public fun interface Field : RpcInvokator { + public fun call(service: T): Any? + } +} + +@ExperimentalRPCApi +public class RpcParameter(public val name: String, public val type: KType) diff --git a/core/src/commonMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.kt b/core/src/commonMain/kotlin/kotlinx/rpc/internal/FieldDataObject.kt similarity index 62% rename from core/src/commonMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.kt rename to core/src/commonMain/kotlin/kotlinx/rpc/internal/FieldDataObject.kt index be0bacfd4..9140766a9 100644 --- a/core/src/commonMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.kt +++ b/core/src/commonMain/kotlin/kotlinx/rpc/internal/FieldDataObject.kt @@ -5,7 +5,11 @@ package kotlinx.rpc.internal import kotlinx.rpc.internal.utils.InternalRPCApi -import kotlin.reflect.KClass +import kotlinx.serialization.Serializable +/** + * Used for field initialization call + */ +@Serializable @InternalRPCApi -public expect fun findRPCStubProvider(kClass: KClass<*>, resultKClass: KClass): R +public object FieldDataObject diff --git a/core/src/commonMain/kotlin/kotlinx/rpc/internal/RPCStubObject.kt b/core/src/commonMain/kotlin/kotlinx/rpc/internal/RPCStubObject.kt deleted file mode 100644 index 2cef230d9..000000000 --- a/core/src/commonMain/kotlin/kotlinx/rpc/internal/RPCStubObject.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - -package kotlinx.rpc.internal - -import kotlinx.rpc.RPCClient -import kotlinx.rpc.RemoteService -import kotlinx.rpc.internal.utils.InternalRPCApi -import kotlin.reflect.KType - -@InternalRPCApi -public interface RPCStubObject : - RPCStubServiceProvider, - RPCServiceMethodSerializationTypeProvider, - RPCServiceFieldsProvider - -@InternalRPCApi -public interface RPCStubServiceProvider { - public fun withClient(serviceId: Long, client: RPCClient) : T -} - -@InternalRPCApi -public interface RPCServiceMethodSerializationTypeProvider { - public fun methodTypeOf(methodName: String): KType? -} - -@InternalRPCApi -public interface RPCServiceFieldsProvider { - public fun rpcFields(service: T): List> -} diff --git a/core/src/commonMain/kotlin/kotlinx/rpc/internal/RPCDeferredField.kt b/core/src/commonMain/kotlin/kotlinx/rpc/internal/RpcDeferredField.kt similarity index 86% rename from core/src/commonMain/kotlin/kotlinx/rpc/internal/RPCDeferredField.kt rename to core/src/commonMain/kotlin/kotlinx/rpc/internal/RpcDeferredField.kt index bb1e28c3b..61dfea9c7 100644 --- a/core/src/commonMain/kotlin/kotlinx/rpc/internal/RPCDeferredField.kt +++ b/core/src/commonMain/kotlin/kotlinx/rpc/internal/RpcDeferredField.kt @@ -7,6 +7,6 @@ package kotlinx.rpc.internal import kotlinx.rpc.internal.utils.InternalRPCApi @InternalRPCApi -public interface RPCDeferredField { +public interface RpcDeferredField { public suspend fun await(): Self } diff --git a/krpc/krpc-client/src/commonMain/kotlin/kotlinx/rpc/krpc/client/internal/RPCFieldProvider.kt b/core/src/commonMain/kotlin/kotlinx/rpc/internal/RpcFieldProvider.kt similarity index 72% rename from krpc/krpc-client/src/commonMain/kotlin/kotlinx/rpc/krpc/client/internal/RPCFieldProvider.kt rename to core/src/commonMain/kotlin/kotlinx/rpc/internal/RpcFieldProvider.kt index 474b2ec8e..7067212ad 100644 --- a/krpc/krpc-client/src/commonMain/kotlin/kotlinx/rpc/krpc/client/internal/RPCFieldProvider.kt +++ b/core/src/commonMain/kotlin/kotlinx/rpc/internal/RpcFieldProvider.kt @@ -2,16 +2,17 @@ * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ -package kotlinx.rpc.krpc.client.internal +package kotlinx.rpc.internal import kotlinx.coroutines.CompletableDeferred +import kotlinx.coroutines.Deferred import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.rpc.UninitializedRPCFieldException import kotlin.reflect.KProperty -internal class RPCFieldProvider( +internal class RpcFieldProvider( private val serviceName: String, - private val deferred: CompletableDeferred = CompletableDeferred(), + private val deferred: Deferred = CompletableDeferred(), val getter: T.() -> R, ) { @OptIn(ExperimentalCoroutinesApi::class) @@ -25,9 +26,9 @@ internal class RPCFieldProvider( } @Suppress("unused") -internal fun RPCFieldProvider( +internal fun RpcFieldProvider( serviceName: String, deferred: CompletableDeferred = CompletableDeferred() -): RPCFieldProvider { - return RPCFieldProvider(serviceName, deferred) { this } +): RpcFieldProvider { + return RpcFieldProvider(serviceName, deferred) { this } } diff --git a/krpc/krpc-client/src/commonMain/kotlin/kotlinx/rpc/krpc/client/internal/RPCFlow.kt b/core/src/commonMain/kotlin/kotlinx/rpc/internal/RpcFlow.kt similarity index 51% rename from krpc/krpc-client/src/commonMain/kotlin/kotlinx/rpc/krpc/client/internal/RPCFlow.kt rename to core/src/commonMain/kotlin/kotlinx/rpc/internal/RpcFlow.kt index 4ca907293..a074d0226 100644 --- a/krpc/krpc-client/src/commonMain/kotlin/kotlinx/rpc/krpc/client/internal/RPCFlow.kt +++ b/core/src/commonMain/kotlin/kotlinx/rpc/internal/RpcFlow.kt @@ -2,34 +2,35 @@ * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ -package kotlinx.rpc.krpc.client.internal +package kotlinx.rpc.internal -import kotlinx.coroutines.CompletableDeferred -import kotlinx.coroutines.Job +import kotlinx.coroutines.Deferred import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.FlowCollector import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.StateFlow -import kotlinx.rpc.internal.RPCDeferredField -import kotlinx.rpc.internal.utils.SupervisedCompletableDeferred - -internal sealed class RPCFlow>(private val serviceName: String, parent: Job) : - RPCDeferredField { - val deferred: CompletableDeferred = SupervisedCompletableDeferred(parent) +internal sealed class RpcFlow>( + private val serviceName: String, + protected val deferred: Deferred, +) : RpcDeferredField { override suspend fun await(): FlowT { return deferred.await() } - internal class Plain(serviceName: String, parent: Job) : RPCFlow>(serviceName, parent), - Flow { + internal class Plain( + serviceName: String, + deferred: Deferred>, + ) : RpcFlow>(serviceName, deferred), Flow { override suspend fun collect(collector: FlowCollector) { deferred.await().collect(collector) } } - internal class Shared(serviceName: String, parent: Job) : RPCFlow>(serviceName, parent), - SharedFlow { + internal class Shared( + serviceName: String, + deferred: Deferred>, + ) : RpcFlow>(serviceName, deferred), SharedFlow { override val replayCache: List by rpcProperty { replayCache } override suspend fun collect(collector: FlowCollector): Nothing { @@ -37,8 +38,10 @@ internal sealed class RPCFlow>(private val serviceName: Strin } } - internal class State(serviceName: String, parent: Job) : RPCFlow>(serviceName, parent), - StateFlow { + internal class State( + serviceName: String, + deferred: Deferred>, + ) : RpcFlow>(serviceName, deferred), StateFlow { override val value: T by rpcProperty { value } override val replayCache: List by rpcProperty { replayCache } @@ -48,7 +51,7 @@ internal sealed class RPCFlow>(private val serviceName: Strin } } - protected fun rpcProperty(getter: FlowT.() -> R): RPCFieldProvider { - return RPCFieldProvider(serviceName, deferred, getter) + protected fun rpcProperty(getter: FlowT.() -> R): RpcFieldProvider { + return RpcFieldProvider(serviceName, deferred, getter) } } diff --git a/core/src/commonMain/kotlin/kotlinx/rpc/internal/RPCMethodClassArguments.kt b/core/src/commonMain/kotlin/kotlinx/rpc/internal/RpcMethodClass.kt similarity index 86% rename from core/src/commonMain/kotlin/kotlinx/rpc/internal/RPCMethodClassArguments.kt rename to core/src/commonMain/kotlin/kotlinx/rpc/internal/RpcMethodClass.kt index 03caf8bba..3ba3a155a 100644 --- a/core/src/commonMain/kotlin/kotlinx/rpc/internal/RPCMethodClassArguments.kt +++ b/core/src/commonMain/kotlin/kotlinx/rpc/internal/RpcMethodClass.kt @@ -7,6 +7,6 @@ package kotlinx.rpc.internal import kotlinx.rpc.internal.utils.InternalRPCApi @InternalRPCApi -public interface RPCMethodClassArguments { +public interface RpcMethodClass { public fun asArray(): Array } diff --git a/core/src/commonMain/kotlin/kotlinx/rpc/internal/dataCast.kt b/core/src/commonMain/kotlin/kotlinx/rpc/internal/dataCast.kt new file mode 100644 index 000000000..d9ce0761e --- /dev/null +++ b/core/src/commonMain/kotlin/kotlinx/rpc/internal/dataCast.kt @@ -0,0 +1,17 @@ +/* + * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package kotlinx.rpc.internal + +import kotlinx.rpc.internal.utils.InternalRPCApi + +@InternalRPCApi +public inline fun Any?.dataCast(methodName: String, serviceName: String): T { + return this as? T + ?: throw IllegalArgumentException( + "Wrong data type for $methodName in service $serviceName. " + + "Please, provide only data that is generated by the service " + + "and passed in RpcCall.data, or deserialized version of this data." + ) +} diff --git a/core/src/commonMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.kt b/core/src/commonMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.kt new file mode 100644 index 000000000..263c0144b --- /dev/null +++ b/core/src/commonMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.kt @@ -0,0 +1,10 @@ +/* + * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package kotlinx.rpc.internal + +import kotlinx.rpc.RemoteService +import kotlin.reflect.KClass + +internal expect fun internalServiceDescriptorOf(kClass: KClass): Any? diff --git a/core/src/commonMain/kotlin/kotlinx/rpc/registerField.kt b/core/src/commonMain/kotlin/kotlinx/rpc/registerField.kt new file mode 100644 index 000000000..59ad6cdcc --- /dev/null +++ b/core/src/commonMain/kotlin/kotlinx/rpc/registerField.kt @@ -0,0 +1,86 @@ +/* + * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package kotlinx.rpc + +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Deferred +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.SharedFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.rpc.descriptor.RpcServiceDescriptor +import kotlinx.rpc.internal.FieldDataObject +import kotlinx.rpc.internal.RpcFlow + +/** + * Registers Flow field of the interface. Sends initialization request, subscribes to emitted values + * and returns the instance of the flow to be consumed + * + * @param T type parameter for Flow + * @param serviceScope Service's coroutine scope + * @param descriptor descriptor of the service, that made the call + * that is used to be mapped to the corresponding field on a server. + * @param fieldName the name of the field. + * @param serviceId id of the service, that made the call + * @return Flow instance to be consumed. + */ +public fun RpcClient.registerPlainFlowField( + serviceScope: CoroutineScope, + descriptor: RpcServiceDescriptor<*>, + fieldName: String, + serviceId: Long, +): Flow { + return RpcFlow.Plain(descriptor.fqName, initializeFlowField(serviceScope, descriptor, fieldName, serviceId)) +} + +/** + * Registers SharedFlow field of the interface. Sends initialization request, subscribes to emitted values + * and returns the instance of the flow to be consumed + * + * @param T type parameter for SharedFlow + * @param serviceScope Service's coroutine scope + * @param descriptor descriptor of the service, that made the call + * that is used to be mapped to the corresponding field on a server. + * @param fieldName the name of the field. + * @param serviceId id of the service, that made the call + * @return SharedFlow instance to be consumed. + */ +public fun RpcClient.registerSharedFlowField( + serviceScope: CoroutineScope, + descriptor: RpcServiceDescriptor<*>, + fieldName: String, + serviceId: Long, +): SharedFlow { + return RpcFlow.Shared(descriptor.fqName, initializeFlowField(serviceScope, descriptor, fieldName, serviceId)) +} + +/** + * Registers StateFlow field of the interface. Sends initialization request, subscribes to emitted values + * and returns the instance of the flow to be consumed + * + * @param T type parameter for StateFlow + * @param serviceScope Service's coroutine scope + * @param descriptor descriptor of the service, that made the call + * that is used to be mapped to the corresponding field on a server. + * @param fieldName the name of the field. + * @param serviceId id of the service, that made the call + * @return StateFlow instance to be consumed. + */ +public fun RpcClient.registerStateFlowField( + serviceScope: CoroutineScope, + descriptor: RpcServiceDescriptor<*>, + fieldName: String, + serviceId: Long, +): StateFlow { + return RpcFlow.State(descriptor.fqName, initializeFlowField(serviceScope, descriptor, fieldName, serviceId)) +} + +private fun > RpcClient.initializeFlowField( + serviceScope: CoroutineScope, + descriptor: RpcServiceDescriptor<*>, + fieldName: String, + serviceId: Long, +): Deferred { + return callAsync(serviceScope, RpcCall(descriptor, fieldName, FieldDataObject, serviceId)) +} diff --git a/core/src/commonMain/kotlin/kotlinx/rpc/withService.kt b/core/src/commonMain/kotlin/kotlinx/rpc/withService.kt index 10123a523..57697dd39 100644 --- a/core/src/commonMain/kotlin/kotlinx/rpc/withService.kt +++ b/core/src/commonMain/kotlin/kotlinx/rpc/withService.kt @@ -5,27 +5,25 @@ package kotlinx.rpc import kotlinx.atomicfu.atomic -import kotlinx.rpc.internal.RPCStubServiceProvider -import kotlinx.rpc.internal.findRPCStubProvider +import kotlinx.rpc.descriptor.serviceDescriptorOf import kotlinx.rpc.internal.kClass -import kotlinx.rpc.internal.utils.safeCast import kotlin.reflect.KClass import kotlin.reflect.KType /** - * Creates instance of the generated service [T], that is able to communicate with server using RPCClient. + * Creates instance of the generated service [T], that is able to communicate with server using [RpcClient]. * * [awaitFieldInitialization] method can be used on that instance. * * @param T the exact type of the service to be created. * @return instance of the generated service. */ -public inline fun RPCClient.withService(): T { +public inline fun RpcClient.withService(): T { return withService(T::class) } /** - * Creates instance of the generated service [T], that is able to communicate with server using RPCClient. + * Creates instance of the generated service [T], that is able to communicate with server using [RpcClient]. * * [awaitFieldInitialization] method can be used on that instance. * @@ -33,7 +31,7 @@ public inline fun RPCClient.withService(): T { * @param serviceKType [KType] of the service to be created. * @return instance of the generated service. */ -public fun RPCClient.withService(serviceKType: KType): T { +public fun RpcClient.withService(serviceKType: KType): T { return withService(serviceKType.kClass()) } @@ -44,7 +42,7 @@ public fun RPCClient.withService(serviceKType: KType): T { private val SERVICE_ID = atomic(0L) /** - * Creates instance of the generated service [T], that is able to communicate with server using RPCClient. + * Creates instance of the generated service [T], that is able to communicate with server using [RpcClient]. * * [awaitFieldInitialization] method can be used on that instance. * @@ -52,13 +50,10 @@ private val SERVICE_ID = atomic(0L) * @param serviceKClass [KClass] of the service to be created. * @return instance of the generated service. */ -public fun RPCClient.withService(serviceKClass: KClass): T { - val provider = findRPCStubProvider>( - kClass = serviceKClass, - resultKClass = RPCStubServiceProvider::class.safeCast(), - ) +public fun RpcClient.withService(serviceKClass: KClass): T { + val descriptor = serviceDescriptorOf(serviceKClass) val id = SERVICE_ID.incrementAndGet() - return provider.withClient(id, this) + return descriptor.createInstance(id, this) } diff --git a/core/src/jsMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.js.kt b/core/src/jsMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.js.kt similarity index 58% rename from core/src/jsMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.js.kt rename to core/src/jsMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.js.kt index 2a40cf266..a40507788 100644 --- a/core/src/jsMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.js.kt +++ b/core/src/jsMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.js.kt @@ -8,6 +8,7 @@ package kotlinx.rpc.internal import js.objects.Object import kotlinx.rpc.RemoteService +import kotlinx.rpc.descriptor.RpcServiceDescriptor import kotlinx.rpc.internal.utils.InternalRPCApi import kotlin.reflect.AssociatedObjectKey import kotlin.reflect.ExperimentalAssociatedObjects @@ -18,26 +19,13 @@ import kotlin.reflect.findAssociatedObject @AssociatedObjectKey @OptIn(ExperimentalAssociatedObjects::class) @Target(AnnotationTarget.CLASS) -public annotation class WithRPCStubObject( +public annotation class WithServiceDescriptor( @Suppress("unused") - val stub: KClass>, + val stub: KClass>, ) -@InternalRPCApi -public actual fun findRPCStubProvider(kClass: KClass<*>, resultKClass: KClass): R { - val associatedObject = kClass.findAssociatedObjectImpl(WithRPCStubObject::class, resultKClass) - ?: internalError("Unable to find $kClass associated object") - - if (resultKClass.isInstance(associatedObject)) { - @Suppress("UNCHECKED_CAST") - return associatedObject as R - } - - internalError( - "Located associated object is not of desired type $resultKClass, " + - "instead found $associatedObject of class " + - (associatedObject::class.qualifiedClassNameOrNull ?: associatedObject::class.js.name) - ) +internal actual fun internalServiceDescriptorOf(kClass: KClass): Any? { + return kClass.findAssociatedObjectImpl(WithServiceDescriptor::class) } /** @@ -46,22 +34,19 @@ public actual fun findRPCStubProvider(kClass: KClass<*>, resultKClass: * * This function uses std-lib's implementation and accounts for the bug in the compiler */ -internal fun KClass<*>.findAssociatedObjectImpl( - annotationClass: KClass, - resultKClass: KClass, -): Any? { +internal fun KClass<*>.findAssociatedObjectImpl(annotationClass: KClass): Any? { val key = annotationClass.js.asDynamic().`$metadata$`?.associatedObjectKey?.unsafeCast() ?: return null val map = js.asDynamic().`$metadata$`?.associatedObjects ?: return null - val factory = map[key] ?: return fallbackFindAssociatedObjectImpl(map, resultKClass) + val factory = map[key] ?: return fallbackFindAssociatedObjectImpl(map) return factory() } -private fun fallbackFindAssociatedObjectImpl(map: dynamic, resultKClass: KClass): R? { +private fun fallbackFindAssociatedObjectImpl(map: dynamic): R? { return Object.entries(map as Any) .mapNotNull { (_, factory) -> val unsafeFactory = factory.asDynamic() val maybeObject = unsafeFactory() - if (resultKClass.isInstance(maybeObject)) { + if (RpcServiceDescriptor::class.isInstance(maybeObject)) { maybeObject.unsafeCast() } else { null diff --git a/core/src/jvmMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.jvm.kt b/core/src/jvmMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.jvm.kt deleted file mode 100644 index 341d496a6..000000000 --- a/core/src/jvmMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.jvm.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - -@file:Suppress("unused") - -package kotlinx.rpc.internal - -import kotlinx.rpc.internal.utils.InternalRPCApi -import kotlin.reflect.KClass -import kotlin.reflect.full.companionObjectInstance - -private const val RPC_SERVICE_STUB_SIMPLE_NAME = "\$rpcServiceStub" - -@InternalRPCApi -public actual fun findRPCStubProvider(kClass: KClass<*>, resultKClass: KClass): R { - val className = when { - KotlinVersion.CURRENT.isAtLeast(2, 0) -> { - "${kClass.qualifiedName}\$$RPC_SERVICE_STUB_SIMPLE_NAME" - } - - else -> { - error("kotlinx.rpc runtime is not compatible with Kotlin version prior to 2.0") - } - } - - val candidate = kClass.java.classLoader - .loadClass(className) - ?.kotlin - ?.companionObjectInstance - - @Suppress("UNCHECKED_CAST") - if (resultKClass.isInstance(candidate)) { - return candidate as R - } - - internalError("unable to find $kClass rpc client object") -} diff --git a/core/src/jvmMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.jvm.kt b/core/src/jvmMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.jvm.kt new file mode 100644 index 000000000..382fc763d --- /dev/null +++ b/core/src/jvmMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.jvm.kt @@ -0,0 +1,20 @@ +/* + * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package kotlinx.rpc.internal + +import kotlinx.rpc.RemoteService +import kotlin.reflect.KClass +import kotlin.reflect.full.companionObjectInstance + +private const val RPC_SERVICE_STUB_SIMPLE_NAME = "\$rpcServiceStub" + +internal actual fun internalServiceDescriptorOf(kClass: KClass): Any? { + val className = "${kClass.qualifiedName}\$$RPC_SERVICE_STUB_SIMPLE_NAME" + + return kClass.java.classLoader + .loadClass(className) + ?.kotlin + ?.companionObjectInstance +} diff --git a/core/src/nativeMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.native.kt b/core/src/nativeMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.native.kt deleted file mode 100644 index b7da9531f..000000000 --- a/core/src/nativeMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.native.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - -@file:Suppress("detekt.MatchingDeclarationName") - -package kotlinx.rpc.internal - -import kotlinx.rpc.RemoteService -import kotlinx.rpc.internal.utils.InternalRPCApi -import kotlin.reflect.AssociatedObjectKey -import kotlin.reflect.ExperimentalAssociatedObjects -import kotlin.reflect.KClass -import kotlin.reflect.findAssociatedObject - -@InternalRPCApi -@AssociatedObjectKey -@OptIn(ExperimentalAssociatedObjects::class) -@Target(AnnotationTarget.CLASS) -public annotation class WithRPCStubObject( - @Suppress("unused") - val stub: KClass>, -) - -@InternalRPCApi -@OptIn(ExperimentalAssociatedObjects::class) -public actual fun findRPCStubProvider(kClass: KClass<*>, resultKClass: KClass): R { - val associatedObject = kClass.findAssociatedObject() - ?: internalError("Unable to find $kClass associated object") - - @Suppress("UNCHECKED_CAST") - if (resultKClass.isInstance(associatedObject)) { - return associatedObject as R - } - - internalError( - "Located associated object is not of desired type $resultKClass, " + - "instead found $associatedObject of class " + - (associatedObject::class.qualifiedClassNameOrNull ?: associatedObject::class.simpleName) - ) -} diff --git a/core/src/nativeMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.native.kt b/core/src/nativeMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.native.kt new file mode 100644 index 000000000..7bd0085c7 --- /dev/null +++ b/core/src/nativeMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.native.kt @@ -0,0 +1,29 @@ +/* + * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +@file:Suppress("detekt.MatchingDeclarationName") + +package kotlinx.rpc.internal + +import kotlinx.rpc.RemoteService +import kotlinx.rpc.descriptor.RpcServiceDescriptor +import kotlinx.rpc.internal.utils.InternalRPCApi +import kotlin.reflect.AssociatedObjectKey +import kotlin.reflect.ExperimentalAssociatedObjects +import kotlin.reflect.KClass +import kotlin.reflect.findAssociatedObject + +@InternalRPCApi +@AssociatedObjectKey +@OptIn(ExperimentalAssociatedObjects::class) +@Target(AnnotationTarget.CLASS) +public annotation class WithServiceDescriptor( + @Suppress("unused") + val stub: KClass>, +) + +@OptIn(ExperimentalAssociatedObjects::class) +internal actual fun internalServiceDescriptorOf(kClass: KClass): Any? { + return kClass.findAssociatedObject() +} diff --git a/core/src/wasmJsMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.wasm.kt b/core/src/wasmJsMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.wasm.kt deleted file mode 100644 index 0b03caeca..000000000 --- a/core/src/wasmJsMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.wasm.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - -@file:Suppress("detekt.MatchingDeclarationName") - -package kotlinx.rpc.internal - -import kotlinx.rpc.RemoteService -import kotlinx.rpc.internal.utils.InternalRPCApi -import kotlin.reflect.AssociatedObjectKey -import kotlin.reflect.ExperimentalAssociatedObjects -import kotlin.reflect.KClass -import kotlin.reflect.findAssociatedObject - -@InternalRPCApi -@AssociatedObjectKey -@OptIn(ExperimentalAssociatedObjects::class) -@Target(AnnotationTarget.CLASS) -public annotation class WithRPCStubObject( - @Suppress("unused") - val stub: KClass>, -) - -@OptIn(ExperimentalAssociatedObjects::class) -@InternalRPCApi -public actual fun findRPCStubProvider(kClass: KClass<*>, resultKClass: KClass): R { - val associatedObject = kClass.findAssociatedObject() - ?: internalError("Unable to find $kClass associated object") - - if (resultKClass.isInstance(associatedObject)) { - @Suppress("UNCHECKED_CAST") - return associatedObject as R - } - - internalError( - "Located associated object is not of desired type $resultKClass, " + - "instead found $associatedObject of class " + - (associatedObject::class.qualifiedClassNameOrNull ?: associatedObject::class) - ) -} diff --git a/core/src/wasmJsMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.wasmJs.kt b/core/src/wasmJsMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.wasmJs.kt new file mode 100644 index 000000000..7635bbeac --- /dev/null +++ b/core/src/wasmJsMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.wasmJs.kt @@ -0,0 +1,27 @@ +/* + * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package kotlinx.rpc.internal + +import kotlinx.rpc.RemoteService +import kotlinx.rpc.descriptor.RpcServiceDescriptor +import kotlinx.rpc.internal.utils.InternalRPCApi +import kotlin.reflect.AssociatedObjectKey +import kotlin.reflect.ExperimentalAssociatedObjects +import kotlin.reflect.KClass +import kotlin.reflect.findAssociatedObject + +@InternalRPCApi +@AssociatedObjectKey +@OptIn(ExperimentalAssociatedObjects::class) +@Target(AnnotationTarget.CLASS) +public annotation class WithServiceDescriptor( + @Suppress("unused") + val stub: KClass>, +) + +@OptIn(ExperimentalAssociatedObjects::class) +internal actual fun internalServiceDescriptorOf(kClass: KClass): Any? { + return kClass.findAssociatedObject() +} diff --git a/core/src/wasmWasiMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.wasi.kt b/core/src/wasmWasiMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.wasi.kt deleted file mode 100644 index 0b03caeca..000000000 --- a/core/src/wasmWasiMain/kotlin/kotlinx/rpc/internal/WithRPCStubObject.wasi.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - -@file:Suppress("detekt.MatchingDeclarationName") - -package kotlinx.rpc.internal - -import kotlinx.rpc.RemoteService -import kotlinx.rpc.internal.utils.InternalRPCApi -import kotlin.reflect.AssociatedObjectKey -import kotlin.reflect.ExperimentalAssociatedObjects -import kotlin.reflect.KClass -import kotlin.reflect.findAssociatedObject - -@InternalRPCApi -@AssociatedObjectKey -@OptIn(ExperimentalAssociatedObjects::class) -@Target(AnnotationTarget.CLASS) -public annotation class WithRPCStubObject( - @Suppress("unused") - val stub: KClass>, -) - -@OptIn(ExperimentalAssociatedObjects::class) -@InternalRPCApi -public actual fun findRPCStubProvider(kClass: KClass<*>, resultKClass: KClass): R { - val associatedObject = kClass.findAssociatedObject() - ?: internalError("Unable to find $kClass associated object") - - if (resultKClass.isInstance(associatedObject)) { - @Suppress("UNCHECKED_CAST") - return associatedObject as R - } - - internalError( - "Located associated object is not of desired type $resultKClass, " + - "instead found $associatedObject of class " + - (associatedObject::class.qualifiedClassNameOrNull ?: associatedObject::class) - ) -} diff --git a/core/src/wasmWasiMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.wasmWasi.kt b/core/src/wasmWasiMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.wasmWasi.kt new file mode 100644 index 000000000..7635bbeac --- /dev/null +++ b/core/src/wasmWasiMain/kotlin/kotlinx/rpc/internal/internalServiceDescriptorOf.wasmWasi.kt @@ -0,0 +1,27 @@ +/* + * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package kotlinx.rpc.internal + +import kotlinx.rpc.RemoteService +import kotlinx.rpc.descriptor.RpcServiceDescriptor +import kotlinx.rpc.internal.utils.InternalRPCApi +import kotlin.reflect.AssociatedObjectKey +import kotlin.reflect.ExperimentalAssociatedObjects +import kotlin.reflect.KClass +import kotlin.reflect.findAssociatedObject + +@InternalRPCApi +@AssociatedObjectKey +@OptIn(ExperimentalAssociatedObjects::class) +@Target(AnnotationTarget.CLASS) +public annotation class WithServiceDescriptor( + @Suppress("unused") + val stub: KClass>, +) + +@OptIn(ExperimentalAssociatedObjects::class) +internal actual fun internalServiceDescriptorOf(kClass: KClass): Any? { + return kClass.findAssociatedObject() +} diff --git a/krpc/krpc-client/api/krpc-client.api b/krpc/krpc-client/api/krpc-client.api index d62feabc2..efb6a3091 100644 --- a/krpc/krpc-client/api/krpc-client.api +++ b/krpc/krpc-client/api/krpc-client.api @@ -1,12 +1,10 @@ -public abstract class kotlinx/rpc/krpc/client/KRPCClient : kotlinx/rpc/krpc/internal/RPCServiceHandler, kotlinx/rpc/RPCClient, kotlinx/rpc/krpc/internal/RPCEndpoint { +public abstract class kotlinx/rpc/krpc/client/KRPCClient : kotlinx/rpc/krpc/internal/RPCServiceHandler, kotlinx/rpc/RpcClient, kotlinx/rpc/krpc/internal/RPCEndpoint { public fun (Lkotlinx/rpc/krpc/RPCConfig$Client;Lkotlinx/rpc/krpc/RPCTransport;)V - public final fun call (Lkotlinx/rpc/RPCCall;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public final fun call (Lkotlinx/rpc/RpcCall;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun callAsync (Lkotlinx/coroutines/CoroutineScope;Lkotlinx/rpc/RpcCall;)Lkotlinx/coroutines/Deferred; protected final fun getConfig ()Lkotlinx/rpc/krpc/RPCConfig$Client; public synthetic fun getConfig ()Lkotlinx/rpc/krpc/RPCConfig; public final fun getCoroutineContext ()Lkotlin/coroutines/CoroutineContext; protected fun getLogger ()Lkotlinx/rpc/krpc/internal/logging/CommonLogger; - public final fun registerPlainFlowField (Lkotlinx/coroutines/CoroutineScope;Lkotlinx/rpc/RPCField;)Lkotlinx/coroutines/flow/Flow; - public final fun registerSharedFlowField (Lkotlinx/coroutines/CoroutineScope;Lkotlinx/rpc/RPCField;)Lkotlinx/coroutines/flow/SharedFlow; - public final fun registerStateFlowField (Lkotlinx/coroutines/CoroutineScope;Lkotlinx/rpc/RPCField;)Lkotlinx/coroutines/flow/StateFlow; } diff --git a/krpc/krpc-client/src/commonMain/kotlin/kotlinx/rpc/krpc/client/KRPCClient.kt b/krpc/krpc-client/src/commonMain/kotlin/kotlinx/rpc/krpc/client/KRPCClient.kt index 445e498d9..3cbeab111 100644 --- a/krpc/krpc-client/src/commonMain/kotlin/kotlinx/rpc/krpc/client/KRPCClient.kt +++ b/krpc/krpc-client/src/commonMain/kotlin/kotlinx/rpc/krpc/client/KRPCClient.kt @@ -6,21 +6,16 @@ package kotlinx.rpc.krpc.client import kotlinx.atomicfu.atomic import kotlinx.coroutines.* -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.SharedFlow -import kotlinx.coroutines.flow.StateFlow -import kotlinx.rpc.RPCCall -import kotlinx.rpc.RPCClient -import kotlinx.rpc.RPCField +import kotlinx.rpc.RpcCall +import kotlinx.rpc.RpcClient +import kotlinx.rpc.descriptor.RpcCallable import kotlinx.rpc.internal.serviceScopeOrNull import kotlinx.rpc.internal.utils.InternalRPCApi import kotlinx.rpc.internal.utils.SupervisedCompletableDeferred import kotlinx.rpc.internal.utils.getOrNull import kotlinx.rpc.internal.utils.map.ConcurrentHashMap import kotlinx.rpc.krpc.* -import kotlinx.rpc.krpc.client.internal.FieldDataObject import kotlinx.rpc.krpc.client.internal.RPCClientConnector -import kotlinx.rpc.krpc.client.internal.RPCFlow import kotlinx.rpc.krpc.internal.* import kotlinx.rpc.krpc.internal.logging.CommonLogger import kotlinx.serialization.BinaryFormat @@ -28,10 +23,9 @@ import kotlinx.serialization.SerialFormat import kotlinx.serialization.StringFormat import kotlin.coroutines.CoroutineContext import kotlin.coroutines.cancellation.CancellationException -import kotlin.reflect.typeOf /** - * Default implementation of [RPCClient]. + * Default implementation of [RpcClient]. * Takes care of tracking requests and responses, * serializing data, tracking streams, processing exceptions, and other protocol responsibilities. * Leaves out the delivery of encoded messages to the specific implementations. @@ -51,7 +45,7 @@ import kotlin.reflect.typeOf public abstract class KRPCClient( final override val config: RPCConfig.Client, transport: RPCTransport, -) : RPCServiceHandler(), RPCClient, RPCEndpoint { +) : RPCServiceHandler(), RpcClient, RPCEndpoint { // we make a child here, so we can send cancellation messages before closing the connection final override val coroutineContext: CoroutineContext = SupervisorJob(transport.coroutineContext.job) @@ -143,44 +137,24 @@ public abstract class KRPCClient( } } - final override fun registerPlainFlowField(serviceScope: CoroutineScope, field: RPCField): Flow { - return RPCFlow.Plain(field.serviceTypeString, serviceScope.coroutineContext.job).also { rpcFlow -> - serviceScope.initializeFlowField(rpcFlow, field) - } - } - - final override fun registerSharedFlowField(serviceScope: CoroutineScope, field: RPCField): SharedFlow { - return RPCFlow.Shared(field.serviceTypeString, serviceScope.coroutineContext.job).also { rpcFlow -> - serviceScope.initializeFlowField(rpcFlow, field) - } - } + override fun callAsync( + serviceScope: CoroutineScope, + call: RpcCall, + ): Deferred { + val callable = call.descriptor.getCallable(call.callableName) + ?: error("Unexpected callable '${call.callableName}' for ${call.descriptor.fqName} service") - final override fun registerStateFlowField(serviceScope: CoroutineScope, field: RPCField): StateFlow { - return RPCFlow.State(field.serviceTypeString, serviceScope.coroutineContext.job).also { rpcFlow -> - serviceScope.initializeFlowField(rpcFlow, field) - } - } - - private fun > CoroutineScope.initializeFlowField(rpcFlow: RPCFlow, field: RPCField) { - val call = RPCCall( - serviceTypeString = field.serviceTypeString, - serviceId = field.serviceId, - callableName = field.name, - type = RPCCall.Type.Field, - data = FieldDataObject, - dataType = typeOf(), - returnType = field.type, - ) + val deferred = SupervisedCompletableDeferred(serviceScope.coroutineContext.job) /** * Launched on the service scope (receiver) * Moreover, this scope has [StreamScope] that is used to handle field streams. * [StreamScope] is provided to a service via [provideStubContext]. */ - launch { - val rpcCall = call(call, rpcFlow.deferred) + serviceScope.launch { + val rpcCall = call(call, callable, deferred) - rpcFlow.deferred.invokeOnCompletion { cause -> + deferred.invokeOnCompletion { cause -> if (cause == null) { rpcCall.streamContext.valueOrNull?.launchIf({ incomingHotFlowsAvailable }) { handleIncomingHotFlows(it) @@ -188,11 +162,16 @@ public abstract class KRPCClient( } } } + + return deferred } - final override suspend fun call(call: RPCCall): T { + final override suspend fun call(call: RpcCall): T { + val callable = call.descriptor.getCallable(call.callableName) + ?: error("Unexpected callable '${call.callableName}' for ${call.descriptor.fqName} service") + val callCompletableResult = SupervisedCompletableDeferred() - val rpcCall = call(call, callCompletableResult) + val rpcCall = call(call, callable, callCompletableResult) val result = callCompletableResult.await() // incomingHotFlowsAvailable value is known after await @@ -203,12 +182,16 @@ public abstract class KRPCClient( return result } - private suspend fun call(call: RPCCall, callResult: CompletableDeferred): RPCCallStreamContextFormatAndId { + private suspend fun call( + call: RpcCall, + callable: RpcCallable<*>, + callResult: CompletableDeferred, + ): RPCCallStreamContextFormatAndId { val wrappedCallResult = RequestCompletableDeferred(callResult) - val rpcCall = prepareAndExecuteCall(call, wrappedCallResult) + val rpcCall = prepareAndExecuteCall(call, callable, wrappedCallResult) rpcCall.streamContext.valueOrNull?.launchIf({ outgoingStreamsAvailable }) { - handleOutgoingStreams(it, rpcCall.serialFormat, call.serviceTypeString) + handleOutgoingStreams(it, rpcCall.serialFormat, call.descriptor.fqName) } val handle = serviceScopeOrNull()?.run { @@ -222,7 +205,7 @@ public abstract class KRPCClient( callResult.invokeOnCompletion { cause -> if (cause != null) { - cancellingRequests[rpcCall.callId] = call.serviceTypeString + cancellingRequests[rpcCall.callId] = call.descriptor.fqName rpcCall.streamContext.valueOrNull?.cancel("Request failed", cause) @@ -237,13 +220,13 @@ public abstract class KRPCClient( if (streamScope == null) { handle?.dispose() - connector.unsubscribeFromMessages(call.serviceTypeString, rpcCall.callId) + connector.unsubscribeFromMessages(call.descriptor.fqName, rpcCall.callId) } streamScope?.onScopeCompletion(rpcCall.callId) { handle?.dispose() - cancellingRequests[rpcCall.callId] = call.serviceTypeString + cancellingRequests[rpcCall.callId] = call.descriptor.fqName sendCancellation(CancellationType.REQUEST, call.serviceId.toString(), rpcCall.callId) } @@ -254,7 +237,8 @@ public abstract class KRPCClient( } private suspend fun prepareAndExecuteCall( - callInfo: RPCCall, + call: RpcCall, + callable: RpcCallable<*>, callResult: RequestCompletableDeferred<*>, ): RPCCallStreamContextFormatAndId { // we should wait for the handshake to finish @@ -262,27 +246,28 @@ public abstract class KRPCClient( val id = callCounter.incrementAndGet() - val dataTypeString = callInfo.dataType.toString() + val dataTypeString = callable.dataType.toString() val callId = "$connectionId:$dataTypeString:$id" - logger.trace { "start a call[$callId] ${callInfo.callableName}" } + logger.trace { "start a call[$callId] ${callable.name}" } val fallbackScope = serviceScopeOrNull() ?.serviceCoroutineScope ?.let { streamScopeOrNull(it) } val streamContext = LazyRPCStreamContext(streamScopeOrNull(), fallbackScope) { - RPCStreamContext(callId, config, connectionId, callInfo.serviceId, it) + RPCStreamContext(callId, config, connectionId, call.serviceId, it) } val serialFormat = prepareSerialFormat(streamContext) - val firstMessage = serializeRequest(callId, callInfo, serialFormat) + val firstMessage = serializeRequest(callId, call, callable, serialFormat) @Suppress("UNCHECKED_CAST") executeCall( callId = callId, streamContext = streamContext, - call = callInfo, + call = call, + callable = callable, firstMessage = firstMessage, serialFormat = serialFormat, callResult = callResult as RequestCompletableDeferred @@ -300,17 +285,18 @@ public abstract class KRPCClient( private suspend fun executeCall( callId: String, streamContext: LazyRPCStreamContext, - call: RPCCall, + call: RpcCall, + callable: RpcCallable<*>, firstMessage: RPCCallMessage, serialFormat: SerialFormat, callResult: RequestCompletableDeferred, ) { - connector.subscribeToCallResponse(call.serviceTypeString, callId) { message -> + connector.subscribeToCallResponse(call.descriptor.fqName, callId) { message -> if (cancellingRequests.containsKey(callId)) { return@subscribeToCallResponse } - handleMessage(message, streamContext, call, serialFormat, callResult) + handleMessage(message, streamContext, callable, serialFormat, callResult) } connector.sendMessage(firstMessage) @@ -319,7 +305,7 @@ public abstract class KRPCClient( private suspend fun handleMessage( message: RPCCallMessage, streamContext: LazyRPCStreamContext, - callInfo: RPCCall, + callable: RpcCallable<*>, serialFormat: SerialFormat, callResult: RequestCompletableDeferred, ) { @@ -345,7 +331,7 @@ public abstract class KRPCClient( is RPCCallMessage.CallSuccess -> { val value = runCatching { - val serializerResult = serialFormat.serializersModule.rpcSerializerForType(callInfo.returnType) + val serializerResult = serialFormat.serializersModule.rpcSerializerForType(callable.returnType) decodeMessageData(serialFormat, serializerResult, message) } @@ -391,16 +377,21 @@ public abstract class KRPCClient( } } - private fun serializeRequest(callId: String, call: RPCCall, serialFormat: SerialFormat): RPCCallMessage { - val serializerData = serialFormat.serializersModule.rpcSerializerForType(call.dataType) + private fun serializeRequest( + callId: String, + call: RpcCall, + callable: RpcCallable<*>, + serialFormat: SerialFormat, + ): RPCCallMessage { + val serializerData = serialFormat.serializersModule.rpcSerializerForType(callable.dataType) return when (serialFormat) { is StringFormat -> { val stringValue = serialFormat.encodeToString(serializerData, call.data) RPCCallMessage.CallDataString( callId = callId, - serviceType = call.serviceTypeString, + serviceType = call.descriptor.fqName, callableName = call.callableName, - callType = call.type.toMessageCallType(), + callType = callable.toMessageCallType(), data = stringValue, connectionId = connectionId, serviceId = call.serviceId, @@ -411,9 +402,9 @@ public abstract class KRPCClient( val binaryValue = serialFormat.encodeToByteArray(serializerData, call.data) RPCCallMessage.CallDataBinary( callId = callId, - serviceType = call.serviceTypeString, + serviceType = call.descriptor.fqName, callableName = call.callableName, - callType = call.type.toMessageCallType(), + callType = callable.toMessageCallType(), data = binaryValue, connectionId = connectionId, serviceId = call.serviceId, diff --git a/krpc/krpc-client/src/commonMain/kotlin/kotlinx/rpc/krpc/client/internal/FieldDataObject.kt b/krpc/krpc-client/src/commonMain/kotlin/kotlinx/rpc/krpc/client/internal/FieldDataObject.kt deleted file mode 100644 index 4056bc05d..000000000 --- a/krpc/krpc-client/src/commonMain/kotlin/kotlinx/rpc/krpc/client/internal/FieldDataObject.kt +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - -package kotlinx.rpc.krpc.client.internal - -import kotlinx.rpc.internal.RPCMethodClassArguments -import kotlinx.serialization.Serializable - -/** - * Used for field initialization call - */ -@Serializable -internal object FieldDataObject : RPCMethodClassArguments { - override fun asArray(): Array = emptyArray() -} diff --git a/krpc/krpc-core/src/commonMain/kotlin/kotlinx/rpc/krpc/internal/RPCServiceHandler.kt b/krpc/krpc-core/src/commonMain/kotlin/kotlinx/rpc/krpc/internal/RPCServiceHandler.kt index 0a3d3b0f2..080b53251 100644 --- a/krpc/krpc-core/src/commonMain/kotlin/kotlinx/rpc/krpc/internal/RPCServiceHandler.kt +++ b/krpc/krpc-core/src/commonMain/kotlin/kotlinx/rpc/krpc/internal/RPCServiceHandler.kt @@ -10,7 +10,8 @@ import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock -import kotlinx.rpc.RPCCall +import kotlinx.rpc.descriptor.RpcCallable +import kotlinx.rpc.descriptor.RpcInvokator import kotlinx.rpc.internal.utils.InternalRPCApi import kotlinx.rpc.krpc.RPCConfig import kotlinx.rpc.krpc.internal.logging.CommonLogger @@ -159,10 +160,10 @@ public abstract class RPCServiceHandler { return config.serialFormatInitializer.applySerializersModuleAndBuild(module) } - protected fun RPCCall.Type.toMessageCallType(): RPCCallMessage.CallType { - return when (this) { - RPCCall.Type.Method -> RPCCallMessage.CallType.Method - RPCCall.Type.Field -> RPCCallMessage.CallType.Field + protected fun RpcCallable<*>.toMessageCallType(): RPCCallMessage.CallType { + return when (invokator) { + is RpcInvokator.Method -> RPCCallMessage.CallType.Method + is RpcInvokator.Field -> RPCCallMessage.CallType.Field } } } diff --git a/krpc/krpc-ktor/krpc-ktor-client/api/krpc-ktor-client.api b/krpc/krpc-ktor/krpc-ktor-client/api/krpc-ktor-client.api index 41ca9a05b..8dccbf237 100644 --- a/krpc/krpc-ktor/krpc-ktor-client/api/krpc-ktor-client.api +++ b/krpc/krpc-ktor/krpc-ktor-client/api/krpc-ktor-client.api @@ -7,7 +7,7 @@ public final class kotlinx/rpc/krpc/ktor/client/KtorClientDslKt { public static synthetic fun rpcConfig$default (Lio/ktor/client/request/HttpRequestBuilder;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V } -public abstract interface class kotlinx/rpc/krpc/ktor/client/KtorRPCClient : kotlinx/rpc/RPCClient { +public abstract interface class kotlinx/rpc/krpc/ktor/client/KtorRPCClient : kotlinx/rpc/RpcClient { public abstract fun getWebSocketSession ()Lio/ktor/websocket/WebSocketSession; } diff --git a/krpc/krpc-ktor/krpc-ktor-client/src/commonMain/kotlin/kotlinx/rpc/krpc/ktor/client/KtorClientDsl.kt b/krpc/krpc-ktor/krpc-ktor-client/src/commonMain/kotlin/kotlinx/rpc/krpc/ktor/client/KtorClientDsl.kt index 85452f66f..d10e1441f 100644 --- a/krpc/krpc-ktor/krpc-ktor-client/src/commonMain/kotlin/kotlinx/rpc/krpc/ktor/client/KtorClientDsl.kt +++ b/krpc/krpc-ktor/krpc-ktor-client/src/commonMain/kotlin/kotlinx/rpc/krpc/ktor/client/KtorClientDsl.kt @@ -9,7 +9,7 @@ import io.ktor.client.plugins.* import io.ktor.client.plugins.websocket.* import io.ktor.client.request.* import io.ktor.util.* -import kotlinx.rpc.RPCClient +import kotlinx.rpc.RpcClient import kotlinx.rpc.krpc.RPCConfigBuilder import kotlinx.rpc.krpc.rpcClientConfig @@ -29,12 +29,12 @@ public fun HttpRequestBuilder.rpcConfig(configBuilder: RPCConfigBuilder.Client.( } /** - * Configures [RPCClient] for the following path. Provides means for additional configuration via [block]. + * Configures [RpcClient] for the following path. Provides means for additional configuration via [block]. * Note that the [WebSockets] plugin is required for these calls. * * @param urlString The URL to use for the request. * @param block Optional configuration for the - * @return An instance of [RPCClient] that is configured to send messages to the server. + * @return An instance of [RpcClient] that is configured to send messages to the server. */ public suspend fun HttpClient.rpc( urlString: String, @@ -47,11 +47,11 @@ public suspend fun HttpClient.rpc( } /** - * Configures [RPCClient] for the following path. Provides means for additional configuration via [block]. + * Configures [RpcClient] for the following path. Provides means for additional configuration via [block]. * Note that the [WebSockets] plugin is required for these calls. * * @param block Optional configuration for the - * @return An instance of [RPCClient] that is configured to send messages to the server. + * @return An instance of [RpcClient] that is configured to send messages to the server. */ public suspend fun HttpClient.rpc( block: HttpRequestBuilder.() -> Unit = {}, diff --git a/krpc/krpc-ktor/krpc-ktor-client/src/commonMain/kotlin/kotlinx/rpc/krpc/ktor/client/KtorRPCClient.kt b/krpc/krpc-ktor/krpc-ktor-client/src/commonMain/kotlin/kotlinx/rpc/krpc/ktor/client/KtorRPCClient.kt index 5746eb9af..359e16885 100644 --- a/krpc/krpc-ktor/krpc-ktor-client/src/commonMain/kotlin/kotlinx/rpc/krpc/ktor/client/KtorRPCClient.kt +++ b/krpc/krpc-ktor/krpc-ktor-client/src/commonMain/kotlin/kotlinx/rpc/krpc/ktor/client/KtorRPCClient.kt @@ -5,16 +5,16 @@ package kotlinx.rpc.krpc.ktor.client import io.ktor.websocket.* -import kotlinx.rpc.RPCClient +import kotlinx.rpc.RpcClient import kotlinx.rpc.krpc.RPCConfig import kotlinx.rpc.krpc.client.KRPCClient import kotlinx.rpc.krpc.ktor.KtorTransport /** - * [RPCClient] implementation for Ktor, containing [webSocketSession] object, + * [RpcClient] implementation for Ktor, containing [webSocketSession] object, * that is used to maintain connection. */ -public interface KtorRPCClient : RPCClient { +public interface KtorRPCClient : RpcClient { public val webSocketSession: WebSocketSession } diff --git a/krpc/krpc-server/src/jvmMain/kotlin/kotlinx/rpc/krpc/server/KRPCServer.kt b/krpc/krpc-server/src/commonMain/kotlin/kotlinx/rpc/krpc/server/KRPCServer.kt similarity index 90% rename from krpc/krpc-server/src/jvmMain/kotlin/kotlinx/rpc/krpc/server/KRPCServer.kt rename to krpc/krpc-server/src/commonMain/kotlin/kotlinx/rpc/krpc/server/KRPCServer.kt index ed5706736..47b378726 100644 --- a/krpc/krpc-server/src/jvmMain/kotlin/kotlinx/rpc/krpc/server/KRPCServer.kt +++ b/krpc/krpc-server/src/commonMain/kotlin/kotlinx/rpc/krpc/server/KRPCServer.kt @@ -7,7 +7,8 @@ package kotlinx.rpc.krpc.server import kotlinx.coroutines.* import kotlinx.rpc.RPCServer import kotlinx.rpc.RemoteService -import kotlinx.rpc.internal.qualifiedClassName +import kotlinx.rpc.descriptor.RpcServiceDescriptor +import kotlinx.rpc.descriptor.serviceDescriptorOf import kotlinx.rpc.internal.utils.InternalRPCApi import kotlinx.rpc.internal.utils.map.ConcurrentHashMap import kotlinx.rpc.krpc.RPCConfig @@ -103,17 +104,17 @@ public abstract class KRPCServer( serviceKClass: KClass, serviceFactory: (CoroutineContext) -> Service, ) { - val fqServiceName = serviceKClass.qualifiedClassName + val descriptor = serviceDescriptorOf(serviceKClass) launch { - connector.subscribeToServiceMessages(fqServiceName) { message -> + connector.subscribeToServiceMessages(descriptor.fqName) { message -> val rpcServerService = when (val id = message.serviceId) { - null -> nullRpcServices.computeIfAbsent(fqServiceName) { - createNewServiceInstance(serviceKClass, serviceFactory) + null -> nullRpcServices.computeIfAbsent(descriptor.fqName) { + createNewServiceInstance(descriptor, serviceFactory) } else -> rpcServices.computeIfAbsent(id) { - createNewServiceInstance(serviceKClass, serviceFactory) + createNewServiceInstance(descriptor, serviceFactory) } } @@ -123,20 +124,20 @@ public abstract class KRPCServer( } private fun createNewServiceInstance( - serviceKClass: KClass, + descriptor: RpcServiceDescriptor, serviceFactory: (CoroutineContext) -> Service, ): RPCServerService { val serviceInstanceContext = SupervisorJob(coroutineContext.job) return RPCServerService( service = serviceFactory(serviceInstanceContext), - serviceKClass = serviceKClass, + descriptor = descriptor, config = config, connector = connector, coroutineContext = serviceInstanceContext, ).apply { coroutineContext.job.invokeOnCompletion { - connector.unsubscribeFromServiceMessages(serviceKClass.qualifiedClassName) + connector.unsubscribeFromServiceMessages(descriptor.fqName) } } } diff --git a/krpc/krpc-server/src/jvmMain/kotlin/kotlinx/rpc/krpc/server/internal/RPCServerConnector.kt b/krpc/krpc-server/src/commonMain/kotlin/kotlinx/rpc/krpc/server/internal/RPCServerConnector.kt similarity index 100% rename from krpc/krpc-server/src/jvmMain/kotlin/kotlinx/rpc/krpc/server/internal/RPCServerConnector.kt rename to krpc/krpc-server/src/commonMain/kotlin/kotlinx/rpc/krpc/server/internal/RPCServerConnector.kt diff --git a/krpc/krpc-server/src/jvmMain/kotlin/kotlinx/rpc/krpc/server/internal/RPCServerService.kt b/krpc/krpc-server/src/commonMain/kotlin/kotlinx/rpc/krpc/server/internal/RPCServerService.kt similarity index 78% rename from krpc/krpc-server/src/jvmMain/kotlin/kotlinx/rpc/krpc/server/internal/RPCServerService.kt rename to krpc/krpc-server/src/commonMain/kotlin/kotlinx/rpc/krpc/server/internal/RPCServerService.kt index ed68e0ef8..eee1cf3b3 100644 --- a/krpc/krpc-server/src/jvmMain/kotlin/kotlinx/rpc/krpc/server/internal/RPCServerService.kt +++ b/krpc/krpc-server/src/commonMain/kotlin/kotlinx/rpc/krpc/server/internal/RPCServerService.kt @@ -6,8 +6,8 @@ package kotlinx.rpc.krpc.server.internal import kotlinx.coroutines.* import kotlinx.rpc.RemoteService -import kotlinx.rpc.internal.RPCMethodClassArguments -import kotlinx.rpc.internal.qualifiedClassName +import kotlinx.rpc.descriptor.RpcInvokator +import kotlinx.rpc.descriptor.RpcServiceDescriptor import kotlinx.rpc.internal.utils.map.ConcurrentHashMap import kotlinx.rpc.krpc.RPCConfig import kotlinx.rpc.krpc.callScoped @@ -17,40 +17,24 @@ import kotlinx.rpc.krpc.streamScopeOrNull import kotlinx.rpc.krpc.withServerStreamScope import kotlinx.serialization.BinaryFormat import kotlinx.serialization.StringFormat -import java.lang.reflect.InvocationTargetException import kotlin.coroutines.CoroutineContext -import kotlin.reflect.KCallable -import kotlin.reflect.KClass -import kotlin.reflect.KProperty -import kotlin.reflect.full.callSuspend internal class RPCServerService( private val service: T, - private val serviceKClass: KClass, + private val descriptor: RpcServiceDescriptor, override val config: RPCConfig.Server, private val connector: RPCServerConnector, coroutineContext: CoroutineContext, ) : RPCServiceHandler(), CoroutineScope { - private val serviceTypeString = serviceKClass.qualifiedClassName - override val logger = CommonLogger.logger(objectId(serviceTypeString)) + override val logger = CommonLogger.logger(objectId(descriptor.fqName)) override val sender: RPCMessageSender get() = connector private val scope: CoroutineScope = this override val coroutineContext: CoroutineContext = coroutineContext.withServerStreamScope() - private val methods: Map> - private val fields: Map> - private val requestMap = ConcurrentHashMap() init { - val (fieldsMap, methodsMap) = serviceKClass.members - .filter { it.name != "toString" && it.name != "hashCode" && it.name != "equals" } - .partition { it is KProperty<*> } - - fields = fieldsMap.associateBy { it.name } - methods = methodsMap.associateBy { it.name } - coroutineContext.job.invokeOnCompletion { logger.trace { "Service completed with $it" } } @@ -150,22 +134,17 @@ internal class RPCServerService( val callableName = callData.callableName .substringBefore('$') // compatibility with beta-4.2 clients - val callable = (if (isMethod) methods else fields)[callableName] + val callable = descriptor.getCallable(callableName) - if (callable == null) { + if (callable == null || callable.invokator is RpcInvokator.Method && !isMethod) { val callType = if (isMethod) "method" else "field" - throw NoSuchMethodException("Service $serviceTypeString has no $callType $callableName") + error("Service ${descriptor.fqName} has no $callType '$callableName'") } - val argsArray = if (isMethod) { - val type = rpcServiceMethodSerializationTypeOf(serviceKClass, callableName) - ?: error("Unknown method $callableName") - + val data = if (isMethod) { val serializerModule = serialFormat.serializersModule - val paramsSerializer = serializerModule.rpcSerializerForType(type) - val args = decodeMessageData(serialFormat, paramsSerializer, callData) as RPCMethodClassArguments - - args.asArray() + val paramsSerializer = serializerModule.rpcSerializerForType(callable.dataType) + decodeMessageData(serialFormat, paramsSerializer, callData) } else { null } @@ -174,13 +153,16 @@ internal class RPCServerService( val requestJob = launch(start = CoroutineStart.LAZY) { val result = try { - @Suppress("detekt.SpreadOperator") - val value = when { - isMethod -> callScoped(callId) { - callable.callSuspend(service, *argsArray!!) + val value = when (val invokator = callable.invokator) { + is RpcInvokator.Method -> { + callScoped(callId) { + invokator.call(service, data) + } } - else -> callable.call(service) + is RpcInvokator.Field -> { + invokator.call(service) + } } val returnType = callable.returnType @@ -190,7 +172,7 @@ internal class RPCServerService( val stringValue = serialFormat.encodeToString(returnSerializer, value) RPCCallMessage.CallSuccessString( callId = callData.callId, - serviceType = serviceTypeString, + serviceType = descriptor.fqName, data = stringValue, connectionId = callData.connectionId, serviceId = callData.serviceId, @@ -201,7 +183,7 @@ internal class RPCServerService( val binaryValue = serialFormat.encodeToByteArray(returnSerializer, value) RPCCallMessage.CallSuccessBinary( callId = callData.callId, - serviceType = serviceTypeString, + serviceType = descriptor.fqName, data = binaryValue, connectionId = callData.connectionId, serviceId = callData.serviceId, @@ -212,20 +194,6 @@ internal class RPCServerService( unsupportedSerialFormatError(serialFormat) } } - } catch (cause: InvocationTargetException) { - if (cause.cause is CancellationException) { - throw cause.cause!! - } - - failure = cause.cause ?: cause - val serializedCause = serializeException(cause.cause ?: cause) - RPCCallMessage.CallException( - callId = callId, - serviceType = serviceTypeString, - cause = serializedCause, - connectionId = callData.connectionId, - serviceId = callData.serviceId, - ) } catch (cause: CancellationException) { throw cause } catch (@Suppress("detekt.TooGenericExceptionCaught") cause: Throwable) { @@ -234,7 +202,7 @@ internal class RPCServerService( val serializedCause = serializeException(cause) RPCCallMessage.CallException( callId = callId, - serviceType = serviceTypeString, + serviceType = descriptor.fqName, cause = serializedCause, connectionId = callData.connectionId, serviceId = callData.serviceId, @@ -250,7 +218,7 @@ internal class RPCServerService( } launchIf({ outgoingStreamsAvailable }) { - handleOutgoingStreams(it, serialFormat, serviceTypeString) + handleOutgoingStreams(it, serialFormat, descriptor.fqName) } } ?: run { cancelRequest(callId, fromJob = true) diff --git a/krpc/krpc-server/src/commonMain/kotlin/kotlinx/rpc/krpc/server/internal/RPCServiceUtils.kt b/krpc/krpc-server/src/commonMain/kotlin/kotlinx/rpc/krpc/server/internal/RPCServiceUtils.kt deleted file mode 100644 index ed0d380fd..000000000 --- a/krpc/krpc-server/src/commonMain/kotlin/kotlinx/rpc/krpc/server/internal/RPCServiceUtils.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. - */ - -package kotlinx.rpc.krpc.server.internal - -import kotlinx.rpc.RemoteService -import kotlinx.rpc.internal.RPCServiceMethodSerializationTypeProvider -import kotlinx.rpc.internal.findRPCStubProvider -import kotlinx.rpc.internal.kClass -import kotlinx.rpc.internal.utils.InternalRPCApi -import kotlin.reflect.KClass -import kotlin.reflect.KType - -/** - * Utility method that returns [KType] for the class which is used to serialize method request with the [methodName] - */ -@InternalRPCApi -public inline fun rpcServiceMethodSerializationTypeOf(methodName: String): KType? { - return rpcServiceMethodSerializationTypeOf(T::class, methodName) -} - -/** - * Utility method that returns [KType] for the class which is used to serialize method request with the [methodName] - */ -@InternalRPCApi -public fun rpcServiceMethodSerializationTypeOf(serviceType: KType, methodName: String): KType? { - return rpcServiceMethodSerializationTypeOf(serviceType.kClass(), methodName) -} - -/** - * Utility method that returns [KType] for the class which is used to serialize method request with the [methodName] - */ -@InternalRPCApi -public fun rpcServiceMethodSerializationTypeOf(serviceKClass: KClass<*>, methodName: String): KType? { - return findRPCStubProvider(serviceKClass, RPCServiceMethodSerializationTypeProvider::class) - .methodTypeOf(methodName) -} diff --git a/krpc/krpc-test/src/jvmTest/kotlin/kotlinx/rpc/krpc/test/TransportTest.kt b/krpc/krpc-test/src/jvmTest/kotlin/kotlinx/rpc/krpc/test/TransportTest.kt index ed44cd4f5..4fba632ae 100644 --- a/krpc/krpc-test/src/jvmTest/kotlin/kotlinx/rpc/krpc/test/TransportTest.kt +++ b/krpc/krpc-test/src/jvmTest/kotlin/kotlinx/rpc/krpc/test/TransportTest.kt @@ -60,7 +60,7 @@ class TransportTest { } } - private fun clientOf(localTransport: LocalTransport): RPCClient { + private fun clientOf(localTransport: LocalTransport): RpcClient { return KRPCTestClient(clientConfig, localTransport.client) } diff --git a/krpc/krpc-test/src/jvmTest/resources/wire_dumps/0_4_0/callException_json.gold b/krpc/krpc-test/src/jvmTest/resources/wire_dumps/0_4_0/callException_json.gold new file mode 100644 index 000000000..44dd288b1 --- /dev/null +++ b/krpc/krpc-test/src/jvmTest/resources/wire_dumps/0_4_0/callException_json.gold @@ -0,0 +1,10 @@ +[Client] [Send] $ {"type":"org.jetbrains.krpc.internal.transport.RPCProtocolMessage.Handshake","supportedPlugins":[-32767,-32766]} +[Server] [Receive] $ {"type":"org.jetbrains.krpc.internal.transport.RPCProtocolMessage.Handshake","supportedPlugins":[-32767,-32766]} +[Server] [Send] $ {"type":"org.jetbrains.krpc.internal.transport.RPCProtocolMessage.Handshake","supportedPlugins":[-32767,-32766],"connectionId":1} +[Client] [Receive] $ {"type":"org.jetbrains.krpc.internal.transport.RPCProtocolMessage.Handshake","supportedPlugins":[-32767,-32766],"connectionId":1} +[Client] [Send] $ {"type":"org.jetbrains.krpc.RPCMessage.CallData","callId":"1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`callException$rpcMethod`:1","serviceType":"org.jetbrains.krpc.test.api.util.SamplingService","method":"callException","callType":"Method","data":"{}","connectionId":1,"serviceId":1} +[Server] [Receive] $ {"type":"org.jetbrains.krpc.RPCMessage.CallData","callId":"1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`callException$rpcMethod`:1","serviceType":"org.jetbrains.krpc.test.api.util.SamplingService","method":"callException","callType":"Method","data":"{}","connectionId":1,"serviceId":1} +[Server] [Send] $ {"type":"org.jetbrains.krpc.RPCMessage.CallException","callId":"1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`callException$rpcMethod`:1","serviceType":"org.jetbrains.krpc.test.api.util.SamplingService","cause":{"toStringMessage":"java.lang.IllegalStateException: Server exception","message":"Server exception","stacktrace":[],"cause":{"toStringMessage":"java.lang.IllegalStateException: Server exception","message":"Server exception","stacktrace":[],"cause":null,"className":"java.lang.IllegalStateException"},"className":"java.lang.IllegalStateException"},"connectionId":1,"serviceId":1} +[Server] [Send] $ {"type":"org.jetbrains.krpc.internal.transport.RPCGenericMessage","connectionId":null,"pluginParams":{"-32767":"cancellation","-32766":"CANCELLATION_ACK","-32765":"1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`callException$rpcMethod`:1"}} +[Client] [Receive] $ {"type":"org.jetbrains.krpc.RPCMessage.CallException","callId":"1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`callException$rpcMethod`:1","serviceType":"org.jetbrains.krpc.test.api.util.SamplingService","cause":{"toStringMessage":"java.lang.IllegalStateException: Server exception","message":"Server exception","stacktrace":[],"cause":{"toStringMessage":"java.lang.IllegalStateException: Server exception","message":"Server exception","stacktrace":[],"cause":null,"className":"java.lang.IllegalStateException"},"className":"java.lang.IllegalStateException"},"connectionId":1,"serviceId":1} +[Client] [Receive] $ {"type":"org.jetbrains.krpc.internal.transport.RPCGenericMessage","connectionId":null,"pluginParams":{"-32767":"cancellation","-32766":"CANCELLATION_ACK","-32765":"1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`callException$rpcMethod`:1"}} \ No newline at end of file diff --git a/krpc/krpc-test/src/jvmTest/resources/wire_dumps/0_4_0/echo_json.gold b/krpc/krpc-test/src/jvmTest/resources/wire_dumps/0_4_0/echo_json.gold new file mode 100644 index 000000000..572d659f2 --- /dev/null +++ b/krpc/krpc-test/src/jvmTest/resources/wire_dumps/0_4_0/echo_json.gold @@ -0,0 +1,10 @@ +[Client] [Send] $ {"type":"org.jetbrains.krpc.internal.transport.RPCProtocolMessage.Handshake","supportedPlugins":[-32767,-32766]} +[Server] [Receive] $ {"type":"org.jetbrains.krpc.internal.transport.RPCProtocolMessage.Handshake","supportedPlugins":[-32767,-32766]} +[Server] [Send] $ {"type":"org.jetbrains.krpc.internal.transport.RPCProtocolMessage.Handshake","supportedPlugins":[-32767,-32766],"connectionId":1} +[Client] [Receive] $ {"type":"org.jetbrains.krpc.internal.transport.RPCProtocolMessage.Handshake","supportedPlugins":[-32767,-32766],"connectionId":1} +[Client] [Send] $ {"type":"org.jetbrains.krpc.RPCMessage.CallData","callId":"1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`echo$rpcMethod`:1","serviceType":"org.jetbrains.krpc.test.api.util.SamplingService","method":"echo","callType":"Method","data":"{\"arg1\":\"Hello\",\"data\":{\"data\":\"data\"}}","connectionId":1,"serviceId":1} +[Server] [Receive] $ {"type":"org.jetbrains.krpc.RPCMessage.CallData","callId":"1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`echo$rpcMethod`:1","serviceType":"org.jetbrains.krpc.test.api.util.SamplingService","method":"echo","callType":"Method","data":"{\"arg1\":\"Hello\",\"data\":{\"data\":\"data\"}}","connectionId":1,"serviceId":1} +[Server] [Send] $ {"type":"org.jetbrains.krpc.RPCMessage.CallSuccess","callId":"1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`echo$rpcMethod`:1","serviceType":"org.jetbrains.krpc.test.api.util.SamplingService","data":"{\"data\":\"data\"}","connectionId":1,"serviceId":1} +[Server] [Send] $ {"type":"org.jetbrains.krpc.internal.transport.RPCGenericMessage","connectionId":null,"pluginParams":{"-32767":"cancellation","-32766":"CANCELLATION_ACK","-32765":"1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`echo$rpcMethod`:1"}} +[Client] [Receive] $ {"type":"org.jetbrains.krpc.RPCMessage.CallSuccess","callId":"1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`echo$rpcMethod`:1","serviceType":"org.jetbrains.krpc.test.api.util.SamplingService","data":"{\"data\":\"data\"}","connectionId":1,"serviceId":1} +[Client] [Receive] $ {"type":"org.jetbrains.krpc.internal.transport.RPCGenericMessage","connectionId":null,"pluginParams":{"-32767":"cancellation","-32766":"CANCELLATION_ACK","-32765":"1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`echo$rpcMethod`:1"}} \ No newline at end of file diff --git a/krpc/krpc-test/src/jvmTest/resources/wire_dumps/0_4_0/echo_protobuf.gold b/krpc/krpc-test/src/jvmTest/resources/wire_dumps/0_4_0/echo_protobuf.gold new file mode 100644 index 000000000..7e5144b53 --- /dev/null +++ b/krpc/krpc-test/src/jvmTest/resources/wire_dumps/0_4_0/echo_protobuf.gold @@ -0,0 +1,20 @@ +// decoded: ?Borg.jetbrains.krpc.internal.transport.RPCProtocolMessage.Handshake???????????????????????? +[Client] [Send] $ 0a426f72672e6a6574627261696e732e6b7270632e696e7465726e616c2e7472616e73706f72742e52504350726f746f636f6c4d6573736167652e48616e647368616b651216088180feffffffffffff01088280feffffffffffff01 +// decoded: ?Borg.jetbrains.krpc.internal.transport.RPCProtocolMessage.Handshake???????????????????????? +[Server] [Receive] $ 0a426f72672e6a6574627261696e732e6b7270632e696e7465726e616c2e7472616e73706f72742e52504350726f746f636f6c4d6573736167652e48616e647368616b651216088180feffffffffffff01088280feffffffffffff01 +// decoded: ?Borg.jetbrains.krpc.internal.transport.RPCProtocolMessage.Handshake?????????????????????????? +[Server] [Send] $ 0a426f72672e6a6574627261696e732e6b7270632e696e7465726e616c2e7472616e73706f72742e52504350726f746f636f6c4d6573736167652e48616e647368616b651218088180feffffffffffff01088280feffffffffffff011001 +// decoded: ?Borg.jetbrains.krpc.internal.transport.RPCProtocolMessage.Handshake?????????????????????????? +[Client] [Receive] $ 0a426f72672e6a6574627261696e732e6b7270632e696e7465726e616c2e7472616e73706f72742e52504350726f746f636f6c4d6573736167652e48616e647368616b651218088180feffffffffffff01088280feffffffffffff011001 +// decoded: ??org.jetbrains.krpc.internal.transport.RPCMessage.CallDataBinary????W1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`echo$rpcMethod`:1?0org.jetbrains.krpc.test.api.util.SamplingService??echo ?*???Hello????data0?8? +[Client] [Send] $ 0a3f6f72672e6a6574627261696e732e6b7270632e696e7465726e616c2e7472616e73706f72742e5250434d6573736167652e43616c6c4461746142696e61727912a8010a57313a6f72672e6a6574627261696e732e6b7270632e746573742e6170692e7574696c2e53616d706c696e67536572766963652e60247270635365727669636553747562602e606563686f247270634d6574686f64603a3112306f72672e6a6574627261696e732e6b7270632e746573742e6170692e7574696c2e53616d706c696e67536572766963651a046563686f20002a0f0a0548656c6c6f12060a046461746130013801 +// decoded: ??org.jetbrains.krpc.internal.transport.RPCMessage.CallDataBinary????W1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`echo$rpcMethod`:1?0org.jetbrains.krpc.test.api.util.SamplingService??echo ?*???Hello????data0?8? +[Server] [Receive] $ 0a3f6f72672e6a6574627261696e732e6b7270632e696e7465726e616c2e7472616e73706f72742e5250434d6573736167652e43616c6c4461746142696e61727912a8010a57313a6f72672e6a6574627261696e732e6b7270632e746573742e6170692e7574696c2e53616d706c696e67536572766963652e60247270635365727669636553747562602e606563686f247270634d6574686f64603a3112306f72672e6a6574627261696e732e6b7270632e746573742e6170692e7574696c2e53616d706c696e67536572766963651a046563686f20002a0f0a0548656c6c6f12060a046461746130013801 +// decoded: ?Borg.jetbrains.krpc.internal.transport.RPCMessage.CallSuccessBinary????W1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`echo$rpcMethod`:1?0org.jetbrains.krpc.test.api.util.SamplingService????data ?(? +[Server] [Send] $ 0a426f72672e6a6574627261696e732e6b7270632e696e7465726e616c2e7472616e73706f72742e5250434d6573736167652e43616c6c5375636365737342696e6172791297010a57313a6f72672e6a6574627261696e732e6b7270632e746573742e6170692e7574696c2e53616d706c696e67536572766963652e60247270635365727669636553747562602e606563686f247270634d6574686f64603a3112306f72672e6a6574627261696e732e6b7270632e746573742e6170692e7574696c2e53616d706c696e67536572766963651a060a046461746120012801 +// decoded: ?7org.jetbrains.krpc.internal.transport.RPCGenericMessage??????????????????cancellation???????????????CANCELLATION_ACK?d????????????W1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`echo$rpcMethod`:1 +[Server] [Send] $ 0a376f72672e6a6574627261696e732e6b7270632e696e7465726e616c2e7472616e73706f72742e52504347656e657269634d65737361676512a0011219088180feffffffffffff01120c63616e63656c6c6174696f6e121d088280feffffffffffff01121043414e43454c4c4154494f4e5f41434b1264088380feffffffffffff011257313a6f72672e6a6574627261696e732e6b7270632e746573742e6170692e7574696c2e53616d706c696e67536572766963652e60247270635365727669636553747562602e606563686f247270634d6574686f64603a31 +// decoded: ?Borg.jetbrains.krpc.internal.transport.RPCMessage.CallSuccessBinary????W1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`echo$rpcMethod`:1?0org.jetbrains.krpc.test.api.util.SamplingService????data ?(? +[Client] [Receive] $ 0a426f72672e6a6574627261696e732e6b7270632e696e7465726e616c2e7472616e73706f72742e5250434d6573736167652e43616c6c5375636365737342696e6172791297010a57313a6f72672e6a6574627261696e732e6b7270632e746573742e6170692e7574696c2e53616d706c696e67536572766963652e60247270635365727669636553747562602e606563686f247270634d6574686f64603a3112306f72672e6a6574627261696e732e6b7270632e746573742e6170692e7574696c2e53616d706c696e67536572766963651a060a046461746120012801 +// decoded: ?7org.jetbrains.krpc.internal.transport.RPCGenericMessage??????????????????cancellation???????????????CANCELLATION_ACK?d????????????W1:org.jetbrains.krpc.test.api.util.SamplingService.`$rpcServiceStub`.`echo$rpcMethod`:1 +[Client] [Receive] $ 0a376f72672e6a6574627261696e732e6b7270632e696e7465726e616c2e7472616e73706f72742e52504347656e657269634d65737361676512a0011219088180feffffffffffff01120c63616e63656c6c6174696f6e121d088280feffffffffffff01121043414e43454c4c4154494f4e5f41434b1264088380feffffffffffff011257313a6f72672e6a6574627261696e732e6b7270632e746573742e6170692e7574696c2e53616d706c696e67536572766963652e60247270635365727669636553747562602e606563686f247270634d6574686f64603a31 \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 628c2b99e..584358ef4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,6 @@ -import util.otherwise -import util.whenKotlinIsAtLeast +/* + * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ rootProject.name = "kotlinx-rpc" diff --git a/tests/compiler-plugin-tests/src/main/kotlin/kotlinx/rpc/codegen/test/TestRpcClient.kt b/tests/compiler-plugin-tests/src/main/kotlin/kotlinx/rpc/codegen/test/TestRpcClient.kt index 77a880864..eeb8d11cb 100644 --- a/tests/compiler-plugin-tests/src/main/kotlin/kotlinx/rpc/codegen/test/TestRpcClient.kt +++ b/tests/compiler-plugin-tests/src/main/kotlin/kotlinx/rpc/codegen/test/TestRpcClient.kt @@ -5,34 +5,40 @@ package kotlinx.rpc.codegen.test import kotlinx.coroutines.* -import kotlinx.coroutines.flow.* -import kotlinx.rpc.RPCCall -import kotlinx.rpc.RPCClient -import kotlinx.rpc.RPCField +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.flow +import kotlinx.rpc.RpcCall +import kotlinx.rpc.RpcClient import kotlin.coroutines.CoroutineContext @Suppress("UNCHECKED_CAST", "unused") -object TestRpcClient : RPCClient { +object TestRpcClient : RpcClient { override val coroutineContext: CoroutineContext = Job() - override suspend fun call(call: RPCCall): T { + override suspend fun call(call: RpcCall): T { return "call_42" as T } - override fun registerPlainFlowField(serviceScope: CoroutineScope, field: RPCField): Flow { - return flow { emit("registerPlainFlowField_42") } as Flow - } - @OptIn(DelicateCoroutinesApi::class) @Suppress("detekt.GlobalCoroutineUsage") - override fun registerSharedFlowField(serviceScope: CoroutineScope, field: RPCField): SharedFlow { - return MutableSharedFlow(1).also { - GlobalScope.launch { it.emit("registerSharedFlowField_42") } - } as SharedFlow - } + override fun callAsync(serviceScope: CoroutineScope, call: RpcCall): Deferred { + val callable = call.descriptor.getCallable(call.callableName) + ?: error("No callable found for ${call.callableName}") + + val value = when (callable.name) { + "plainFlow" -> flow { emit("registerPlainFlowField_42") } + + "sharedFlow" -> MutableSharedFlow(1).also { + GlobalScope.launch { it.emit("registerSharedFlowField_42") } + } + + "stateFlow" -> MutableStateFlow("registerStateFlowField_42") + + else -> error("Unknown callable name: ${call.callableName}") + } - override fun registerStateFlowField(serviceScope: CoroutineScope, field: RPCField): StateFlow { - return MutableStateFlow("registerStateFlowField_42") as StateFlow + return CompletableDeferred(value as T) } override fun provideStubContext(serviceId: Long): CoroutineContext { diff --git a/tests/compiler-plugin-tests/src/testData/box/customParameterTypes.fir.ir.txt b/tests/compiler-plugin-tests/src/testData/box/customParameterTypes.fir.ir.txt index 072b377d0..32e2ce6c3 100644 --- a/tests/compiler-plugin-tests/src/testData/box/customParameterTypes.fir.ir.txt +++ b/tests/compiler-plugin-tests/src/testData/box/customParameterTypes.fir.ir.txt @@ -329,23 +329,23 @@ FILE fqName: fileName:/customParameterTypes.kt GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:__rpc_stub_id type:kotlin.Long visibility:private [final]' type=kotlin.Long origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.' type=.BoxService.$rpcServiceStub origin=null PROPERTY name:__rpc_client visibility:private modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RPCClient visibility:private [final] + FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RpcClient visibility:private [final] EXPRESSION_BODY - GET_VAR '__rpc_client: kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub.' type=kotlinx.rpc.RPCClient origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub) returnType:kotlinx.rpc.RPCClient + GET_VAR '__rpc_client: kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub.' type=kotlinx.rpc.RpcClient origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub) returnType:kotlinx.rpc.RpcClient correspondingProperty: PROPERTY name:__rpc_client visibility:private modality:FINAL [val] $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub BLOCK_BODY - RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RPCClient visibility:private [final]' type=kotlinx.rpc.RPCClient origin=null + RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RpcClient visibility:private [final]' type=kotlinx.rpc.RpcClient origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.' type=.BoxService.$rpcServiceStub origin=null PROPERTY name:coroutineContext visibility:public modality:FINAL [val] overridden: - public abstract coroutineContext: kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RPCClient + public abstract coroutineContext: kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RpcClient FIELD PROPERTY_BACKING_FIELD name:coroutineContext type:kotlin.coroutines.CoroutineContext visibility:private [final] EXPRESSION_BODY - CALL 'public abstract fun provideStubContext (serviceId: kotlin.Long): kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RPCClient' type=kotlin.coroutines.CoroutineContext origin=null - $this: CALL 'private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RPCClient origin=GET_PROPERTY + CALL 'public abstract fun provideStubContext (serviceId: kotlin.Long): kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RpcClient' type=kotlin.coroutines.CoroutineContext origin=null + $this: CALL 'private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RpcClient origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null @@ -358,84 +358,181 @@ FILE fqName: fileName:/customParameterTypes.kt RETURN type=kotlin.Nothing from='public final fun (): kotlin.coroutines.CoroutineContext declared in .BoxService.$rpcServiceStub' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:coroutineContext type:kotlin.coroutines.CoroutineContext visibility:private [final]' type=kotlin.coroutines.CoroutineContext origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.' type=.BoxService.$rpcServiceStub origin=null - CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.internal.RPCStubObject<.BoxService>] + CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BoxService.$rpcServiceStub.Companion - PROPERTY name:methodNames visibility:private modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:methodNames type:kotlin.collections.Map visibility:private [final] + PROPERTY name:fqName visibility:public modality:FINAL [val] + overridden: + public abstract fqName: kotlin.String declared in kotlinx.rpc.descriptor.RpcServiceDescriptor + FIELD PROPERTY_BACKING_FIELD name:fqName type:kotlin.String visibility:private [final] + EXPRESSION_BODY + CONST String type=kotlin.String value="BoxService" + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlin.String + correspondingProperty: PROPERTY name:fqName visibility:public modality:FINAL [val] + overridden: + public abstract fun (): kotlin.String declared in kotlinx.rpc.descriptor.RpcServiceDescriptor + $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:fqName type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + PROPERTY name:test1Invokator visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:test1Invokator type:kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> visibility:private [final] + EXPRESSION_BODY + TYPE_OP type=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> origin=SAM_CONVERSION typeOperand=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> + FUN_EXPR type=kotlin.coroutines.SuspendFunction2<.BoxService, kotlin.Any?, kotlin.Any?> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (service:.BoxService, data:kotlin.Any?) returnType:kotlin.Any? [suspend] + VALUE_PARAMETER name:service index:0 type:.BoxService + VALUE_PARAMETER name:data index:1 type:kotlin.Any? + BLOCK_BODY + VAR IR_TEMPORARY_VARIABLE name:tmp_10 type:.BoxService.$rpcServiceStub.test1$rpcMethod [val] + CALL 'public final fun dataCast (methodName: kotlin.String, serviceName: kotlin.String): T of kotlinx.rpc.internal.dataCast declared in kotlinx.rpc.internal' type=.BoxService.$rpcServiceStub.test1$rpcMethod origin=null + : .BoxService.$rpcServiceStub.test1$rpcMethod + $receiver: GET_VAR 'data: kotlin.Any? declared in .BoxService.$rpcServiceStub.Companion.test1Invokator.' type=kotlin.Any? origin=null + methodName: CONST String type=kotlin.String value="test1" + serviceName: CONST String type=kotlin.String value="BoxService" + RETURN type=kotlin.Nothing from='local final fun (service: .BoxService, data: kotlin.Any?): kotlin.Any? declared in .BoxService.$rpcServiceStub.Companion.test1Invokator' + CALL 'public abstract fun test1 (testData: .TestData): kotlin.String declared in .BoxService' type=kotlin.String origin=null + $this: GET_VAR 'service: .BoxService declared in .BoxService.$rpcServiceStub.Companion.test1Invokator.' type=.BoxService origin=null + testData: CALL 'public final fun (): .TestData declared in .BoxService.$rpcServiceStub.test1$rpcMethod' type=.TestData origin=GET_PROPERTY + $this: GET_VAR 'val tmp_10: .BoxService.$rpcServiceStub.test1$rpcMethod declared in .BoxService.$rpcServiceStub.Companion.test1Invokator.' type=.BoxService.$rpcServiceStub.test1$rpcMethod origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> + correspondingProperty: PROPERTY name:test1Invokator visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test1Invokator type:kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> visibility:private [final]' type=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + PROPERTY name:test2Invokator visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:test2Invokator type:kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> visibility:private [final] EXPRESSION_BODY - CALL 'public final fun mapOf (vararg pairs: kotlin.Pair): kotlin.collections.Map declared in kotlin.collections' type=kotlin.collections.Map origin=null + TYPE_OP type=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> origin=SAM_CONVERSION typeOperand=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> + FUN_EXPR type=kotlin.coroutines.SuspendFunction2<.BoxService, kotlin.Any?, kotlin.Any?> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (service:.BoxService, data:kotlin.Any?) returnType:kotlin.Any? [suspend] + VALUE_PARAMETER name:service index:0 type:.BoxService + VALUE_PARAMETER name:data index:1 type:kotlin.Any? + BLOCK_BODY + VAR IR_TEMPORARY_VARIABLE name:tmp_11 type:.BoxService.$rpcServiceStub.test2$rpcMethod [val] + CALL 'public final fun dataCast (methodName: kotlin.String, serviceName: kotlin.String): T of kotlinx.rpc.internal.dataCast declared in kotlinx.rpc.internal' type=.BoxService.$rpcServiceStub.test2$rpcMethod origin=null + : .BoxService.$rpcServiceStub.test2$rpcMethod + $receiver: GET_VAR 'data: kotlin.Any? declared in .BoxService.$rpcServiceStub.Companion.test2Invokator.' type=kotlin.Any? origin=null + methodName: CONST String type=kotlin.String value="test2" + serviceName: CONST String type=kotlin.String value="BoxService" + RETURN type=kotlin.Nothing from='local final fun (service: .BoxService, data: kotlin.Any?): kotlin.Any? declared in .BoxService.$rpcServiceStub.Companion.test2Invokator' + CALL 'public abstract fun test2 (testData: .TestData): kotlin.String declared in .BoxService' type=kotlin.String origin=null + $this: GET_VAR 'service: .BoxService declared in .BoxService.$rpcServiceStub.Companion.test2Invokator.' type=.BoxService origin=null + testData: CALL 'public final fun (): .TestData declared in .BoxService.$rpcServiceStub.test2$rpcMethod' type=.TestData origin=GET_PROPERTY + $this: GET_VAR 'val tmp_11: .BoxService.$rpcServiceStub.test2$rpcMethod declared in .BoxService.$rpcServiceStub.Companion.test2Invokator.' type=.BoxService.$rpcServiceStub.test2$rpcMethod origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> + correspondingProperty: PROPERTY name:test2Invokator visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test2Invokator type:kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> visibility:private [final]' type=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + PROPERTY name:callableMap visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:callableMap type:kotlin.collections.Map.BoxService>> visibility:private [final] + EXPRESSION_BODY + CALL 'public final fun mapOf (vararg pairs: kotlin.Pair): kotlin.collections.Map declared in kotlin.collections' type=kotlin.collections.Map.BoxService>> origin=null : kotlin.String - : kotlin.reflect.KType - pairs: VARARG type=kotlin.Array> varargElementType=kotlin.Pair - CALL 'public final fun to (that: B of kotlin.to): kotlin.Pair declared in kotlin' type=kotlin.Pair origin=null + : kotlinx.rpc.descriptor.RpcCallable<.BoxService> + pairs: VARARG type=kotlin.Array.BoxService>>> varargElementType=kotlin.Pair.BoxService>> + CALL 'public final fun to (that: B of kotlin.to): kotlin.Pair declared in kotlin' type=kotlin.Pair.BoxService>> origin=null : kotlin.String - : kotlin.reflect.KType + : kotlinx.rpc.descriptor.RpcCallable<.BoxService> $receiver: CONST String type=kotlin.String value="test1" - that: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : .BoxService.$rpcServiceStub.test1$rpcMethod - CALL 'public final fun to (that: B of kotlin.to): kotlin.Pair declared in kotlin' type=kotlin.Pair origin=null + that: CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, dataType: kotlin.reflect.KType, returnType: kotlin.reflect.KType, invokator: kotlinx.rpc.descriptor.RpcInvokator, parameters: kotlin.Array) declared in kotlinx.rpc.descriptor.RpcCallable' type=kotlinx.rpc.descriptor.RpcCallable<.BoxService> origin=null + : .BoxService + name: CONST String type=kotlin.String value="test1" + dataType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : .BoxService.$rpcServiceStub.test1$rpcMethod + returnType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : kotlin.String + invokator: CALL 'private final fun (): kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> declared in .BoxService.$rpcServiceStub.Companion' type=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion' type=.BoxService.$rpcServiceStub.Companion origin=null + parameters: CALL 'public final fun arrayOf (vararg elements: T of kotlin.arrayOf): kotlin.Array declared in kotlin' type=kotlin.Array origin=null + : kotlinx.rpc.descriptor.RpcParameter + elements: VARARG type=kotlin.Array varargElementType=kotlinx.rpc.descriptor.RpcParameter + CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, type: kotlin.reflect.KType) declared in kotlinx.rpc.descriptor.RpcParameter' type=kotlinx.rpc.descriptor.RpcParameter origin=null + name: CONST String type=kotlin.String value="testData" + type: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : .TestData + CALL 'public final fun to (that: B of kotlin.to): kotlin.Pair declared in kotlin' type=kotlin.Pair.BoxService>> origin=null : kotlin.String - : kotlin.reflect.KType + : kotlinx.rpc.descriptor.RpcCallable<.BoxService> $receiver: CONST String type=kotlin.String value="test2" - that: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : .BoxService.$rpcServiceStub.test2$rpcMethod - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlin.collections.Map - correspondingProperty: PROPERTY name:methodNames visibility:private modality:FINAL [val] + that: CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, dataType: kotlin.reflect.KType, returnType: kotlin.reflect.KType, invokator: kotlinx.rpc.descriptor.RpcInvokator, parameters: kotlin.Array) declared in kotlinx.rpc.descriptor.RpcCallable' type=kotlinx.rpc.descriptor.RpcCallable<.BoxService> origin=null + : .BoxService + name: CONST String type=kotlin.String value="test2" + dataType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : .BoxService.$rpcServiceStub.test2$rpcMethod + returnType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : kotlin.String + invokator: CALL 'private final fun (): kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> declared in .BoxService.$rpcServiceStub.Companion' type=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion' type=.BoxService.$rpcServiceStub.Companion origin=null + parameters: CALL 'public final fun arrayOf (vararg elements: T of kotlin.arrayOf): kotlin.Array declared in kotlin' type=kotlin.Array origin=null + : kotlinx.rpc.descriptor.RpcParameter + elements: VARARG type=kotlin.Array varargElementType=kotlinx.rpc.descriptor.RpcParameter + CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, type: kotlin.reflect.KType) declared in kotlinx.rpc.descriptor.RpcParameter' type=kotlinx.rpc.descriptor.RpcParameter origin=null + name: CONST String type=kotlin.String value="testData" + type: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : .TestData + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlin.collections.Map.BoxService>> + correspondingProperty: PROPERTY name:callableMap visibility:private modality:FINAL [val] $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion BLOCK_BODY - RETURN type=kotlin.Nothing from='private final fun (): kotlin.collections.Map declared in .BoxService.$rpcServiceStub.Companion' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:methodNames type:kotlin.collections.Map visibility:private [final]' type=kotlin.collections.Map origin=null - receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + RETURN type=kotlin.Nothing from='private final fun (): kotlin.collections.Map.BoxService>> declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:callableMap type:kotlin.collections.Map.BoxService>> visibility:private [final]' type=kotlin.collections.Map.BoxService>> origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null CONSTRUCTOR visibility:private <> () returnType:.BoxService.$rpcServiceStub.Companion [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.internal.RPCStubObject<.BoxService>]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>]' FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlinx.rpc.internal.RPCStubObject + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:kotlin.Any VALUE_PARAMETER name:other index:0 type:kotlin.Any? FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] overridden: - public open fun hashCode (): kotlin.Int declared in kotlinx.rpc.internal.RPCStubObject + public open fun hashCode (): kotlin.Int declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:kotlin.Any FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] overridden: - public open fun toString (): kotlin.String declared in kotlinx.rpc.internal.RPCStubObject + public open fun toString (): kotlin.String declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:methodTypeOf visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, methodName:kotlin.String) returnType:kotlin.reflect.KType? + FUN name:createInstance visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, serviceId:kotlin.Long, client:kotlinx.rpc.RpcClient) returnType:.BoxService overridden: - public abstract fun methodTypeOf (methodName: kotlin.String): kotlin.reflect.KType? declared in kotlinx.rpc.internal.RPCStubObject + public abstract fun createInstance (serviceId: kotlin.Long, client: kotlinx.rpc.RpcClient): T of kotlinx.rpc.descriptor.RpcServiceDescriptor declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion - VALUE_PARAMETER name:methodName index:0 type:kotlin.String + VALUE_PARAMETER name:serviceId index:0 type:kotlin.Long + VALUE_PARAMETER name:client index:1 type:kotlinx.rpc.RpcClient BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun methodTypeOf (methodName: kotlin.String): kotlin.reflect.KType? declared in .BoxService.$rpcServiceStub.Companion' - CALL 'public abstract fun get (key: K of kotlin.collections.Map): V of kotlin.collections.Map? declared in kotlin.collections.Map' type=kotlin.reflect.KType? origin=GET_ARRAY_ELEMENT - $this: CALL 'private final fun (): kotlin.collections.Map declared in .BoxService.$rpcServiceStub.Companion' type=kotlin.collections.Map origin=GET_PROPERTY - $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.methodTypeOf' type=.BoxService.$rpcServiceStub.Companion origin=null - key: GET_VAR 'methodName: kotlin.String declared in .BoxService.$rpcServiceStub.Companion.methodTypeOf' type=kotlin.String origin=null - FUN name:rpcFields visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, service:.BoxService) returnType:kotlin.collections.List> + RETURN type=kotlin.Nothing from='public open fun createInstance (serviceId: kotlin.Long, client: kotlinx.rpc.RpcClient): .BoxService declared in .BoxService.$rpcServiceStub.Companion' + CONSTRUCTOR_CALL 'public constructor (__rpc_stub_id: kotlin.Long, __rpc_client: kotlinx.rpc.RpcClient) declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null + __rpc_stub_id: GET_VAR 'serviceId: kotlin.Long declared in .BoxService.$rpcServiceStub.Companion.createInstance' type=kotlin.Long origin=null + __rpc_client: GET_VAR 'client: kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub.Companion.createInstance' type=kotlinx.rpc.RpcClient origin=null + FUN name:getCallable visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, name:kotlin.String) returnType:kotlinx.rpc.descriptor.RpcCallable? overridden: - public abstract fun rpcFields (service: T of kotlinx.rpc.internal.RPCStubObject): kotlin.collections.List> declared in kotlinx.rpc.internal.RPCStubObject + public abstract fun getCallable (name: kotlin.String): kotlinx.rpc.descriptor.RpcCallable? declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion - VALUE_PARAMETER name:service index:0 type:.BoxService + VALUE_PARAMETER name:name index:0 type:kotlin.String BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun rpcFields (service: .BoxService): kotlin.collections.List> declared in .BoxService.$rpcServiceStub.Companion' - TYPE_OP type=kotlin.collections.List> origin=CAST typeOperand=kotlin.collections.List> - CALL 'public final fun emptyList (): kotlin.collections.List declared in kotlin.collections' type=kotlin.collections.List origin=null - : kotlin.Any? - FUN name:withClient visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, serviceId:kotlin.Long, client:kotlinx.rpc.RPCClient) returnType:.BoxService + RETURN type=kotlin.Nothing from='public open fun getCallable (name: kotlin.String): kotlinx.rpc.descriptor.RpcCallable? declared in .BoxService.$rpcServiceStub.Companion' + CALL 'public abstract fun get (key: K of kotlin.collections.Map): V of kotlin.collections.Map? declared in kotlin.collections.Map' type=kotlinx.rpc.descriptor.RpcCallable? origin=GET_ARRAY_ELEMENT + $this: CALL 'private final fun (): kotlin.collections.Map.BoxService>> declared in .BoxService.$rpcServiceStub.Companion' type=kotlin.collections.Map.BoxService>> origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.getCallable' type=.BoxService.$rpcServiceStub.Companion origin=null + key: GET_VAR 'name: kotlin.String declared in .BoxService.$rpcServiceStub.Companion.getCallable' type=kotlin.String origin=null + FUN name:getFields visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, service:.BoxService) returnType:kotlin.collections.List> overridden: - public abstract fun withClient (serviceId: kotlin.Long, client: kotlinx.rpc.RPCClient): T of kotlinx.rpc.internal.RPCStubObject declared in kotlinx.rpc.internal.RPCStubObject + public abstract fun getFields (service: T of kotlinx.rpc.descriptor.RpcServiceDescriptor): kotlin.collections.List> declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion - VALUE_PARAMETER name:serviceId index:0 type:kotlin.Long - VALUE_PARAMETER name:client index:1 type:kotlinx.rpc.RPCClient + VALUE_PARAMETER name:service index:0 type:.BoxService BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun withClient (serviceId: kotlin.Long, client: kotlinx.rpc.RPCClient): .BoxService declared in .BoxService.$rpcServiceStub.Companion' - CONSTRUCTOR_CALL 'public constructor (__rpc_stub_id: kotlin.Long, __rpc_client: kotlinx.rpc.RPCClient) declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null - __rpc_stub_id: GET_VAR 'serviceId: kotlin.Long declared in .BoxService.$rpcServiceStub.Companion.withClient' type=kotlin.Long origin=null - __rpc_client: GET_VAR 'client: kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub.Companion.withClient' type=kotlinx.rpc.RPCClient origin=null - CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] CLASS name:test1$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RPCMethodClassArguments] + RETURN type=kotlin.Nothing from='public open fun getFields (service: .BoxService): kotlin.collections.List> declared in .BoxService.$rpcServiceStub.Companion' + TYPE_OP type=kotlin.collections.List> origin=CAST typeOperand=kotlin.collections.List> + CALL 'public final fun emptyList (): kotlin.collections.List declared in kotlin.collections' type=kotlin.collections.List origin=null + : kotlin.Any? + CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] CLASS name:test1$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RpcMethodClass] annotations: Serializable(with = ) $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BoxService.$rpcServiceStub.test1$rpcMethod @@ -493,18 +590,18 @@ FILE fqName: fileName:/customParameterTypes.kt receiver: GET_VAR ': .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.' type=.BoxService.$rpcServiceStub.test1$rpcMethod.$serializer origin=null ANONYMOUS_INITIALIZER isStatic=false BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_10 type:kotlinx.serialization.internal.PluginGeneratedSerialDescriptor [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_12 type:kotlinx.serialization.internal.PluginGeneratedSerialDescriptor [val] CONSTRUCTOR_CALL 'public constructor (serialName: kotlin.String, generatedSerializer: kotlinx.serialization.internal.GeneratedSerializer<*>?, elementsCount: kotlin.Int) declared in kotlinx.serialization.internal.PluginGeneratedSerialDescriptor' type=kotlinx.serialization.internal.PluginGeneratedSerialDescriptor origin=null serialName: CONST String type=kotlin.String value="BoxService.$rpcServiceStub.test1$rpcMethod" generatedSerializer: GET_VAR ': .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer' type=.BoxService.$rpcServiceStub.test1$rpcMethod.$serializer origin=null elementsCount: CONST Int type=kotlin.Int value=1 CALL 'public final fun addElement (name: kotlin.String, isOptional: kotlin.Boolean): kotlin.Unit declared in kotlinx.serialization.internal.PluginGeneratedSerialDescriptor' type=kotlin.Unit origin=null - $this: GET_VAR 'val tmp_10: kotlinx.serialization.internal.PluginGeneratedSerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer' type=kotlinx.serialization.internal.PluginGeneratedSerialDescriptor origin=null + $this: GET_VAR 'val tmp_12: kotlinx.serialization.internal.PluginGeneratedSerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer' type=kotlinx.serialization.internal.PluginGeneratedSerialDescriptor origin=null name: CONST String type=kotlin.String value="testData" isOptional: CONST Boolean type=kotlin.Boolean value=false SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:descriptor type:kotlinx.serialization.descriptors.SerialDescriptor visibility:private [final]' type=kotlin.Unit origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer' type=.BoxService.$rpcServiceStub.test1$rpcMethod.$serializer origin=null - value: GET_VAR 'val tmp_10: kotlinx.serialization.internal.PluginGeneratedSerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer' type=kotlinx.serialization.internal.PluginGeneratedSerialDescriptor origin=null + value: GET_VAR 'val tmp_12: kotlinx.serialization.internal.PluginGeneratedSerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer' type=kotlinx.serialization.internal.PluginGeneratedSerialDescriptor origin=null CONSTRUCTOR GENERATED[org.jetbrains.kotlinx.serialization.compiler.fir.SerializationPluginKey] visibility:private <> () returnType:.BoxService.$rpcServiceStub.test1$rpcMethod.$serializer [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' @@ -542,84 +639,84 @@ FILE fqName: fileName:/customParameterTypes.kt $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.test1$rpcMethod.$serializer VALUE_PARAMETER name:decoder index:0 type:kotlinx.serialization.encoding.Decoder BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_11 type:kotlinx.serialization.descriptors.SerialDescriptor [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_13 type:kotlinx.serialization.descriptors.SerialDescriptor [val] CALL 'public final fun (): kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer' type=kotlinx.serialization.descriptors.SerialDescriptor origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=.BoxService.$rpcServiceStub.test1$rpcMethod.$serializer origin=null - VAR IR_TEMPORARY_VARIABLE name:tmp_12 type:kotlin.Boolean [var] + VAR IR_TEMPORARY_VARIABLE name:tmp_14 type:kotlin.Boolean [var] CONST Boolean type=kotlin.Boolean value=true - VAR IR_TEMPORARY_VARIABLE name:tmp_13 type:kotlin.Int [var] + VAR IR_TEMPORARY_VARIABLE name:tmp_15 type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 - VAR IR_TEMPORARY_VARIABLE name:tmp_14 type:kotlin.Int [var] + VAR IR_TEMPORARY_VARIABLE name:tmp_16 type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 - VAR IR_TEMPORARY_VARIABLE name:tmp_15 type:.TestData? [var] + VAR IR_TEMPORARY_VARIABLE name:tmp_17 type:.TestData? [var] CONST Null type=.TestData? value=null - VAR IR_TEMPORARY_VARIABLE name:tmp_16 type:kotlinx.serialization.encoding.CompositeDecoder [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_18 type:kotlinx.serialization.encoding.CompositeDecoder [val] CALL 'public abstract fun beginStructure (descriptor: kotlinx.serialization.descriptors.SerialDescriptor): kotlinx.serialization.encoding.CompositeDecoder declared in kotlinx.serialization.encoding.Decoder' type=kotlinx.serialization.encoding.CompositeDecoder origin=null $this: GET_VAR 'decoder: kotlinx.serialization.encoding.Decoder declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.Decoder origin=null - descriptor: GET_VAR 'val tmp_11: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + descriptor: GET_VAR 'val tmp_13: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null WHEN type=kotlin.Unit origin=null BRANCH if: CALL 'public open fun decodeSequentially (): kotlin.Boolean declared in kotlinx.serialization.encoding.CompositeDecoder' type=kotlin.Boolean origin=null - $this: GET_VAR 'val tmp_16: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null + $this: GET_VAR 'val tmp_18: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null then: BLOCK type=kotlin.Unit origin=null BLOCK type=kotlin.Unit origin=null - SET_VAR 'var tmp_15: .TestData? declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + SET_VAR 'var tmp_17: .TestData? declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CALL 'public abstract fun decodeSerializableElement (descriptor: kotlinx.serialization.descriptors.SerialDescriptor, index: kotlin.Int, deserializer: kotlinx.serialization.DeserializationStrategy, previousValue: T of kotlinx.serialization.encoding.CompositeDecoder.decodeSerializableElement?): T of kotlinx.serialization.encoding.CompositeDecoder.decodeSerializableElement declared in kotlinx.serialization.encoding.CompositeDecoder' type=.TestData origin=null : .TestData - $this: GET_VAR 'val tmp_16: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null - descriptor: GET_VAR 'val tmp_11: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + $this: GET_VAR 'val tmp_18: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null + descriptor: GET_VAR 'val tmp_13: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null index: CONST Int type=kotlin.Int value=0 deserializer: GET_OBJECT 'CLASS KOTLINX_SERIALIZATION OBJECT name:$serializer modality:FINAL visibility:public superTypes:[kotlinx.serialization.internal.GeneratedSerializer<.TestData>]' type=.TestData.$serializer - previousValue: GET_VAR 'var tmp_15: .TestData? declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=.TestData? origin=null - SET_VAR 'var tmp_14: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + previousValue: GET_VAR 'var tmp_17: .TestData? declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=.TestData? origin=null + SET_VAR 'var tmp_16: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CALL 'public final fun or (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null - $this: GET_VAR 'var tmp_14: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + $this: GET_VAR 'var tmp_16: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null other: CONST Int type=kotlin.Int value=1 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: WHILE label=null origin=null - condition: GET_VAR 'var tmp_12: kotlin.Boolean declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Boolean origin=null + condition: GET_VAR 'var tmp_14: kotlin.Boolean declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Boolean origin=null body: BLOCK type=kotlin.Unit origin=null - SET_VAR 'var tmp_13: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + SET_VAR 'var tmp_15: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CALL 'public abstract fun decodeElementIndex (descriptor: kotlinx.serialization.descriptors.SerialDescriptor): kotlin.Int declared in kotlinx.serialization.encoding.CompositeDecoder' type=kotlin.Int origin=null - $this: GET_VAR 'val tmp_16: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null - descriptor: GET_VAR 'val tmp_11: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + $this: GET_VAR 'val tmp_18: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null + descriptor: GET_VAR 'val tmp_13: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null WHEN type=kotlin.Unit origin=null BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'var tmp_13: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + arg0: GET_VAR 'var tmp_15: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=-1 - then: SET_VAR 'var tmp_12: kotlin.Boolean declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + then: SET_VAR 'var tmp_14: kotlin.Boolean declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CONST Boolean type=kotlin.Boolean value=false BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'var tmp_13: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + arg0: GET_VAR 'var tmp_15: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=0 then: BLOCK type=kotlin.Unit origin=null - SET_VAR 'var tmp_15: .TestData? declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + SET_VAR 'var tmp_17: .TestData? declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CALL 'public abstract fun decodeSerializableElement (descriptor: kotlinx.serialization.descriptors.SerialDescriptor, index: kotlin.Int, deserializer: kotlinx.serialization.DeserializationStrategy, previousValue: T of kotlinx.serialization.encoding.CompositeDecoder.decodeSerializableElement?): T of kotlinx.serialization.encoding.CompositeDecoder.decodeSerializableElement declared in kotlinx.serialization.encoding.CompositeDecoder' type=.TestData origin=null : .TestData - $this: GET_VAR 'val tmp_16: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null - descriptor: GET_VAR 'val tmp_11: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + $this: GET_VAR 'val tmp_18: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null + descriptor: GET_VAR 'val tmp_13: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null index: CONST Int type=kotlin.Int value=0 deserializer: GET_OBJECT 'CLASS KOTLINX_SERIALIZATION OBJECT name:$serializer modality:FINAL visibility:public superTypes:[kotlinx.serialization.internal.GeneratedSerializer<.TestData>]' type=.TestData.$serializer - previousValue: GET_VAR 'var tmp_15: .TestData? declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=.TestData? origin=null - SET_VAR 'var tmp_14: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + previousValue: GET_VAR 'var tmp_17: .TestData? declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=.TestData? origin=null + SET_VAR 'var tmp_16: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CALL 'public final fun or (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null - $this: GET_VAR 'var tmp_14: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + $this: GET_VAR 'var tmp_16: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null other: CONST Int type=kotlin.Int value=1 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: THROW type=kotlin.Nothing CONSTRUCTOR_CALL 'public constructor (index: kotlin.Int) declared in kotlinx.serialization.UnknownFieldException' type=kotlinx.serialization.UnknownFieldException origin=null - index: GET_VAR 'var tmp_13: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + index: GET_VAR 'var tmp_15: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null CALL 'public abstract fun endStructure (descriptor: kotlinx.serialization.descriptors.SerialDescriptor): kotlin.Unit declared in kotlinx.serialization.encoding.CompositeDecoder' type=kotlin.Unit origin=null - $this: GET_VAR 'val tmp_16: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null - descriptor: GET_VAR 'val tmp_11: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + $this: GET_VAR 'val tmp_18: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null + descriptor: GET_VAR 'val tmp_13: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null RETURN type=kotlin.Nothing from='public final fun deserialize (decoder: kotlinx.serialization.encoding.Decoder): .BoxService.$rpcServiceStub.test1$rpcMethod declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer' CONSTRUCTOR_CALL 'internal constructor (seen0: kotlin.Int, testData: .TestData?, serializationConstructorMarker: kotlinx.serialization.internal.SerializationConstructorMarker?) declared in .BoxService.$rpcServiceStub.test1$rpcMethod' type=.BoxService.$rpcServiceStub.test1$rpcMethod origin=null - seen0: GET_VAR 'var tmp_14: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null - testData: GET_VAR 'var tmp_15: .TestData? declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=.TestData? origin=null + seen0: GET_VAR 'var tmp_16: kotlin.Int declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + testData: GET_VAR 'var tmp_17: .TestData? declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.deserialize' type=.TestData? origin=null serializationConstructorMarker: CONST Null type=kotlin.Nothing? value=null FUN GENERATED[org.jetbrains.kotlinx.serialization.compiler.fir.SerializationPluginKey] name:serialize visibility:public modality:FINAL <> ($this:.BoxService.$rpcServiceStub.test1$rpcMethod.$serializer, encoder:kotlinx.serialization.encoding.Encoder, value:.BoxService.$rpcServiceStub.test1$rpcMethod) returnType:kotlin.Unit overridden: @@ -628,25 +725,25 @@ FILE fqName: fileName:/customParameterTypes.kt VALUE_PARAMETER name:encoder index:0 type:kotlinx.serialization.encoding.Encoder VALUE_PARAMETER name:value index:1 type:.BoxService.$rpcServiceStub.test1$rpcMethod BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_17 type:kotlinx.serialization.descriptors.SerialDescriptor [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_19 type:kotlinx.serialization.descriptors.SerialDescriptor [val] CALL 'public final fun (): kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer' type=kotlinx.serialization.descriptors.SerialDescriptor origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.serialize' type=.BoxService.$rpcServiceStub.test1$rpcMethod.$serializer origin=null - VAR IR_TEMPORARY_VARIABLE name:tmp_18 type:kotlinx.serialization.encoding.CompositeEncoder [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_20 type:kotlinx.serialization.encoding.CompositeEncoder [val] CALL 'public abstract fun beginStructure (descriptor: kotlinx.serialization.descriptors.SerialDescriptor): kotlinx.serialization.encoding.CompositeEncoder declared in kotlinx.serialization.encoding.Encoder' type=kotlinx.serialization.encoding.CompositeEncoder origin=null $this: GET_VAR 'encoder: kotlinx.serialization.encoding.Encoder declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.serialize' type=kotlinx.serialization.encoding.Encoder origin=null - descriptor: GET_VAR 'val tmp_17: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + descriptor: GET_VAR 'val tmp_19: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null CALL 'internal final fun write$Self (self: .BoxService.$rpcServiceStub.test1$rpcMethod, output: kotlinx.serialization.encoding.CompositeEncoder, serialDesc: kotlinx.serialization.descriptors.SerialDescriptor): kotlin.Unit declared in .BoxService.$rpcServiceStub.test1$rpcMethod' type=kotlin.Unit origin=null self: GET_VAR 'value: .BoxService.$rpcServiceStub.test1$rpcMethod declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.serialize' type=.BoxService.$rpcServiceStub.test1$rpcMethod origin=null - output: GET_VAR 'val tmp_18: kotlinx.serialization.encoding.CompositeEncoder declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.serialize' type=kotlinx.serialization.encoding.CompositeEncoder origin=null - serialDesc: GET_VAR 'val tmp_17: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + output: GET_VAR 'val tmp_20: kotlinx.serialization.encoding.CompositeEncoder declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.serialize' type=kotlinx.serialization.encoding.CompositeEncoder origin=null + serialDesc: GET_VAR 'val tmp_19: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null CALL 'public abstract fun endStructure (descriptor: kotlinx.serialization.descriptors.SerialDescriptor): kotlin.Unit declared in kotlinx.serialization.encoding.CompositeEncoder' type=kotlin.Unit origin=null - $this: GET_VAR 'val tmp_18: kotlinx.serialization.encoding.CompositeEncoder declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.serialize' type=kotlinx.serialization.encoding.CompositeEncoder origin=null - descriptor: GET_VAR 'val tmp_17: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + $this: GET_VAR 'val tmp_20: kotlinx.serialization.encoding.CompositeEncoder declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.serialize' type=kotlinx.serialization.encoding.CompositeEncoder origin=null + descriptor: GET_VAR 'val tmp_19: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test1$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null CONSTRUCTOR GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] visibility:public <> (testData:.TestData) returnType:.BoxService.$rpcServiceStub.test1$rpcMethod [primary] VALUE_PARAMETER GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] name:testData index:0 type:.TestData BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] CLASS name:test1$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RPCMethodClassArguments]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] CLASS name:test1$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RpcMethodClass]' CONSTRUCTOR KOTLINX_SERIALIZATION visibility:internal <> (seen0:kotlin.Int, testData:.TestData?, serializationConstructorMarker:kotlinx.serialization.internal.SerializationConstructorMarker?) returnType:.BoxService.$rpcServiceStub.test1$rpcMethod VALUE_PARAMETER KOTLINX_SERIALIZATION name:seen0 index:0 type:kotlin.Int VALUE_PARAMETER KOTLINX_SERIALIZATION name:testData index:1 type:.TestData? @@ -699,7 +796,7 @@ FILE fqName: fileName:/customParameterTypes.kt $this: GET_VAR 'self: .BoxService.$rpcServiceStub.test1$rpcMethod declared in .BoxService.$rpcServiceStub.test1$rpcMethod.write$Self' type=.BoxService.$rpcServiceStub.test1$rpcMethod origin=null FUN name:asArray visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.test1$rpcMethod) returnType:kotlin.Array overridden: - public abstract fun asArray (): kotlin.Array declared in kotlinx.rpc.internal.RPCMethodClassArguments + public abstract fun asArray (): kotlin.Array declared in kotlinx.rpc.internal.RpcMethodClass $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.test1$rpcMethod BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun asArray (): kotlin.Array declared in .BoxService.$rpcServiceStub.test1$rpcMethod' @@ -708,7 +805,7 @@ FILE fqName: fileName:/customParameterTypes.kt elements: VARARG type=kotlin.Array varargElementType=kotlin.Any? CALL 'public final fun (): .TestData declared in .BoxService.$rpcServiceStub.test1$rpcMethod' type=.TestData origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub.test1$rpcMethod declared in .BoxService.$rpcServiceStub.test1$rpcMethod.asArray' type=.BoxService.$rpcServiceStub.test1$rpcMethod origin=null - CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] CLASS name:test2$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RPCMethodClassArguments] + CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] CLASS name:test2$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RpcMethodClass] annotations: Serializable(with = ) $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BoxService.$rpcServiceStub.test2$rpcMethod @@ -766,18 +863,18 @@ FILE fqName: fileName:/customParameterTypes.kt receiver: GET_VAR ': .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.' type=.BoxService.$rpcServiceStub.test2$rpcMethod.$serializer origin=null ANONYMOUS_INITIALIZER isStatic=false BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_19 type:kotlinx.serialization.internal.PluginGeneratedSerialDescriptor [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_21 type:kotlinx.serialization.internal.PluginGeneratedSerialDescriptor [val] CONSTRUCTOR_CALL 'public constructor (serialName: kotlin.String, generatedSerializer: kotlinx.serialization.internal.GeneratedSerializer<*>?, elementsCount: kotlin.Int) declared in kotlinx.serialization.internal.PluginGeneratedSerialDescriptor' type=kotlinx.serialization.internal.PluginGeneratedSerialDescriptor origin=null serialName: CONST String type=kotlin.String value="BoxService.$rpcServiceStub.test2$rpcMethod" generatedSerializer: GET_VAR ': .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer' type=.BoxService.$rpcServiceStub.test2$rpcMethod.$serializer origin=null elementsCount: CONST Int type=kotlin.Int value=1 CALL 'public final fun addElement (name: kotlin.String, isOptional: kotlin.Boolean): kotlin.Unit declared in kotlinx.serialization.internal.PluginGeneratedSerialDescriptor' type=kotlin.Unit origin=null - $this: GET_VAR 'val tmp_19: kotlinx.serialization.internal.PluginGeneratedSerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer' type=kotlinx.serialization.internal.PluginGeneratedSerialDescriptor origin=null + $this: GET_VAR 'val tmp_21: kotlinx.serialization.internal.PluginGeneratedSerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer' type=kotlinx.serialization.internal.PluginGeneratedSerialDescriptor origin=null name: CONST String type=kotlin.String value="testData" isOptional: CONST Boolean type=kotlin.Boolean value=false SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:descriptor type:kotlinx.serialization.descriptors.SerialDescriptor visibility:private [final]' type=kotlin.Unit origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer' type=.BoxService.$rpcServiceStub.test2$rpcMethod.$serializer origin=null - value: GET_VAR 'val tmp_19: kotlinx.serialization.internal.PluginGeneratedSerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer' type=kotlinx.serialization.internal.PluginGeneratedSerialDescriptor origin=null + value: GET_VAR 'val tmp_21: kotlinx.serialization.internal.PluginGeneratedSerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer' type=kotlinx.serialization.internal.PluginGeneratedSerialDescriptor origin=null CONSTRUCTOR GENERATED[org.jetbrains.kotlinx.serialization.compiler.fir.SerializationPluginKey] visibility:private <> () returnType:.BoxService.$rpcServiceStub.test2$rpcMethod.$serializer [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' @@ -815,84 +912,84 @@ FILE fqName: fileName:/customParameterTypes.kt $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.test2$rpcMethod.$serializer VALUE_PARAMETER name:decoder index:0 type:kotlinx.serialization.encoding.Decoder BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_20 type:kotlinx.serialization.descriptors.SerialDescriptor [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_22 type:kotlinx.serialization.descriptors.SerialDescriptor [val] CALL 'public final fun (): kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer' type=kotlinx.serialization.descriptors.SerialDescriptor origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=.BoxService.$rpcServiceStub.test2$rpcMethod.$serializer origin=null - VAR IR_TEMPORARY_VARIABLE name:tmp_21 type:kotlin.Boolean [var] + VAR IR_TEMPORARY_VARIABLE name:tmp_23 type:kotlin.Boolean [var] CONST Boolean type=kotlin.Boolean value=true - VAR IR_TEMPORARY_VARIABLE name:tmp_22 type:kotlin.Int [var] + VAR IR_TEMPORARY_VARIABLE name:tmp_24 type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 - VAR IR_TEMPORARY_VARIABLE name:tmp_23 type:kotlin.Int [var] + VAR IR_TEMPORARY_VARIABLE name:tmp_25 type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 - VAR IR_TEMPORARY_VARIABLE name:tmp_24 type:.TestData? [var] + VAR IR_TEMPORARY_VARIABLE name:tmp_26 type:.TestData? [var] CONST Null type=.TestData? value=null - VAR IR_TEMPORARY_VARIABLE name:tmp_25 type:kotlinx.serialization.encoding.CompositeDecoder [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_27 type:kotlinx.serialization.encoding.CompositeDecoder [val] CALL 'public abstract fun beginStructure (descriptor: kotlinx.serialization.descriptors.SerialDescriptor): kotlinx.serialization.encoding.CompositeDecoder declared in kotlinx.serialization.encoding.Decoder' type=kotlinx.serialization.encoding.CompositeDecoder origin=null $this: GET_VAR 'decoder: kotlinx.serialization.encoding.Decoder declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.Decoder origin=null - descriptor: GET_VAR 'val tmp_20: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + descriptor: GET_VAR 'val tmp_22: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null WHEN type=kotlin.Unit origin=null BRANCH if: CALL 'public open fun decodeSequentially (): kotlin.Boolean declared in kotlinx.serialization.encoding.CompositeDecoder' type=kotlin.Boolean origin=null - $this: GET_VAR 'val tmp_25: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null + $this: GET_VAR 'val tmp_27: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null then: BLOCK type=kotlin.Unit origin=null BLOCK type=kotlin.Unit origin=null - SET_VAR 'var tmp_24: .TestData? declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + SET_VAR 'var tmp_26: .TestData? declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CALL 'public abstract fun decodeSerializableElement (descriptor: kotlinx.serialization.descriptors.SerialDescriptor, index: kotlin.Int, deserializer: kotlinx.serialization.DeserializationStrategy, previousValue: T of kotlinx.serialization.encoding.CompositeDecoder.decodeSerializableElement?): T of kotlinx.serialization.encoding.CompositeDecoder.decodeSerializableElement declared in kotlinx.serialization.encoding.CompositeDecoder' type=.TestData origin=null : .TestData - $this: GET_VAR 'val tmp_25: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null - descriptor: GET_VAR 'val tmp_20: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + $this: GET_VAR 'val tmp_27: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null + descriptor: GET_VAR 'val tmp_22: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null index: CONST Int type=kotlin.Int value=0 deserializer: GET_OBJECT 'CLASS KOTLINX_SERIALIZATION OBJECT name:$serializer modality:FINAL visibility:public superTypes:[kotlinx.serialization.internal.GeneratedSerializer<.TestData>]' type=.TestData.$serializer - previousValue: GET_VAR 'var tmp_24: .TestData? declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=.TestData? origin=null - SET_VAR 'var tmp_23: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + previousValue: GET_VAR 'var tmp_26: .TestData? declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=.TestData? origin=null + SET_VAR 'var tmp_25: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CALL 'public final fun or (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null - $this: GET_VAR 'var tmp_23: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + $this: GET_VAR 'var tmp_25: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null other: CONST Int type=kotlin.Int value=1 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: WHILE label=null origin=null - condition: GET_VAR 'var tmp_21: kotlin.Boolean declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Boolean origin=null + condition: GET_VAR 'var tmp_23: kotlin.Boolean declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Boolean origin=null body: BLOCK type=kotlin.Unit origin=null - SET_VAR 'var tmp_22: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + SET_VAR 'var tmp_24: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CALL 'public abstract fun decodeElementIndex (descriptor: kotlinx.serialization.descriptors.SerialDescriptor): kotlin.Int declared in kotlinx.serialization.encoding.CompositeDecoder' type=kotlin.Int origin=null - $this: GET_VAR 'val tmp_25: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null - descriptor: GET_VAR 'val tmp_20: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + $this: GET_VAR 'val tmp_27: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null + descriptor: GET_VAR 'val tmp_22: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null WHEN type=kotlin.Unit origin=null BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'var tmp_22: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + arg0: GET_VAR 'var tmp_24: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=-1 - then: SET_VAR 'var tmp_21: kotlin.Boolean declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + then: SET_VAR 'var tmp_23: kotlin.Boolean declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CONST Boolean type=kotlin.Boolean value=false BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'var tmp_22: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + arg0: GET_VAR 'var tmp_24: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=0 then: BLOCK type=kotlin.Unit origin=null - SET_VAR 'var tmp_24: .TestData? declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + SET_VAR 'var tmp_26: .TestData? declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CALL 'public abstract fun decodeSerializableElement (descriptor: kotlinx.serialization.descriptors.SerialDescriptor, index: kotlin.Int, deserializer: kotlinx.serialization.DeserializationStrategy, previousValue: T of kotlinx.serialization.encoding.CompositeDecoder.decodeSerializableElement?): T of kotlinx.serialization.encoding.CompositeDecoder.decodeSerializableElement declared in kotlinx.serialization.encoding.CompositeDecoder' type=.TestData origin=null : .TestData - $this: GET_VAR 'val tmp_25: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null - descriptor: GET_VAR 'val tmp_20: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + $this: GET_VAR 'val tmp_27: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null + descriptor: GET_VAR 'val tmp_22: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null index: CONST Int type=kotlin.Int value=0 deserializer: GET_OBJECT 'CLASS KOTLINX_SERIALIZATION OBJECT name:$serializer modality:FINAL visibility:public superTypes:[kotlinx.serialization.internal.GeneratedSerializer<.TestData>]' type=.TestData.$serializer - previousValue: GET_VAR 'var tmp_24: .TestData? declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=.TestData? origin=null - SET_VAR 'var tmp_23: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + previousValue: GET_VAR 'var tmp_26: .TestData? declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=.TestData? origin=null + SET_VAR 'var tmp_25: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CALL 'public final fun or (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null - $this: GET_VAR 'var tmp_23: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + $this: GET_VAR 'var tmp_25: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null other: CONST Int type=kotlin.Int value=1 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: THROW type=kotlin.Nothing CONSTRUCTOR_CALL 'public constructor (index: kotlin.Int) declared in kotlinx.serialization.UnknownFieldException' type=kotlinx.serialization.UnknownFieldException origin=null - index: GET_VAR 'var tmp_22: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + index: GET_VAR 'var tmp_24: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null CALL 'public abstract fun endStructure (descriptor: kotlinx.serialization.descriptors.SerialDescriptor): kotlin.Unit declared in kotlinx.serialization.encoding.CompositeDecoder' type=kotlin.Unit origin=null - $this: GET_VAR 'val tmp_25: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null - descriptor: GET_VAR 'val tmp_20: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + $this: GET_VAR 'val tmp_27: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null + descriptor: GET_VAR 'val tmp_22: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null RETURN type=kotlin.Nothing from='public final fun deserialize (decoder: kotlinx.serialization.encoding.Decoder): .BoxService.$rpcServiceStub.test2$rpcMethod declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer' CONSTRUCTOR_CALL 'internal constructor (seen0: kotlin.Int, testData: .TestData?, serializationConstructorMarker: kotlinx.serialization.internal.SerializationConstructorMarker?) declared in .BoxService.$rpcServiceStub.test2$rpcMethod' type=.BoxService.$rpcServiceStub.test2$rpcMethod origin=null - seen0: GET_VAR 'var tmp_23: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null - testData: GET_VAR 'var tmp_24: .TestData? declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=.TestData? origin=null + seen0: GET_VAR 'var tmp_25: kotlin.Int declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + testData: GET_VAR 'var tmp_26: .TestData? declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.deserialize' type=.TestData? origin=null serializationConstructorMarker: CONST Null type=kotlin.Nothing? value=null FUN GENERATED[org.jetbrains.kotlinx.serialization.compiler.fir.SerializationPluginKey] name:serialize visibility:public modality:FINAL <> ($this:.BoxService.$rpcServiceStub.test2$rpcMethod.$serializer, encoder:kotlinx.serialization.encoding.Encoder, value:.BoxService.$rpcServiceStub.test2$rpcMethod) returnType:kotlin.Unit overridden: @@ -901,25 +998,25 @@ FILE fqName: fileName:/customParameterTypes.kt VALUE_PARAMETER name:encoder index:0 type:kotlinx.serialization.encoding.Encoder VALUE_PARAMETER name:value index:1 type:.BoxService.$rpcServiceStub.test2$rpcMethod BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_26 type:kotlinx.serialization.descriptors.SerialDescriptor [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_28 type:kotlinx.serialization.descriptors.SerialDescriptor [val] CALL 'public final fun (): kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer' type=kotlinx.serialization.descriptors.SerialDescriptor origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.serialize' type=.BoxService.$rpcServiceStub.test2$rpcMethod.$serializer origin=null - VAR IR_TEMPORARY_VARIABLE name:tmp_27 type:kotlinx.serialization.encoding.CompositeEncoder [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_29 type:kotlinx.serialization.encoding.CompositeEncoder [val] CALL 'public abstract fun beginStructure (descriptor: kotlinx.serialization.descriptors.SerialDescriptor): kotlinx.serialization.encoding.CompositeEncoder declared in kotlinx.serialization.encoding.Encoder' type=kotlinx.serialization.encoding.CompositeEncoder origin=null $this: GET_VAR 'encoder: kotlinx.serialization.encoding.Encoder declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.serialize' type=kotlinx.serialization.encoding.Encoder origin=null - descriptor: GET_VAR 'val tmp_26: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + descriptor: GET_VAR 'val tmp_28: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null CALL 'internal final fun write$Self (self: .BoxService.$rpcServiceStub.test2$rpcMethod, output: kotlinx.serialization.encoding.CompositeEncoder, serialDesc: kotlinx.serialization.descriptors.SerialDescriptor): kotlin.Unit declared in .BoxService.$rpcServiceStub.test2$rpcMethod' type=kotlin.Unit origin=null self: GET_VAR 'value: .BoxService.$rpcServiceStub.test2$rpcMethod declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.serialize' type=.BoxService.$rpcServiceStub.test2$rpcMethod origin=null - output: GET_VAR 'val tmp_27: kotlinx.serialization.encoding.CompositeEncoder declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.serialize' type=kotlinx.serialization.encoding.CompositeEncoder origin=null - serialDesc: GET_VAR 'val tmp_26: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + output: GET_VAR 'val tmp_29: kotlinx.serialization.encoding.CompositeEncoder declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.serialize' type=kotlinx.serialization.encoding.CompositeEncoder origin=null + serialDesc: GET_VAR 'val tmp_28: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null CALL 'public abstract fun endStructure (descriptor: kotlinx.serialization.descriptors.SerialDescriptor): kotlin.Unit declared in kotlinx.serialization.encoding.CompositeEncoder' type=kotlin.Unit origin=null - $this: GET_VAR 'val tmp_27: kotlinx.serialization.encoding.CompositeEncoder declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.serialize' type=kotlinx.serialization.encoding.CompositeEncoder origin=null - descriptor: GET_VAR 'val tmp_26: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + $this: GET_VAR 'val tmp_29: kotlinx.serialization.encoding.CompositeEncoder declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.serialize' type=kotlinx.serialization.encoding.CompositeEncoder origin=null + descriptor: GET_VAR 'val tmp_28: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.test2$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null CONSTRUCTOR GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] visibility:public <> (testData:.TestData) returnType:.BoxService.$rpcServiceStub.test2$rpcMethod [primary] VALUE_PARAMETER GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] name:testData index:0 type:.TestData BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] CLASS name:test2$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RPCMethodClassArguments]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] CLASS name:test2$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RpcMethodClass]' CONSTRUCTOR KOTLINX_SERIALIZATION visibility:internal <> (seen0:kotlin.Int, testData:.TestData?, serializationConstructorMarker:kotlinx.serialization.internal.SerializationConstructorMarker?) returnType:.BoxService.$rpcServiceStub.test2$rpcMethod VALUE_PARAMETER KOTLINX_SERIALIZATION name:seen0 index:0 type:kotlin.Int VALUE_PARAMETER KOTLINX_SERIALIZATION name:testData index:1 type:.TestData? @@ -972,7 +1069,7 @@ FILE fqName: fileName:/customParameterTypes.kt $this: GET_VAR 'self: .BoxService.$rpcServiceStub.test2$rpcMethod declared in .BoxService.$rpcServiceStub.test2$rpcMethod.write$Self' type=.BoxService.$rpcServiceStub.test2$rpcMethod origin=null FUN name:asArray visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.test2$rpcMethod) returnType:kotlin.Array overridden: - public abstract fun asArray (): kotlin.Array declared in kotlinx.rpc.internal.RPCMethodClassArguments + public abstract fun asArray (): kotlin.Array declared in kotlinx.rpc.internal.RpcMethodClass $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.test2$rpcMethod BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun asArray (): kotlin.Array declared in .BoxService.$rpcServiceStub.test2$rpcMethod' @@ -981,9 +1078,9 @@ FILE fqName: fileName:/customParameterTypes.kt elements: VARARG type=kotlin.Array varargElementType=kotlin.Any? CALL 'public final fun (): .TestData declared in .BoxService.$rpcServiceStub.test2$rpcMethod' type=.TestData origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub.test2$rpcMethod declared in .BoxService.$rpcServiceStub.test2$rpcMethod.asArray' type=.BoxService.$rpcServiceStub.test2$rpcMethod origin=null - CONSTRUCTOR visibility:public <> (__rpc_stub_id:kotlin.Long, __rpc_client:kotlinx.rpc.RPCClient) returnType:.BoxService.$rpcServiceStub [primary] + CONSTRUCTOR visibility:public <> (__rpc_stub_id:kotlin.Long, __rpc_client:kotlinx.rpc.RpcClient) returnType:.BoxService.$rpcServiceStub [primary] VALUE_PARAMETER name:__rpc_stub_id index:0 type:kotlin.Long - VALUE_PARAMETER name:__rpc_client index:1 type:kotlinx.rpc.RPCClient + VALUE_PARAMETER name:__rpc_client index:1 type:kotlinx.rpc.RpcClient BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedStubKey] CLASS name:$rpcServiceStub modality:FINAL visibility:public superTypes:[.BoxService]' @@ -1014,22 +1111,17 @@ FILE fqName: fileName:/customParameterTypes.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .BoxService.$rpcServiceStub.test1' - CALL 'public abstract fun call (call: kotlinx.rpc.RPCCall): T of kotlinx.rpc.RPCClient.call declared in kotlinx.rpc.RPCClient' type=kotlin.String origin=null + CALL 'public abstract fun call (call: kotlinx.rpc.RpcCall): T of kotlinx.rpc.RpcClient.call declared in kotlinx.rpc.RpcClient' type=kotlin.String origin=null : kotlin.String - $this: CALL 'private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RPCClient origin=GET_PROPERTY + $this: CALL 'private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RpcClient origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.test1' type=.BoxService.$rpcServiceStub origin=null - call: CONSTRUCTOR_CALL 'public constructor (serviceTypeString: kotlin.String, serviceId: kotlin.Long, callableName: kotlin.String, type: kotlinx.rpc.RPCCall.Type, data: kotlin.Any, dataType: kotlin.reflect.KType, returnType: kotlin.reflect.KType) declared in kotlinx.rpc.RPCCall' type=kotlinx.rpc.RPCCall origin=null - serviceTypeString: CONST String type=kotlin.String value="BoxService" - serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY - $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.test1' type=.BoxService.$rpcServiceStub origin=null + call: CONSTRUCTOR_CALL 'public constructor (descriptor: kotlinx.rpc.descriptor.RpcServiceDescriptor<*>, callableName: kotlin.String, data: kotlin.Any, serviceId: kotlin.Long) declared in kotlinx.rpc.RpcCall' type=kotlinx.rpc.RpcCall origin=null + descriptor: GET_OBJECT 'CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>]' type=.BoxService.$rpcServiceStub.Companion callableName: CONST String type=kotlin.String value="test1" - type: GET_ENUM 'ENUM_ENTRY name:Method' type=kotlinx.rpc.RPCCall.Type data: CONSTRUCTOR_CALL 'public constructor (testData: .TestData) declared in .BoxService.$rpcServiceStub.test1$rpcMethod' type=.BoxService.$rpcServiceStub.test1$rpcMethod origin=null testData: GET_VAR 'testData: .TestData declared in .BoxService.$rpcServiceStub.test1' type=.TestData origin=null - dataType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : .BoxService.$rpcServiceStub.test1$rpcMethod - returnType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : kotlin.String + serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.test1' type=.BoxService.$rpcServiceStub origin=null FUN name:test2 visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub, testData:.TestData) returnType:kotlin.String [suspend] overridden: public abstract fun test2 (testData: .TestData): kotlin.String declared in .BoxService @@ -1044,22 +1136,17 @@ FILE fqName: fileName:/customParameterTypes.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .BoxService.$rpcServiceStub.test2' - CALL 'public abstract fun call (call: kotlinx.rpc.RPCCall): T of kotlinx.rpc.RPCClient.call declared in kotlinx.rpc.RPCClient' type=kotlin.String origin=null + CALL 'public abstract fun call (call: kotlinx.rpc.RpcCall): T of kotlinx.rpc.RpcClient.call declared in kotlinx.rpc.RpcClient' type=kotlin.String origin=null : kotlin.String - $this: CALL 'private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RPCClient origin=GET_PROPERTY + $this: CALL 'private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RpcClient origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.test2' type=.BoxService.$rpcServiceStub origin=null - call: CONSTRUCTOR_CALL 'public constructor (serviceTypeString: kotlin.String, serviceId: kotlin.Long, callableName: kotlin.String, type: kotlinx.rpc.RPCCall.Type, data: kotlin.Any, dataType: kotlin.reflect.KType, returnType: kotlin.reflect.KType) declared in kotlinx.rpc.RPCCall' type=kotlinx.rpc.RPCCall origin=null - serviceTypeString: CONST String type=kotlin.String value="BoxService" - serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY - $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.test2' type=.BoxService.$rpcServiceStub origin=null + call: CONSTRUCTOR_CALL 'public constructor (descriptor: kotlinx.rpc.descriptor.RpcServiceDescriptor<*>, callableName: kotlin.String, data: kotlin.Any, serviceId: kotlin.Long) declared in kotlinx.rpc.RpcCall' type=kotlinx.rpc.RpcCall origin=null + descriptor: GET_OBJECT 'CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>]' type=.BoxService.$rpcServiceStub.Companion callableName: CONST String type=kotlin.String value="test2" - type: GET_ENUM 'ENUM_ENTRY name:Method' type=kotlinx.rpc.RPCCall.Type data: CONSTRUCTOR_CALL 'public constructor (testData: .TestData) declared in .BoxService.$rpcServiceStub.test2$rpcMethod' type=.BoxService.$rpcServiceStub.test2$rpcMethod origin=null testData: GET_VAR 'testData: .TestData declared in .BoxService.$rpcServiceStub.test2' type=.TestData origin=null - dataType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : .BoxService.$rpcServiceStub.test2$rpcMethod - returnType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : kotlin.String + serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.test2' type=.BoxService.$rpcServiceStub origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlinx.rpc.RemoteService @@ -1100,14 +1187,14 @@ FILE fqName: fileName:/customParameterTypes.kt CALL 'public abstract fun test1 (testData: .TestData): kotlin.String declared in .BoxService' type=kotlin.String origin=null $this: CALL 'public final fun withService (): T of kotlinx.rpc.withService declared in kotlinx.rpc' type=.BoxService origin=null : .BoxService - $receiver: GET_OBJECT 'CLASS OBJECT name:TestRpcClient modality:FINAL visibility:public superTypes:[kotlinx.rpc.RPCClient]' type=kotlinx.rpc.codegen.test.TestRpcClient + $receiver: GET_OBJECT 'CLASS OBJECT name:TestRpcClient modality:FINAL visibility:public superTypes:[kotlinx.rpc.RpcClient]' type=kotlinx.rpc.codegen.test.TestRpcClient testData: CONSTRUCTOR_CALL 'public constructor (value: kotlin.String) declared in .TestData' type=.TestData origin=null value: CONST String type=kotlin.String value="value" VAR name:test2 type:kotlin.String [val] CALL 'public abstract fun test2 (testData: .TestData): kotlin.String declared in .BoxService' type=kotlin.String origin=null $this: CALL 'public final fun withService (): T of kotlinx.rpc.withService declared in kotlinx.rpc' type=.BoxService origin=null : .BoxService - $receiver: GET_OBJECT 'CLASS OBJECT name:TestRpcClient modality:FINAL visibility:public superTypes:[kotlinx.rpc.RPCClient]' type=kotlinx.rpc.codegen.test.TestRpcClient + $receiver: GET_OBJECT 'CLASS OBJECT name:TestRpcClient modality:FINAL visibility:public superTypes:[kotlinx.rpc.RpcClient]' type=kotlinx.rpc.codegen.test.TestRpcClient testData: CONSTRUCTOR_CALL 'public constructor (value: kotlin.String) declared in .TestData' type=.TestData origin=null value: CONST String type=kotlin.String value="value" RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .box' diff --git a/tests/compiler-plugin-tests/src/testData/box/fields.fir.ir.txt b/tests/compiler-plugin-tests/src/testData/box/fields.fir.ir.txt index 823bfef7f..91b5e43d3 100644 --- a/tests/compiler-plugin-tests/src/testData/box/fields.fir.ir.txt +++ b/tests/compiler-plugin-tests/src/testData/box/fields.fir.ir.txt @@ -17,23 +17,23 @@ FILE fqName: fileName:/fields.kt GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:__rpc_stub_id type:kotlin.Long visibility:private [final]' type=kotlin.Long origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.' type=.BoxService.$rpcServiceStub origin=null PROPERTY name:__rpc_client visibility:private modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RPCClient visibility:private [final] + FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RpcClient visibility:private [final] EXPRESSION_BODY - GET_VAR '__rpc_client: kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub.' type=kotlinx.rpc.RPCClient origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub) returnType:kotlinx.rpc.RPCClient + GET_VAR '__rpc_client: kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub.' type=kotlinx.rpc.RpcClient origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub) returnType:kotlinx.rpc.RpcClient correspondingProperty: PROPERTY name:__rpc_client visibility:private modality:FINAL [val] $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub BLOCK_BODY - RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RPCClient visibility:private [final]' type=kotlinx.rpc.RPCClient origin=null + RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RpcClient visibility:private [final]' type=kotlinx.rpc.RpcClient origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.' type=.BoxService.$rpcServiceStub origin=null PROPERTY name:coroutineContext visibility:public modality:FINAL [val] overridden: - public abstract coroutineContext: kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RPCClient + public abstract coroutineContext: kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RpcClient FIELD PROPERTY_BACKING_FIELD name:coroutineContext type:kotlin.coroutines.CoroutineContext visibility:private [final] EXPRESSION_BODY - CALL 'public abstract fun provideStubContext (serviceId: kotlin.Long): kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RPCClient' type=kotlin.coroutines.CoroutineContext origin=null - $this: CALL 'private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RPCClient origin=GET_PROPERTY + CALL 'public abstract fun provideStubContext (serviceId: kotlin.Long): kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RpcClient' type=kotlin.coroutines.CoroutineContext origin=null + $this: CALL 'private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RpcClient origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null @@ -57,18 +57,15 @@ FILE fqName: fileName:/fields.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlinx.coroutines.flow.Flow BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlinx.coroutines.flow.Flow declared in .BoxService.$rpcServiceStub.plainFlow$delegate' - CALL 'public abstract fun registerPlainFlowField (serviceScope: kotlinx.coroutines.CoroutineScope, field: kotlinx.rpc.RPCField): kotlinx.coroutines.flow.Flow declared in kotlinx.rpc.RPCClient' type=kotlinx.coroutines.flow.Flow origin=null + CALL 'public final fun registerPlainFlowField (serviceScope: kotlinx.coroutines.CoroutineScope, descriptor: kotlinx.rpc.descriptor.RpcServiceDescriptor<*>, fieldName: kotlin.String, serviceId: kotlin.Long): kotlinx.coroutines.flow.Flow declared in kotlinx.rpc' type=kotlinx.coroutines.flow.Flow origin=null : kotlin.String - $this: CALL 'private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RPCClient origin=GET_PROPERTY + $receiver: CALL 'private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RpcClient origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null serviceScope: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=kotlinx.coroutines.CoroutineScope origin=null - field: CONSTRUCTOR_CALL 'public constructor (serviceTypeString: kotlin.String, serviceId: kotlin.Long, name: kotlin.String, type: kotlin.reflect.KType) declared in kotlinx.rpc.RPCField' type=kotlinx.rpc.RPCField origin=null - serviceTypeString: CONST String type=kotlin.String value="BoxService" - serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY - $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null - name: CONST String type=kotlin.String value="plainFlow" - type: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : kotlinx.coroutines.flow.Flow + descriptor: GET_OBJECT 'CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>]' type=.BoxService.$rpcServiceStub.Companion + fieldName: CONST String type=kotlin.String value="plainFlow" + serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.BoxService.$rpcServiceStub) returnType:kotlinx.coroutines.flow.Flow correspondingProperty: PROPERTY name:plainFlow visibility:public modality:FINAL [delegated,val] overridden: @@ -93,18 +90,15 @@ FILE fqName: fileName:/fields.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlinx.coroutines.flow.SharedFlow BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlinx.coroutines.flow.SharedFlow declared in .BoxService.$rpcServiceStub.sharedFlow$delegate' - CALL 'public abstract fun registerSharedFlowField (serviceScope: kotlinx.coroutines.CoroutineScope, field: kotlinx.rpc.RPCField): kotlinx.coroutines.flow.SharedFlow declared in kotlinx.rpc.RPCClient' type=kotlinx.coroutines.flow.SharedFlow origin=null + CALL 'public final fun registerSharedFlowField (serviceScope: kotlinx.coroutines.CoroutineScope, descriptor: kotlinx.rpc.descriptor.RpcServiceDescriptor<*>, fieldName: kotlin.String, serviceId: kotlin.Long): kotlinx.coroutines.flow.SharedFlow declared in kotlinx.rpc' type=kotlinx.coroutines.flow.SharedFlow origin=null : kotlin.String - $this: CALL 'private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RPCClient origin=GET_PROPERTY + $receiver: CALL 'private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RpcClient origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null serviceScope: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=kotlinx.coroutines.CoroutineScope origin=null - field: CONSTRUCTOR_CALL 'public constructor (serviceTypeString: kotlin.String, serviceId: kotlin.Long, name: kotlin.String, type: kotlin.reflect.KType) declared in kotlinx.rpc.RPCField' type=kotlinx.rpc.RPCField origin=null - serviceTypeString: CONST String type=kotlin.String value="BoxService" - serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY - $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null - name: CONST String type=kotlin.String value="sharedFlow" - type: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : kotlinx.coroutines.flow.SharedFlow + descriptor: GET_OBJECT 'CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>]' type=.BoxService.$rpcServiceStub.Companion + fieldName: CONST String type=kotlin.String value="sharedFlow" + serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.BoxService.$rpcServiceStub) returnType:kotlinx.coroutines.flow.SharedFlow correspondingProperty: PROPERTY name:sharedFlow visibility:public modality:FINAL [delegated,val] overridden: @@ -129,18 +123,15 @@ FILE fqName: fileName:/fields.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlinx.coroutines.flow.StateFlow BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlinx.coroutines.flow.StateFlow declared in .BoxService.$rpcServiceStub.stateFlow$delegate' - CALL 'public abstract fun registerStateFlowField (serviceScope: kotlinx.coroutines.CoroutineScope, field: kotlinx.rpc.RPCField): kotlinx.coroutines.flow.StateFlow declared in kotlinx.rpc.RPCClient' type=kotlinx.coroutines.flow.StateFlow origin=null + CALL 'public final fun registerStateFlowField (serviceScope: kotlinx.coroutines.CoroutineScope, descriptor: kotlinx.rpc.descriptor.RpcServiceDescriptor<*>, fieldName: kotlin.String, serviceId: kotlin.Long): kotlinx.coroutines.flow.StateFlow declared in kotlinx.rpc' type=kotlinx.coroutines.flow.StateFlow origin=null : kotlin.String - $this: CALL 'private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RPCClient origin=GET_PROPERTY + $receiver: CALL 'private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RpcClient origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null serviceScope: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=kotlinx.coroutines.CoroutineScope origin=null - field: CONSTRUCTOR_CALL 'public constructor (serviceTypeString: kotlin.String, serviceId: kotlin.Long, name: kotlin.String, type: kotlin.reflect.KType) declared in kotlinx.rpc.RPCField' type=kotlinx.rpc.RPCField origin=null - serviceTypeString: CONST String type=kotlin.String value="BoxService" - serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY - $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null - name: CONST String type=kotlin.String value="stateFlow" - type: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : kotlinx.coroutines.flow.StateFlow + descriptor: GET_OBJECT 'CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>]' type=.BoxService.$rpcServiceStub.Companion + fieldName: CONST String type=kotlin.String value="stateFlow" + serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.BoxService.$rpcServiceStub) returnType:kotlinx.coroutines.flow.StateFlow correspondingProperty: PROPERTY name:stateFlow visibility:public modality:FINAL [delegated,val] overridden: @@ -154,80 +145,195 @@ FILE fqName: fileName:/fields.kt receiver: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.' type=.BoxService.$rpcServiceStub origin=null thisRef: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.' type=.BoxService.$rpcServiceStub origin=null property: PROPERTY_REFERENCE 'public final stateFlow: kotlinx.coroutines.flow.StateFlow declared in .BoxService.$rpcServiceStub' field=null getter='public final fun (): kotlinx.coroutines.flow.StateFlow declared in .BoxService.$rpcServiceStub' setter=null type=kotlin.reflect.KProperty1<.BoxService.$rpcServiceStub, kotlinx.coroutines.flow.StateFlow> origin=PROPERTY_REFERENCE_FOR_DELEGATE - CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.internal.RPCStubObject<.BoxService>] + CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BoxService.$rpcServiceStub.Companion - PROPERTY name:methodNames visibility:private modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:methodNames type:kotlin.collections.Map visibility:private [final] + PROPERTY name:fqName visibility:public modality:FINAL [val] + overridden: + public abstract fqName: kotlin.String declared in kotlinx.rpc.descriptor.RpcServiceDescriptor + FIELD PROPERTY_BACKING_FIELD name:fqName type:kotlin.String visibility:private [final] + EXPRESSION_BODY + CONST String type=kotlin.String value="BoxService" + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlin.String + correspondingProperty: PROPERTY name:fqName visibility:public modality:FINAL [val] + overridden: + public abstract fun (): kotlin.String declared in kotlinx.rpc.descriptor.RpcServiceDescriptor + $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:fqName type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + PROPERTY name:plainFlowInvokator visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:plainFlowInvokator type:kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> visibility:private [final] + EXPRESSION_BODY + TYPE_OP type=kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> origin=SAM_CONVERSION typeOperand=kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> + FUN_EXPR type=kotlin.Function1<.BoxService, kotlin.Any?> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (service:.BoxService) returnType:kotlin.Any? + VALUE_PARAMETER name:service index:0 type:.BoxService + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (service: .BoxService): kotlin.Any? declared in .BoxService.$rpcServiceStub.Companion.plainFlowInvokator' + CALL 'public abstract fun (): kotlinx.coroutines.flow.Flow declared in .BoxService' type=kotlinx.coroutines.flow.Flow origin=null + $this: GET_VAR 'service: .BoxService declared in .BoxService.$rpcServiceStub.Companion.plainFlowInvokator.' type=.BoxService origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> + correspondingProperty: PROPERTY name:plainFlowInvokator visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:plainFlowInvokator type:kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> visibility:private [final]' type=kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + PROPERTY name:sharedFlowInvokator visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:sharedFlowInvokator type:kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> visibility:private [final] + EXPRESSION_BODY + TYPE_OP type=kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> origin=SAM_CONVERSION typeOperand=kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> + FUN_EXPR type=kotlin.Function1<.BoxService, kotlin.Any?> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (service:.BoxService) returnType:kotlin.Any? + VALUE_PARAMETER name:service index:0 type:.BoxService + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (service: .BoxService): kotlin.Any? declared in .BoxService.$rpcServiceStub.Companion.sharedFlowInvokator' + CALL 'public abstract fun (): kotlinx.coroutines.flow.SharedFlow declared in .BoxService' type=kotlinx.coroutines.flow.SharedFlow origin=null + $this: GET_VAR 'service: .BoxService declared in .BoxService.$rpcServiceStub.Companion.sharedFlowInvokator.' type=.BoxService origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> + correspondingProperty: PROPERTY name:sharedFlowInvokator visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:sharedFlowInvokator type:kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> visibility:private [final]' type=kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + PROPERTY name:stateFlowInvokator visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:stateFlowInvokator type:kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> visibility:private [final] + EXPRESSION_BODY + TYPE_OP type=kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> origin=SAM_CONVERSION typeOperand=kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> + FUN_EXPR type=kotlin.Function1<.BoxService, kotlin.Any?> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (service:.BoxService) returnType:kotlin.Any? + VALUE_PARAMETER name:service index:0 type:.BoxService + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (service: .BoxService): kotlin.Any? declared in .BoxService.$rpcServiceStub.Companion.stateFlowInvokator' + CALL 'public abstract fun (): kotlinx.coroutines.flow.StateFlow declared in .BoxService' type=kotlinx.coroutines.flow.StateFlow origin=null + $this: GET_VAR 'service: .BoxService declared in .BoxService.$rpcServiceStub.Companion.stateFlowInvokator.' type=.BoxService origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> + correspondingProperty: PROPERTY name:stateFlowInvokator visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:stateFlowInvokator type:kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> visibility:private [final]' type=kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + PROPERTY name:callableMap visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:callableMap type:kotlin.collections.Map.BoxService>> visibility:private [final] EXPRESSION_BODY - CALL 'public final fun emptyMap (): kotlin.collections.Map declared in kotlin.collections' type=kotlin.collections.Map origin=null + CALL 'public final fun mapOf (vararg pairs: kotlin.Pair): kotlin.collections.Map declared in kotlin.collections' type=kotlin.collections.Map.BoxService>> origin=null : kotlin.String - : kotlin.reflect.KType - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlin.collections.Map - correspondingProperty: PROPERTY name:methodNames visibility:private modality:FINAL [val] + : kotlinx.rpc.descriptor.RpcCallable<.BoxService> + pairs: VARARG type=kotlin.Array.BoxService>>> varargElementType=kotlin.Pair.BoxService>> + CALL 'public final fun to (that: B of kotlin.to): kotlin.Pair declared in kotlin' type=kotlin.Pair.BoxService>> origin=null + : kotlin.String + : kotlinx.rpc.descriptor.RpcCallable<.BoxService> + $receiver: CONST String type=kotlin.String value="plainFlow" + that: CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, dataType: kotlin.reflect.KType, returnType: kotlin.reflect.KType, invokator: kotlinx.rpc.descriptor.RpcInvokator, parameters: kotlin.Array) declared in kotlinx.rpc.descriptor.RpcCallable' type=kotlinx.rpc.descriptor.RpcCallable<.BoxService> origin=null + : .BoxService + name: CONST String type=kotlin.String value="plainFlow" + dataType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : kotlinx.rpc.internal.FieldDataObject + returnType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : kotlinx.coroutines.flow.Flow + invokator: CALL 'private final fun (): kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> declared in .BoxService.$rpcServiceStub.Companion' type=kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion' type=.BoxService.$rpcServiceStub.Companion origin=null + parameters: CALL 'public final fun emptyArray (): kotlin.Array declared in kotlin' type=kotlin.Array origin=null + : kotlinx.rpc.descriptor.RpcParameter + CALL 'public final fun to (that: B of kotlin.to): kotlin.Pair declared in kotlin' type=kotlin.Pair.BoxService>> origin=null + : kotlin.String + : kotlinx.rpc.descriptor.RpcCallable<.BoxService> + $receiver: CONST String type=kotlin.String value="sharedFlow" + that: CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, dataType: kotlin.reflect.KType, returnType: kotlin.reflect.KType, invokator: kotlinx.rpc.descriptor.RpcInvokator, parameters: kotlin.Array) declared in kotlinx.rpc.descriptor.RpcCallable' type=kotlinx.rpc.descriptor.RpcCallable<.BoxService> origin=null + : .BoxService + name: CONST String type=kotlin.String value="sharedFlow" + dataType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : kotlinx.rpc.internal.FieldDataObject + returnType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : kotlinx.coroutines.flow.SharedFlow + invokator: CALL 'private final fun (): kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> declared in .BoxService.$rpcServiceStub.Companion' type=kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion' type=.BoxService.$rpcServiceStub.Companion origin=null + parameters: CALL 'public final fun emptyArray (): kotlin.Array declared in kotlin' type=kotlin.Array origin=null + : kotlinx.rpc.descriptor.RpcParameter + CALL 'public final fun to (that: B of kotlin.to): kotlin.Pair declared in kotlin' type=kotlin.Pair.BoxService>> origin=null + : kotlin.String + : kotlinx.rpc.descriptor.RpcCallable<.BoxService> + $receiver: CONST String type=kotlin.String value="stateFlow" + that: CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, dataType: kotlin.reflect.KType, returnType: kotlin.reflect.KType, invokator: kotlinx.rpc.descriptor.RpcInvokator, parameters: kotlin.Array) declared in kotlinx.rpc.descriptor.RpcCallable' type=kotlinx.rpc.descriptor.RpcCallable<.BoxService> origin=null + : .BoxService + name: CONST String type=kotlin.String value="stateFlow" + dataType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : kotlinx.rpc.internal.FieldDataObject + returnType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : kotlinx.coroutines.flow.StateFlow + invokator: CALL 'private final fun (): kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> declared in .BoxService.$rpcServiceStub.Companion' type=kotlinx.rpc.descriptor.RpcInvokator.Field<.BoxService> origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion' type=.BoxService.$rpcServiceStub.Companion origin=null + parameters: CALL 'public final fun emptyArray (): kotlin.Array declared in kotlin' type=kotlin.Array origin=null + : kotlinx.rpc.descriptor.RpcParameter + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlin.collections.Map.BoxService>> + correspondingProperty: PROPERTY name:callableMap visibility:private modality:FINAL [val] $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion BLOCK_BODY - RETURN type=kotlin.Nothing from='private final fun (): kotlin.collections.Map declared in .BoxService.$rpcServiceStub.Companion' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:methodNames type:kotlin.collections.Map visibility:private [final]' type=kotlin.collections.Map origin=null - receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + RETURN type=kotlin.Nothing from='private final fun (): kotlin.collections.Map.BoxService>> declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:callableMap type:kotlin.collections.Map.BoxService>> visibility:private [final]' type=kotlin.collections.Map.BoxService>> origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null CONSTRUCTOR visibility:private <> () returnType:.BoxService.$rpcServiceStub.Companion [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.internal.RPCStubObject<.BoxService>]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>]' FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlinx.rpc.internal.RPCStubObject + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:kotlin.Any VALUE_PARAMETER name:other index:0 type:kotlin.Any? FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] overridden: - public open fun hashCode (): kotlin.Int declared in kotlinx.rpc.internal.RPCStubObject + public open fun hashCode (): kotlin.Int declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:kotlin.Any FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] overridden: - public open fun toString (): kotlin.String declared in kotlinx.rpc.internal.RPCStubObject + public open fun toString (): kotlin.String declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:methodTypeOf visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, methodName:kotlin.String) returnType:kotlin.reflect.KType? + FUN name:createInstance visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, serviceId:kotlin.Long, client:kotlinx.rpc.RpcClient) returnType:.BoxService + overridden: + public abstract fun createInstance (serviceId: kotlin.Long, client: kotlinx.rpc.RpcClient): T of kotlinx.rpc.descriptor.RpcServiceDescriptor declared in kotlinx.rpc.descriptor.RpcServiceDescriptor + $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion + VALUE_PARAMETER name:serviceId index:0 type:kotlin.Long + VALUE_PARAMETER name:client index:1 type:kotlinx.rpc.RpcClient + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun createInstance (serviceId: kotlin.Long, client: kotlinx.rpc.RpcClient): .BoxService declared in .BoxService.$rpcServiceStub.Companion' + CONSTRUCTOR_CALL 'public constructor (__rpc_stub_id: kotlin.Long, __rpc_client: kotlinx.rpc.RpcClient) declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null + __rpc_stub_id: GET_VAR 'serviceId: kotlin.Long declared in .BoxService.$rpcServiceStub.Companion.createInstance' type=kotlin.Long origin=null + __rpc_client: GET_VAR 'client: kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub.Companion.createInstance' type=kotlinx.rpc.RpcClient origin=null + FUN name:getCallable visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, name:kotlin.String) returnType:kotlinx.rpc.descriptor.RpcCallable? overridden: - public abstract fun methodTypeOf (methodName: kotlin.String): kotlin.reflect.KType? declared in kotlinx.rpc.internal.RPCStubObject + public abstract fun getCallable (name: kotlin.String): kotlinx.rpc.descriptor.RpcCallable? declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion - VALUE_PARAMETER name:methodName index:0 type:kotlin.String + VALUE_PARAMETER name:name index:0 type:kotlin.String BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun methodTypeOf (methodName: kotlin.String): kotlin.reflect.KType? declared in .BoxService.$rpcServiceStub.Companion' - CALL 'public abstract fun get (key: K of kotlin.collections.Map): V of kotlin.collections.Map? declared in kotlin.collections.Map' type=kotlin.reflect.KType? origin=GET_ARRAY_ELEMENT - $this: CALL 'private final fun (): kotlin.collections.Map declared in .BoxService.$rpcServiceStub.Companion' type=kotlin.collections.Map origin=GET_PROPERTY - $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.methodTypeOf' type=.BoxService.$rpcServiceStub.Companion origin=null - key: GET_VAR 'methodName: kotlin.String declared in .BoxService.$rpcServiceStub.Companion.methodTypeOf' type=kotlin.String origin=null - FUN name:rpcFields visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, service:.BoxService) returnType:kotlin.collections.List> + RETURN type=kotlin.Nothing from='public open fun getCallable (name: kotlin.String): kotlinx.rpc.descriptor.RpcCallable? declared in .BoxService.$rpcServiceStub.Companion' + CALL 'public abstract fun get (key: K of kotlin.collections.Map): V of kotlin.collections.Map? declared in kotlin.collections.Map' type=kotlinx.rpc.descriptor.RpcCallable? origin=GET_ARRAY_ELEMENT + $this: CALL 'private final fun (): kotlin.collections.Map.BoxService>> declared in .BoxService.$rpcServiceStub.Companion' type=kotlin.collections.Map.BoxService>> origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.getCallable' type=.BoxService.$rpcServiceStub.Companion origin=null + key: GET_VAR 'name: kotlin.String declared in .BoxService.$rpcServiceStub.Companion.getCallable' type=kotlin.String origin=null + FUN name:getFields visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, service:.BoxService) returnType:kotlin.collections.List> overridden: - public abstract fun rpcFields (service: T of kotlinx.rpc.internal.RPCStubObject): kotlin.collections.List> declared in kotlinx.rpc.internal.RPCStubObject + public abstract fun getFields (service: T of kotlinx.rpc.descriptor.RpcServiceDescriptor): kotlin.collections.List> declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion VALUE_PARAMETER name:service index:0 type:.BoxService BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun rpcFields (service: .BoxService): kotlin.collections.List> declared in .BoxService.$rpcServiceStub.Companion' - TYPE_OP type=kotlin.collections.List> origin=CAST typeOperand=kotlin.collections.List> + RETURN type=kotlin.Nothing from='public open fun getFields (service: .BoxService): kotlin.collections.List> declared in .BoxService.$rpcServiceStub.Companion' + TYPE_OP type=kotlin.collections.List> origin=CAST typeOperand=kotlin.collections.List> CALL 'public final fun listOf (vararg elements: T of kotlin.collections.listOf): kotlin.collections.List declared in kotlin.collections' type=kotlin.collections.List origin=null : kotlin.Any? elements: VARARG type=kotlin.Array varargElementType=kotlin.Any? CALL 'public abstract fun (): kotlinx.coroutines.flow.Flow declared in .BoxService' type=kotlinx.coroutines.flow.Flow origin=GET_PROPERTY - $this: GET_VAR 'service: .BoxService declared in .BoxService.$rpcServiceStub.Companion.rpcFields' type=.BoxService origin=null + $this: GET_VAR 'service: .BoxService declared in .BoxService.$rpcServiceStub.Companion.getFields' type=.BoxService origin=null CALL 'public abstract fun (): kotlinx.coroutines.flow.SharedFlow declared in .BoxService' type=kotlinx.coroutines.flow.SharedFlow origin=GET_PROPERTY - $this: GET_VAR 'service: .BoxService declared in .BoxService.$rpcServiceStub.Companion.rpcFields' type=.BoxService origin=null + $this: GET_VAR 'service: .BoxService declared in .BoxService.$rpcServiceStub.Companion.getFields' type=.BoxService origin=null CALL 'public abstract fun (): kotlinx.coroutines.flow.StateFlow declared in .BoxService' type=kotlinx.coroutines.flow.StateFlow origin=GET_PROPERTY - $this: GET_VAR 'service: .BoxService declared in .BoxService.$rpcServiceStub.Companion.rpcFields' type=.BoxService origin=null - FUN name:withClient visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, serviceId:kotlin.Long, client:kotlinx.rpc.RPCClient) returnType:.BoxService - overridden: - public abstract fun withClient (serviceId: kotlin.Long, client: kotlinx.rpc.RPCClient): T of kotlinx.rpc.internal.RPCStubObject declared in kotlinx.rpc.internal.RPCStubObject - $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion - VALUE_PARAMETER name:serviceId index:0 type:kotlin.Long - VALUE_PARAMETER name:client index:1 type:kotlinx.rpc.RPCClient - BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun withClient (serviceId: kotlin.Long, client: kotlinx.rpc.RPCClient): .BoxService declared in .BoxService.$rpcServiceStub.Companion' - CONSTRUCTOR_CALL 'public constructor (__rpc_stub_id: kotlin.Long, __rpc_client: kotlinx.rpc.RPCClient) declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null - __rpc_stub_id: GET_VAR 'serviceId: kotlin.Long declared in .BoxService.$rpcServiceStub.Companion.withClient' type=kotlin.Long origin=null - __rpc_client: GET_VAR 'client: kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub.Companion.withClient' type=kotlinx.rpc.RPCClient origin=null - CONSTRUCTOR visibility:public <> (__rpc_stub_id:kotlin.Long, __rpc_client:kotlinx.rpc.RPCClient) returnType:.BoxService.$rpcServiceStub [primary] + $this: GET_VAR 'service: .BoxService declared in .BoxService.$rpcServiceStub.Companion.getFields' type=.BoxService origin=null + CONSTRUCTOR visibility:public <> (__rpc_stub_id:kotlin.Long, __rpc_client:kotlinx.rpc.RpcClient) returnType:.BoxService.$rpcServiceStub [primary] VALUE_PARAMETER name:__rpc_stub_id index:0 type:kotlin.Long - VALUE_PARAMETER name:__rpc_client index:1 type:kotlinx.rpc.RPCClient + VALUE_PARAMETER name:__rpc_client index:1 type:kotlinx.rpc.RpcClient BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedStubKey] CLASS name:$rpcServiceStub modality:FINAL visibility:public superTypes:[.BoxService]' @@ -302,7 +408,7 @@ FILE fqName: fileName:/fields.kt $receiver: CALL 'public abstract fun (): kotlinx.coroutines.flow.Flow declared in .BoxService' type=kotlinx.coroutines.flow.Flow origin=GET_PROPERTY $this: CALL 'public final fun withService (): T of kotlinx.rpc.withService declared in kotlinx.rpc' type=.BoxService origin=null : .BoxService - $receiver: GET_OBJECT 'CLASS OBJECT name:TestRpcClient modality:FINAL visibility:public superTypes:[kotlinx.rpc.RPCClient]' type=kotlinx.rpc.codegen.test.TestRpcClient + $receiver: GET_OBJECT 'CLASS OBJECT name:TestRpcClient modality:FINAL visibility:public superTypes:[kotlinx.rpc.RpcClient]' type=kotlinx.rpc.codegen.test.TestRpcClient VAR name:sharedFlow type:kotlin.collections.List [val] CALL 'public final fun toList (destination: kotlin.collections.MutableList): kotlin.collections.List declared in kotlinx.coroutines.flow' type=kotlin.collections.List origin=null : kotlin.String @@ -311,14 +417,14 @@ FILE fqName: fileName:/fields.kt $receiver: CALL 'public abstract fun (): kotlinx.coroutines.flow.SharedFlow declared in .BoxService' type=kotlinx.coroutines.flow.SharedFlow origin=GET_PROPERTY $this: CALL 'public final fun withService (): T of kotlinx.rpc.withService declared in kotlinx.rpc' type=.BoxService origin=null : .BoxService - $receiver: GET_OBJECT 'CLASS OBJECT name:TestRpcClient modality:FINAL visibility:public superTypes:[kotlinx.rpc.RPCClient]' type=kotlinx.rpc.codegen.test.TestRpcClient + $receiver: GET_OBJECT 'CLASS OBJECT name:TestRpcClient modality:FINAL visibility:public superTypes:[kotlinx.rpc.RpcClient]' type=kotlinx.rpc.codegen.test.TestRpcClient count: CONST Int type=kotlin.Int value=1 VAR name:stateFlow type:kotlin.String [val] CALL 'public abstract fun (): T of kotlinx.coroutines.flow.StateFlow declared in kotlinx.coroutines.flow.StateFlow' type=kotlin.String origin=GET_PROPERTY $this: CALL 'public abstract fun (): kotlinx.coroutines.flow.StateFlow declared in .BoxService' type=kotlinx.coroutines.flow.StateFlow origin=GET_PROPERTY $this: CALL 'public final fun withService (): T of kotlinx.rpc.withService declared in kotlinx.rpc' type=.BoxService origin=null : .BoxService - $receiver: GET_OBJECT 'CLASS OBJECT name:TestRpcClient modality:FINAL visibility:public superTypes:[kotlinx.rpc.RPCClient]' type=kotlinx.rpc.codegen.test.TestRpcClient + $receiver: GET_OBJECT 'CLASS OBJECT name:TestRpcClient modality:FINAL visibility:public superTypes:[kotlinx.rpc.RpcClient]' type=kotlinx.rpc.codegen.test.TestRpcClient VAR name:failures type:kotlin.collections.MutableList [val] CALL 'public final fun mutableListOf (): kotlin.collections.MutableList declared in kotlin.collections' type=kotlin.collections.MutableList origin=null : kotlin.String diff --git a/tests/compiler-plugin-tests/src/testData/box/flowParameter.fir.ir.txt b/tests/compiler-plugin-tests/src/testData/box/flowParameter.fir.ir.txt index 3ccafc407..df74a6bf7 100644 --- a/tests/compiler-plugin-tests/src/testData/box/flowParameter.fir.ir.txt +++ b/tests/compiler-plugin-tests/src/testData/box/flowParameter.fir.ir.txt @@ -17,23 +17,23 @@ FILE fqName: fileName:/flowParameter.kt GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:__rpc_stub_id type:kotlin.Long visibility:private [final]' type=kotlin.Long origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.' type=.BoxService.$rpcServiceStub origin=null PROPERTY name:__rpc_client visibility:private modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RPCClient visibility:private [final] + FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RpcClient visibility:private [final] EXPRESSION_BODY - GET_VAR '__rpc_client: kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub.' type=kotlinx.rpc.RPCClient origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub) returnType:kotlinx.rpc.RPCClient + GET_VAR '__rpc_client: kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub.' type=kotlinx.rpc.RpcClient origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub) returnType:kotlinx.rpc.RpcClient correspondingProperty: PROPERTY name:__rpc_client visibility:private modality:FINAL [val] $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub BLOCK_BODY - RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RPCClient visibility:private [final]' type=kotlinx.rpc.RPCClient origin=null + RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RpcClient visibility:private [final]' type=kotlinx.rpc.RpcClient origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.' type=.BoxService.$rpcServiceStub origin=null PROPERTY name:coroutineContext visibility:public modality:FINAL [val] overridden: - public abstract coroutineContext: kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RPCClient + public abstract coroutineContext: kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RpcClient FIELD PROPERTY_BACKING_FIELD name:coroutineContext type:kotlin.coroutines.CoroutineContext visibility:private [final] EXPRESSION_BODY - CALL 'public abstract fun provideStubContext (serviceId: kotlin.Long): kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RPCClient' type=kotlin.coroutines.CoroutineContext origin=null - $this: CALL 'private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RPCClient origin=GET_PROPERTY + CALL 'public abstract fun provideStubContext (serviceId: kotlin.Long): kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RpcClient' type=kotlin.coroutines.CoroutineContext origin=null + $this: CALL 'private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RpcClient origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null @@ -46,78 +46,134 @@ FILE fqName: fileName:/flowParameter.kt RETURN type=kotlin.Nothing from='public final fun (): kotlin.coroutines.CoroutineContext declared in .BoxService.$rpcServiceStub' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:coroutineContext type:kotlin.coroutines.CoroutineContext visibility:private [final]' type=kotlin.coroutines.CoroutineContext origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.' type=.BoxService.$rpcServiceStub origin=null - CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.internal.RPCStubObject<.BoxService>] + CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BoxService.$rpcServiceStub.Companion - PROPERTY name:methodNames visibility:private modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:methodNames type:kotlin.collections.Map visibility:private [final] + PROPERTY name:fqName visibility:public modality:FINAL [val] + overridden: + public abstract fqName: kotlin.String declared in kotlinx.rpc.descriptor.RpcServiceDescriptor + FIELD PROPERTY_BACKING_FIELD name:fqName type:kotlin.String visibility:private [final] EXPRESSION_BODY - CALL 'public final fun mapOf (vararg pairs: kotlin.Pair): kotlin.collections.Map declared in kotlin.collections' type=kotlin.collections.Map origin=null + CONST String type=kotlin.String value="BoxService" + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlin.String + correspondingProperty: PROPERTY name:fqName visibility:public modality:FINAL [val] + overridden: + public abstract fun (): kotlin.String declared in kotlinx.rpc.descriptor.RpcServiceDescriptor + $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:fqName type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + PROPERTY name:streamInvokator visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:streamInvokator type:kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> visibility:private [final] + EXPRESSION_BODY + TYPE_OP type=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> origin=SAM_CONVERSION typeOperand=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> + FUN_EXPR type=kotlin.coroutines.SuspendFunction2<.BoxService, kotlin.Any?, kotlin.Any?> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (service:.BoxService, data:kotlin.Any?) returnType:kotlin.Any? [suspend] + VALUE_PARAMETER name:service index:0 type:.BoxService + VALUE_PARAMETER name:data index:1 type:kotlin.Any? + BLOCK_BODY + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.BoxService.$rpcServiceStub.stream$rpcMethod [val] + CALL 'public final fun dataCast (methodName: kotlin.String, serviceName: kotlin.String): T of kotlinx.rpc.internal.dataCast declared in kotlinx.rpc.internal' type=.BoxService.$rpcServiceStub.stream$rpcMethod origin=null + : .BoxService.$rpcServiceStub.stream$rpcMethod + $receiver: GET_VAR 'data: kotlin.Any? declared in .BoxService.$rpcServiceStub.Companion.streamInvokator.' type=kotlin.Any? origin=null + methodName: CONST String type=kotlin.String value="stream" + serviceName: CONST String type=kotlin.String value="BoxService" + RETURN type=kotlin.Nothing from='local final fun (service: .BoxService, data: kotlin.Any?): kotlin.Any? declared in .BoxService.$rpcServiceStub.Companion.streamInvokator' + CALL 'public abstract fun stream (flow: kotlinx.coroutines.flow.Flow): kotlin.String declared in .BoxService' type=kotlin.String origin=null + $this: GET_VAR 'service: .BoxService declared in .BoxService.$rpcServiceStub.Companion.streamInvokator.' type=.BoxService origin=null + flow: CALL 'public final fun (): kotlinx.coroutines.flow.Flow declared in .BoxService.$rpcServiceStub.stream$rpcMethod' type=kotlinx.coroutines.flow.Flow origin=GET_PROPERTY + $this: GET_VAR 'val tmp_0: .BoxService.$rpcServiceStub.stream$rpcMethod declared in .BoxService.$rpcServiceStub.Companion.streamInvokator.' type=.BoxService.$rpcServiceStub.stream$rpcMethod origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> + correspondingProperty: PROPERTY name:streamInvokator visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:streamInvokator type:kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> visibility:private [final]' type=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + PROPERTY name:callableMap visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:callableMap type:kotlin.collections.Map.BoxService>> visibility:private [final] + EXPRESSION_BODY + CALL 'public final fun mapOf (vararg pairs: kotlin.Pair): kotlin.collections.Map declared in kotlin.collections' type=kotlin.collections.Map.BoxService>> origin=null : kotlin.String - : kotlin.reflect.KType - pairs: VARARG type=kotlin.Array> varargElementType=kotlin.Pair - CALL 'public final fun to (that: B of kotlin.to): kotlin.Pair declared in kotlin' type=kotlin.Pair origin=null + : kotlinx.rpc.descriptor.RpcCallable<.BoxService> + pairs: VARARG type=kotlin.Array.BoxService>>> varargElementType=kotlin.Pair.BoxService>> + CALL 'public final fun to (that: B of kotlin.to): kotlin.Pair declared in kotlin' type=kotlin.Pair.BoxService>> origin=null : kotlin.String - : kotlin.reflect.KType + : kotlinx.rpc.descriptor.RpcCallable<.BoxService> $receiver: CONST String type=kotlin.String value="stream" - that: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : .BoxService.$rpcServiceStub.stream$rpcMethod - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlin.collections.Map - correspondingProperty: PROPERTY name:methodNames visibility:private modality:FINAL [val] + that: CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, dataType: kotlin.reflect.KType, returnType: kotlin.reflect.KType, invokator: kotlinx.rpc.descriptor.RpcInvokator, parameters: kotlin.Array) declared in kotlinx.rpc.descriptor.RpcCallable' type=kotlinx.rpc.descriptor.RpcCallable<.BoxService> origin=null + : .BoxService + name: CONST String type=kotlin.String value="stream" + dataType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : .BoxService.$rpcServiceStub.stream$rpcMethod + returnType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : kotlin.String + invokator: CALL 'private final fun (): kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> declared in .BoxService.$rpcServiceStub.Companion' type=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion' type=.BoxService.$rpcServiceStub.Companion origin=null + parameters: CALL 'public final fun arrayOf (vararg elements: T of kotlin.arrayOf): kotlin.Array declared in kotlin' type=kotlin.Array origin=null + : kotlinx.rpc.descriptor.RpcParameter + elements: VARARG type=kotlin.Array varargElementType=kotlinx.rpc.descriptor.RpcParameter + CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, type: kotlin.reflect.KType) declared in kotlinx.rpc.descriptor.RpcParameter' type=kotlinx.rpc.descriptor.RpcParameter origin=null + name: CONST String type=kotlin.String value="flow" + type: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : kotlinx.coroutines.flow.Flow + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlin.collections.Map.BoxService>> + correspondingProperty: PROPERTY name:callableMap visibility:private modality:FINAL [val] $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion BLOCK_BODY - RETURN type=kotlin.Nothing from='private final fun (): kotlin.collections.Map declared in .BoxService.$rpcServiceStub.Companion' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:methodNames type:kotlin.collections.Map visibility:private [final]' type=kotlin.collections.Map origin=null - receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + RETURN type=kotlin.Nothing from='private final fun (): kotlin.collections.Map.BoxService>> declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:callableMap type:kotlin.collections.Map.BoxService>> visibility:private [final]' type=kotlin.collections.Map.BoxService>> origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null CONSTRUCTOR visibility:private <> () returnType:.BoxService.$rpcServiceStub.Companion [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.internal.RPCStubObject<.BoxService>]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>]' FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlinx.rpc.internal.RPCStubObject + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:kotlin.Any VALUE_PARAMETER name:other index:0 type:kotlin.Any? FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] overridden: - public open fun hashCode (): kotlin.Int declared in kotlinx.rpc.internal.RPCStubObject + public open fun hashCode (): kotlin.Int declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:kotlin.Any FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] overridden: - public open fun toString (): kotlin.String declared in kotlinx.rpc.internal.RPCStubObject + public open fun toString (): kotlin.String declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:methodTypeOf visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, methodName:kotlin.String) returnType:kotlin.reflect.KType? + FUN name:createInstance visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, serviceId:kotlin.Long, client:kotlinx.rpc.RpcClient) returnType:.BoxService overridden: - public abstract fun methodTypeOf (methodName: kotlin.String): kotlin.reflect.KType? declared in kotlinx.rpc.internal.RPCStubObject + public abstract fun createInstance (serviceId: kotlin.Long, client: kotlinx.rpc.RpcClient): T of kotlinx.rpc.descriptor.RpcServiceDescriptor declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion - VALUE_PARAMETER name:methodName index:0 type:kotlin.String + VALUE_PARAMETER name:serviceId index:0 type:kotlin.Long + VALUE_PARAMETER name:client index:1 type:kotlinx.rpc.RpcClient BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun methodTypeOf (methodName: kotlin.String): kotlin.reflect.KType? declared in .BoxService.$rpcServiceStub.Companion' - CALL 'public abstract fun get (key: K of kotlin.collections.Map): V of kotlin.collections.Map? declared in kotlin.collections.Map' type=kotlin.reflect.KType? origin=GET_ARRAY_ELEMENT - $this: CALL 'private final fun (): kotlin.collections.Map declared in .BoxService.$rpcServiceStub.Companion' type=kotlin.collections.Map origin=GET_PROPERTY - $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.methodTypeOf' type=.BoxService.$rpcServiceStub.Companion origin=null - key: GET_VAR 'methodName: kotlin.String declared in .BoxService.$rpcServiceStub.Companion.methodTypeOf' type=kotlin.String origin=null - FUN name:rpcFields visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, service:.BoxService) returnType:kotlin.collections.List> + RETURN type=kotlin.Nothing from='public open fun createInstance (serviceId: kotlin.Long, client: kotlinx.rpc.RpcClient): .BoxService declared in .BoxService.$rpcServiceStub.Companion' + CONSTRUCTOR_CALL 'public constructor (__rpc_stub_id: kotlin.Long, __rpc_client: kotlinx.rpc.RpcClient) declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null + __rpc_stub_id: GET_VAR 'serviceId: kotlin.Long declared in .BoxService.$rpcServiceStub.Companion.createInstance' type=kotlin.Long origin=null + __rpc_client: GET_VAR 'client: kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub.Companion.createInstance' type=kotlinx.rpc.RpcClient origin=null + FUN name:getCallable visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, name:kotlin.String) returnType:kotlinx.rpc.descriptor.RpcCallable? overridden: - public abstract fun rpcFields (service: T of kotlinx.rpc.internal.RPCStubObject): kotlin.collections.List> declared in kotlinx.rpc.internal.RPCStubObject + public abstract fun getCallable (name: kotlin.String): kotlinx.rpc.descriptor.RpcCallable? declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion - VALUE_PARAMETER name:service index:0 type:.BoxService + VALUE_PARAMETER name:name index:0 type:kotlin.String BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun rpcFields (service: .BoxService): kotlin.collections.List> declared in .BoxService.$rpcServiceStub.Companion' - TYPE_OP type=kotlin.collections.List> origin=CAST typeOperand=kotlin.collections.List> - CALL 'public final fun emptyList (): kotlin.collections.List declared in kotlin.collections' type=kotlin.collections.List origin=null - : kotlin.Any? - FUN name:withClient visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, serviceId:kotlin.Long, client:kotlinx.rpc.RPCClient) returnType:.BoxService + RETURN type=kotlin.Nothing from='public open fun getCallable (name: kotlin.String): kotlinx.rpc.descriptor.RpcCallable? declared in .BoxService.$rpcServiceStub.Companion' + CALL 'public abstract fun get (key: K of kotlin.collections.Map): V of kotlin.collections.Map? declared in kotlin.collections.Map' type=kotlinx.rpc.descriptor.RpcCallable? origin=GET_ARRAY_ELEMENT + $this: CALL 'private final fun (): kotlin.collections.Map.BoxService>> declared in .BoxService.$rpcServiceStub.Companion' type=kotlin.collections.Map.BoxService>> origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.getCallable' type=.BoxService.$rpcServiceStub.Companion origin=null + key: GET_VAR 'name: kotlin.String declared in .BoxService.$rpcServiceStub.Companion.getCallable' type=kotlin.String origin=null + FUN name:getFields visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, service:.BoxService) returnType:kotlin.collections.List> overridden: - public abstract fun withClient (serviceId: kotlin.Long, client: kotlinx.rpc.RPCClient): T of kotlinx.rpc.internal.RPCStubObject declared in kotlinx.rpc.internal.RPCStubObject + public abstract fun getFields (service: T of kotlinx.rpc.descriptor.RpcServiceDescriptor): kotlin.collections.List> declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion - VALUE_PARAMETER name:serviceId index:0 type:kotlin.Long - VALUE_PARAMETER name:client index:1 type:kotlinx.rpc.RPCClient + VALUE_PARAMETER name:service index:0 type:.BoxService BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun withClient (serviceId: kotlin.Long, client: kotlinx.rpc.RPCClient): .BoxService declared in .BoxService.$rpcServiceStub.Companion' - CONSTRUCTOR_CALL 'public constructor (__rpc_stub_id: kotlin.Long, __rpc_client: kotlinx.rpc.RPCClient) declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null - __rpc_stub_id: GET_VAR 'serviceId: kotlin.Long declared in .BoxService.$rpcServiceStub.Companion.withClient' type=kotlin.Long origin=null - __rpc_client: GET_VAR 'client: kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub.Companion.withClient' type=kotlinx.rpc.RPCClient origin=null - CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] CLASS name:stream$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RPCMethodClassArguments] + RETURN type=kotlin.Nothing from='public open fun getFields (service: .BoxService): kotlin.collections.List> declared in .BoxService.$rpcServiceStub.Companion' + TYPE_OP type=kotlin.collections.List> origin=CAST typeOperand=kotlin.collections.List> + CALL 'public final fun emptyList (): kotlin.collections.List declared in kotlin.collections' type=kotlin.collections.List origin=null + : kotlin.Any? + CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] CLASS name:stream$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RpcMethodClass] annotations: Serializable(with = ) $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BoxService.$rpcServiceStub.stream$rpcMethod @@ -196,18 +252,18 @@ FILE fqName: fileName:/flowParameter.kt receiver: GET_VAR ': .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.' type=.BoxService.$rpcServiceStub.stream$rpcMethod.$serializer origin=null ANONYMOUS_INITIALIZER isStatic=false BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlinx.serialization.internal.PluginGeneratedSerialDescriptor [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlinx.serialization.internal.PluginGeneratedSerialDescriptor [val] CONSTRUCTOR_CALL 'public constructor (serialName: kotlin.String, generatedSerializer: kotlinx.serialization.internal.GeneratedSerializer<*>?, elementsCount: kotlin.Int) declared in kotlinx.serialization.internal.PluginGeneratedSerialDescriptor' type=kotlinx.serialization.internal.PluginGeneratedSerialDescriptor origin=null serialName: CONST String type=kotlin.String value="BoxService.$rpcServiceStub.stream$rpcMethod" generatedSerializer: GET_VAR ': .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer' type=.BoxService.$rpcServiceStub.stream$rpcMethod.$serializer origin=null elementsCount: CONST Int type=kotlin.Int value=1 CALL 'public final fun addElement (name: kotlin.String, isOptional: kotlin.Boolean): kotlin.Unit declared in kotlinx.serialization.internal.PluginGeneratedSerialDescriptor' type=kotlin.Unit origin=null - $this: GET_VAR 'val tmp_0: kotlinx.serialization.internal.PluginGeneratedSerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer' type=kotlinx.serialization.internal.PluginGeneratedSerialDescriptor origin=null + $this: GET_VAR 'val tmp_1: kotlinx.serialization.internal.PluginGeneratedSerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer' type=kotlinx.serialization.internal.PluginGeneratedSerialDescriptor origin=null name: CONST String type=kotlin.String value="flow" isOptional: CONST Boolean type=kotlin.Boolean value=false SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:descriptor type:kotlinx.serialization.descriptors.SerialDescriptor visibility:private [final]' type=kotlin.Unit origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer' type=.BoxService.$rpcServiceStub.stream$rpcMethod.$serializer origin=null - value: GET_VAR 'val tmp_0: kotlinx.serialization.internal.PluginGeneratedSerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer' type=kotlinx.serialization.internal.PluginGeneratedSerialDescriptor origin=null + value: GET_VAR 'val tmp_1: kotlinx.serialization.internal.PluginGeneratedSerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer' type=kotlinx.serialization.internal.PluginGeneratedSerialDescriptor origin=null CONSTRUCTOR GENERATED[org.jetbrains.kotlinx.serialization.compiler.fir.SerializationPluginKey] visibility:private <> () returnType:.BoxService.$rpcServiceStub.stream$rpcMethod.$serializer [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' @@ -234,7 +290,7 @@ FILE fqName: fileName:/flowParameter.kt public abstract fun childSerializers (): kotlin.Array> declared in kotlinx.serialization.internal.GeneratedSerializer $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.stream$rpcMethod.$serializer BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Array> [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlin.Array> [val] CALL 'private final fun (): kotlin.Array> declared in .BoxService.$rpcServiceStub.stream$rpcMethod.Companion' type=kotlin.Array> origin=null $this: GET_OBJECT 'CLASS GENERATED[org.jetbrains.kotlinx.serialization.compiler.fir.SerializationPluginKey] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]' type=.BoxService.$rpcServiceStub.stream$rpcMethod.Companion RETURN type=kotlin.Nothing from='public final fun childSerializers (): kotlin.Array> declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer' @@ -242,7 +298,7 @@ FILE fqName: fileName:/flowParameter.kt : kotlinx.serialization.KSerializer<*> elements: VARARG type=kotlin.Array> varargElementType=kotlinx.serialization.KSerializer<*> CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=T of kotlin.Array origin=null - $this: GET_VAR 'val tmp_1: kotlin.Array> declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.childSerializers' type=kotlin.Array> origin=null + $this: GET_VAR 'val tmp_2: kotlin.Array> declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.childSerializers' type=kotlin.Array> origin=null index: CONST Int type=kotlin.Int value=0 FUN GENERATED[org.jetbrains.kotlinx.serialization.compiler.fir.SerializationPluginKey] name:deserialize visibility:public modality:FINAL <> ($this:.BoxService.$rpcServiceStub.stream$rpcMethod.$serializer, decoder:kotlinx.serialization.encoding.Decoder) returnType:.BoxService.$rpcServiceStub.stream$rpcMethod overridden: @@ -250,91 +306,91 @@ FILE fqName: fileName:/flowParameter.kt $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.stream$rpcMethod.$serializer VALUE_PARAMETER name:decoder index:0 type:kotlinx.serialization.encoding.Decoder BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlinx.serialization.descriptors.SerialDescriptor [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlinx.serialization.descriptors.SerialDescriptor [val] CALL 'public final fun (): kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer' type=kotlinx.serialization.descriptors.SerialDescriptor origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=.BoxService.$rpcServiceStub.stream$rpcMethod.$serializer origin=null - VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Boolean [var] + VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:kotlin.Boolean [var] CONST Boolean type=kotlin.Boolean value=true - VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:kotlin.Int [var] - CONST Int type=kotlin.Int value=0 VAR IR_TEMPORARY_VARIABLE name:tmp_5 type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 - VAR IR_TEMPORARY_VARIABLE name:tmp_6 type:kotlinx.coroutines.flow.Flow? [var] + VAR IR_TEMPORARY_VARIABLE name:tmp_6 type:kotlin.Int [var] + CONST Int type=kotlin.Int value=0 + VAR IR_TEMPORARY_VARIABLE name:tmp_7 type:kotlinx.coroutines.flow.Flow? [var] CONST Null type=kotlinx.coroutines.flow.Flow? value=null - VAR IR_TEMPORARY_VARIABLE name:tmp_7 type:kotlinx.serialization.encoding.CompositeDecoder [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_8 type:kotlinx.serialization.encoding.CompositeDecoder [val] CALL 'public abstract fun beginStructure (descriptor: kotlinx.serialization.descriptors.SerialDescriptor): kotlinx.serialization.encoding.CompositeDecoder declared in kotlinx.serialization.encoding.Decoder' type=kotlinx.serialization.encoding.CompositeDecoder origin=null $this: GET_VAR 'decoder: kotlinx.serialization.encoding.Decoder declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.Decoder origin=null - descriptor: GET_VAR 'val tmp_2: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null - VAR IR_TEMPORARY_VARIABLE name:tmp_8 type:kotlin.Array> [val] + descriptor: GET_VAR 'val tmp_3: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + VAR IR_TEMPORARY_VARIABLE name:tmp_9 type:kotlin.Array> [val] CALL 'private final fun (): kotlin.Array> declared in .BoxService.$rpcServiceStub.stream$rpcMethod.Companion' type=kotlin.Array> origin=null $this: GET_OBJECT 'CLASS GENERATED[org.jetbrains.kotlinx.serialization.compiler.fir.SerializationPluginKey] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]' type=.BoxService.$rpcServiceStub.stream$rpcMethod.Companion WHEN type=kotlin.Unit origin=null BRANCH if: CALL 'public open fun decodeSequentially (): kotlin.Boolean declared in kotlinx.serialization.encoding.CompositeDecoder' type=kotlin.Boolean origin=null - $this: GET_VAR 'val tmp_7: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null + $this: GET_VAR 'val tmp_8: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null then: BLOCK type=kotlin.Unit origin=null BLOCK type=kotlin.Unit origin=null - SET_VAR 'var tmp_6: kotlinx.coroutines.flow.Flow? declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + SET_VAR 'var tmp_7: kotlinx.coroutines.flow.Flow? declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CALL 'public abstract fun decodeSerializableElement (descriptor: kotlinx.serialization.descriptors.SerialDescriptor, index: kotlin.Int, deserializer: kotlinx.serialization.DeserializationStrategy, previousValue: T of kotlinx.serialization.encoding.CompositeDecoder.decodeSerializableElement?): T of kotlinx.serialization.encoding.CompositeDecoder.decodeSerializableElement declared in kotlinx.serialization.encoding.CompositeDecoder' type=kotlinx.coroutines.flow.Flow origin=null : kotlinx.coroutines.flow.Flow - $this: GET_VAR 'val tmp_7: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null - descriptor: GET_VAR 'val tmp_2: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + $this: GET_VAR 'val tmp_8: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null + descriptor: GET_VAR 'val tmp_3: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null index: CONST Int type=kotlin.Int value=0 deserializer: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=T of kotlin.Array origin=null - $this: GET_VAR 'val tmp_8: kotlin.Array> declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Array> origin=null + $this: GET_VAR 'val tmp_9: kotlin.Array> declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Array> origin=null index: CONST Int type=kotlin.Int value=0 - previousValue: GET_VAR 'var tmp_6: kotlinx.coroutines.flow.Flow? declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.coroutines.flow.Flow? origin=null - SET_VAR 'var tmp_5: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + previousValue: GET_VAR 'var tmp_7: kotlinx.coroutines.flow.Flow? declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.coroutines.flow.Flow? origin=null + SET_VAR 'var tmp_6: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CALL 'public final fun or (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null - $this: GET_VAR 'var tmp_5: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + $this: GET_VAR 'var tmp_6: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null other: CONST Int type=kotlin.Int value=1 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: WHILE label=null origin=null - condition: GET_VAR 'var tmp_3: kotlin.Boolean declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Boolean origin=null + condition: GET_VAR 'var tmp_4: kotlin.Boolean declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Boolean origin=null body: BLOCK type=kotlin.Unit origin=null - SET_VAR 'var tmp_4: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + SET_VAR 'var tmp_5: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CALL 'public abstract fun decodeElementIndex (descriptor: kotlinx.serialization.descriptors.SerialDescriptor): kotlin.Int declared in kotlinx.serialization.encoding.CompositeDecoder' type=kotlin.Int origin=null - $this: GET_VAR 'val tmp_7: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null - descriptor: GET_VAR 'val tmp_2: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + $this: GET_VAR 'val tmp_8: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null + descriptor: GET_VAR 'val tmp_3: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null WHEN type=kotlin.Unit origin=null BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'var tmp_4: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + arg0: GET_VAR 'var tmp_5: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=-1 - then: SET_VAR 'var tmp_3: kotlin.Boolean declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + then: SET_VAR 'var tmp_4: kotlin.Boolean declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CONST Boolean type=kotlin.Boolean value=false BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ - arg0: GET_VAR 'var tmp_4: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + arg0: GET_VAR 'var tmp_5: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=0 then: BLOCK type=kotlin.Unit origin=null - SET_VAR 'var tmp_6: kotlinx.coroutines.flow.Flow? declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + SET_VAR 'var tmp_7: kotlinx.coroutines.flow.Flow? declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CALL 'public abstract fun decodeSerializableElement (descriptor: kotlinx.serialization.descriptors.SerialDescriptor, index: kotlin.Int, deserializer: kotlinx.serialization.DeserializationStrategy, previousValue: T of kotlinx.serialization.encoding.CompositeDecoder.decodeSerializableElement?): T of kotlinx.serialization.encoding.CompositeDecoder.decodeSerializableElement declared in kotlinx.serialization.encoding.CompositeDecoder' type=kotlinx.coroutines.flow.Flow origin=null : kotlinx.coroutines.flow.Flow - $this: GET_VAR 'val tmp_7: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null - descriptor: GET_VAR 'val tmp_2: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + $this: GET_VAR 'val tmp_8: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null + descriptor: GET_VAR 'val tmp_3: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null index: CONST Int type=kotlin.Int value=0 deserializer: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=T of kotlin.Array origin=null - $this: GET_VAR 'val tmp_8: kotlin.Array> declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Array> origin=null + $this: GET_VAR 'val tmp_9: kotlin.Array> declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Array> origin=null index: CONST Int type=kotlin.Int value=0 - previousValue: GET_VAR 'var tmp_6: kotlinx.coroutines.flow.Flow? declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.coroutines.flow.Flow? origin=null - SET_VAR 'var tmp_5: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ + previousValue: GET_VAR 'var tmp_7: kotlinx.coroutines.flow.Flow? declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.coroutines.flow.Flow? origin=null + SET_VAR 'var tmp_6: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Unit origin=EQ CALL 'public final fun or (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null - $this: GET_VAR 'var tmp_5: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + $this: GET_VAR 'var tmp_6: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null other: CONST Int type=kotlin.Int value=1 BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: THROW type=kotlin.Nothing CONSTRUCTOR_CALL 'public constructor (index: kotlin.Int) declared in kotlinx.serialization.UnknownFieldException' type=kotlinx.serialization.UnknownFieldException origin=null - index: GET_VAR 'var tmp_4: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + index: GET_VAR 'var tmp_5: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null CALL 'public abstract fun endStructure (descriptor: kotlinx.serialization.descriptors.SerialDescriptor): kotlin.Unit declared in kotlinx.serialization.encoding.CompositeDecoder' type=kotlin.Unit origin=null - $this: GET_VAR 'val tmp_7: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null - descriptor: GET_VAR 'val tmp_2: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + $this: GET_VAR 'val tmp_8: kotlinx.serialization.encoding.CompositeDecoder declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.encoding.CompositeDecoder origin=null + descriptor: GET_VAR 'val tmp_3: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null RETURN type=kotlin.Nothing from='public final fun deserialize (decoder: kotlinx.serialization.encoding.Decoder): .BoxService.$rpcServiceStub.stream$rpcMethod declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer' CONSTRUCTOR_CALL 'internal constructor (seen0: kotlin.Int, flow: kotlinx.coroutines.flow.Flow?, serializationConstructorMarker: kotlinx.serialization.internal.SerializationConstructorMarker?) declared in .BoxService.$rpcServiceStub.stream$rpcMethod' type=.BoxService.$rpcServiceStub.stream$rpcMethod origin=null - seen0: GET_VAR 'var tmp_5: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null - flow: GET_VAR 'var tmp_6: kotlinx.coroutines.flow.Flow? declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.coroutines.flow.Flow? origin=null + seen0: GET_VAR 'var tmp_6: kotlin.Int declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlin.Int origin=null + flow: GET_VAR 'var tmp_7: kotlinx.coroutines.flow.Flow? declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.deserialize' type=kotlinx.coroutines.flow.Flow? origin=null serializationConstructorMarker: CONST Null type=kotlin.Nothing? value=null FUN GENERATED[org.jetbrains.kotlinx.serialization.compiler.fir.SerializationPluginKey] name:serialize visibility:public modality:FINAL <> ($this:.BoxService.$rpcServiceStub.stream$rpcMethod.$serializer, encoder:kotlinx.serialization.encoding.Encoder, value:.BoxService.$rpcServiceStub.stream$rpcMethod) returnType:kotlin.Unit overridden: @@ -343,25 +399,25 @@ FILE fqName: fileName:/flowParameter.kt VALUE_PARAMETER name:encoder index:0 type:kotlinx.serialization.encoding.Encoder VALUE_PARAMETER name:value index:1 type:.BoxService.$rpcServiceStub.stream$rpcMethod BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_9 type:kotlinx.serialization.descriptors.SerialDescriptor [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_10 type:kotlinx.serialization.descriptors.SerialDescriptor [val] CALL 'public final fun (): kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer' type=kotlinx.serialization.descriptors.SerialDescriptor origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.serialize' type=.BoxService.$rpcServiceStub.stream$rpcMethod.$serializer origin=null - VAR IR_TEMPORARY_VARIABLE name:tmp_10 type:kotlinx.serialization.encoding.CompositeEncoder [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_11 type:kotlinx.serialization.encoding.CompositeEncoder [val] CALL 'public abstract fun beginStructure (descriptor: kotlinx.serialization.descriptors.SerialDescriptor): kotlinx.serialization.encoding.CompositeEncoder declared in kotlinx.serialization.encoding.Encoder' type=kotlinx.serialization.encoding.CompositeEncoder origin=null $this: GET_VAR 'encoder: kotlinx.serialization.encoding.Encoder declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.serialize' type=kotlinx.serialization.encoding.Encoder origin=null - descriptor: GET_VAR 'val tmp_9: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + descriptor: GET_VAR 'val tmp_10: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null CALL 'internal final fun write$Self (self: .BoxService.$rpcServiceStub.stream$rpcMethod, output: kotlinx.serialization.encoding.CompositeEncoder, serialDesc: kotlinx.serialization.descriptors.SerialDescriptor): kotlin.Unit declared in .BoxService.$rpcServiceStub.stream$rpcMethod' type=kotlin.Unit origin=null self: GET_VAR 'value: .BoxService.$rpcServiceStub.stream$rpcMethod declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.serialize' type=.BoxService.$rpcServiceStub.stream$rpcMethod origin=null - output: GET_VAR 'val tmp_10: kotlinx.serialization.encoding.CompositeEncoder declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.serialize' type=kotlinx.serialization.encoding.CompositeEncoder origin=null - serialDesc: GET_VAR 'val tmp_9: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + output: GET_VAR 'val tmp_11: kotlinx.serialization.encoding.CompositeEncoder declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.serialize' type=kotlinx.serialization.encoding.CompositeEncoder origin=null + serialDesc: GET_VAR 'val tmp_10: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null CALL 'public abstract fun endStructure (descriptor: kotlinx.serialization.descriptors.SerialDescriptor): kotlin.Unit declared in kotlinx.serialization.encoding.CompositeEncoder' type=kotlin.Unit origin=null - $this: GET_VAR 'val tmp_10: kotlinx.serialization.encoding.CompositeEncoder declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.serialize' type=kotlinx.serialization.encoding.CompositeEncoder origin=null - descriptor: GET_VAR 'val tmp_9: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null + $this: GET_VAR 'val tmp_11: kotlinx.serialization.encoding.CompositeEncoder declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.serialize' type=kotlinx.serialization.encoding.CompositeEncoder origin=null + descriptor: GET_VAR 'val tmp_10: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.$serializer.serialize' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null CONSTRUCTOR GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] visibility:public <> (flow:kotlinx.coroutines.flow.Flow) returnType:.BoxService.$rpcServiceStub.stream$rpcMethod [primary] VALUE_PARAMETER GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] name:flow index:0 type:kotlinx.coroutines.flow.Flow BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] CLASS name:stream$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RPCMethodClassArguments]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] CLASS name:stream$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RpcMethodClass]' CONSTRUCTOR KOTLINX_SERIALIZATION visibility:internal <> (seen0:kotlin.Int, flow:kotlinx.coroutines.flow.Flow?, serializationConstructorMarker:kotlinx.serialization.internal.SerializationConstructorMarker?) returnType:.BoxService.$rpcServiceStub.stream$rpcMethod VALUE_PARAMETER KOTLINX_SERIALIZATION name:seen0 index:0 type:kotlin.Int VALUE_PARAMETER KOTLINX_SERIALIZATION name:flow index:1 type:kotlinx.coroutines.flow.Flow? @@ -404,7 +460,7 @@ FILE fqName: fileName:/flowParameter.kt VALUE_PARAMETER KOTLINX_SERIALIZATION name:output index:1 type:kotlinx.serialization.encoding.CompositeEncoder VALUE_PARAMETER KOTLINX_SERIALIZATION name:serialDesc index:2 type:kotlinx.serialization.descriptors.SerialDescriptor BLOCK_BODY - VAR IR_TEMPORARY_VARIABLE name:tmp_11 type:kotlin.Array> [val] + VAR IR_TEMPORARY_VARIABLE name:tmp_12 type:kotlin.Array> [val] CALL 'private final fun (): kotlin.Array> declared in .BoxService.$rpcServiceStub.stream$rpcMethod.Companion' type=kotlin.Array> origin=null $this: GET_OBJECT 'CLASS GENERATED[org.jetbrains.kotlinx.serialization.compiler.fir.SerializationPluginKey] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]' type=.BoxService.$rpcServiceStub.stream$rpcMethod.Companion CALL 'public abstract fun encodeSerializableElement (descriptor: kotlinx.serialization.descriptors.SerialDescriptor, index: kotlin.Int, serializer: kotlinx.serialization.SerializationStrategy, value: T of kotlinx.serialization.encoding.CompositeEncoder.encodeSerializableElement): kotlin.Unit declared in kotlinx.serialization.encoding.CompositeEncoder' type=kotlin.Unit origin=null @@ -413,13 +469,13 @@ FILE fqName: fileName:/flowParameter.kt descriptor: GET_VAR 'serialDesc: kotlinx.serialization.descriptors.SerialDescriptor declared in .BoxService.$rpcServiceStub.stream$rpcMethod.write$Self' type=kotlinx.serialization.descriptors.SerialDescriptor origin=null index: CONST Int type=kotlin.Int value=0 serializer: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=T of kotlin.Array origin=null - $this: GET_VAR 'val tmp_11: kotlin.Array> declared in .BoxService.$rpcServiceStub.stream$rpcMethod.write$Self' type=kotlin.Array> origin=null + $this: GET_VAR 'val tmp_12: kotlin.Array> declared in .BoxService.$rpcServiceStub.stream$rpcMethod.write$Self' type=kotlin.Array> origin=null index: CONST Int type=kotlin.Int value=0 value: CALL 'public final fun (): kotlinx.coroutines.flow.Flow declared in .BoxService.$rpcServiceStub.stream$rpcMethod' type=kotlinx.coroutines.flow.Flow origin=GET_PROPERTY $this: GET_VAR 'self: .BoxService.$rpcServiceStub.stream$rpcMethod declared in .BoxService.$rpcServiceStub.stream$rpcMethod.write$Self' type=.BoxService.$rpcServiceStub.stream$rpcMethod origin=null FUN name:asArray visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.stream$rpcMethod) returnType:kotlin.Array overridden: - public abstract fun asArray (): kotlin.Array declared in kotlinx.rpc.internal.RPCMethodClassArguments + public abstract fun asArray (): kotlin.Array declared in kotlinx.rpc.internal.RpcMethodClass $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.stream$rpcMethod BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun asArray (): kotlin.Array declared in .BoxService.$rpcServiceStub.stream$rpcMethod' @@ -428,9 +484,9 @@ FILE fqName: fileName:/flowParameter.kt elements: VARARG type=kotlin.Array varargElementType=kotlin.Any? CALL 'public final fun (): kotlinx.coroutines.flow.Flow declared in .BoxService.$rpcServiceStub.stream$rpcMethod' type=kotlinx.coroutines.flow.Flow origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub.stream$rpcMethod declared in .BoxService.$rpcServiceStub.stream$rpcMethod.asArray' type=.BoxService.$rpcServiceStub.stream$rpcMethod origin=null - CONSTRUCTOR visibility:public <> (__rpc_stub_id:kotlin.Long, __rpc_client:kotlinx.rpc.RPCClient) returnType:.BoxService.$rpcServiceStub [primary] + CONSTRUCTOR visibility:public <> (__rpc_stub_id:kotlin.Long, __rpc_client:kotlinx.rpc.RpcClient) returnType:.BoxService.$rpcServiceStub [primary] VALUE_PARAMETER name:__rpc_stub_id index:0 type:kotlin.Long - VALUE_PARAMETER name:__rpc_client index:1 type:kotlinx.rpc.RPCClient + VALUE_PARAMETER name:__rpc_client index:1 type:kotlinx.rpc.RpcClient BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedStubKey] CLASS name:$rpcServiceStub modality:FINAL visibility:public superTypes:[.BoxService]' @@ -461,22 +517,17 @@ FILE fqName: fileName:/flowParameter.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .BoxService.$rpcServiceStub.stream' - CALL 'public abstract fun call (call: kotlinx.rpc.RPCCall): T of kotlinx.rpc.RPCClient.call declared in kotlinx.rpc.RPCClient' type=kotlin.String origin=null + CALL 'public abstract fun call (call: kotlinx.rpc.RpcCall): T of kotlinx.rpc.RpcClient.call declared in kotlinx.rpc.RpcClient' type=kotlin.String origin=null : kotlin.String - $this: CALL 'private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RPCClient origin=GET_PROPERTY + $this: CALL 'private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RpcClient origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.stream' type=.BoxService.$rpcServiceStub origin=null - call: CONSTRUCTOR_CALL 'public constructor (serviceTypeString: kotlin.String, serviceId: kotlin.Long, callableName: kotlin.String, type: kotlinx.rpc.RPCCall.Type, data: kotlin.Any, dataType: kotlin.reflect.KType, returnType: kotlin.reflect.KType) declared in kotlinx.rpc.RPCCall' type=kotlinx.rpc.RPCCall origin=null - serviceTypeString: CONST String type=kotlin.String value="BoxService" - serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY - $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.stream' type=.BoxService.$rpcServiceStub origin=null + call: CONSTRUCTOR_CALL 'public constructor (descriptor: kotlinx.rpc.descriptor.RpcServiceDescriptor<*>, callableName: kotlin.String, data: kotlin.Any, serviceId: kotlin.Long) declared in kotlinx.rpc.RpcCall' type=kotlinx.rpc.RpcCall origin=null + descriptor: GET_OBJECT 'CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>]' type=.BoxService.$rpcServiceStub.Companion callableName: CONST String type=kotlin.String value="stream" - type: GET_ENUM 'ENUM_ENTRY name:Method' type=kotlinx.rpc.RPCCall.Type data: CONSTRUCTOR_CALL 'public constructor (flow: kotlinx.coroutines.flow.Flow) declared in .BoxService.$rpcServiceStub.stream$rpcMethod' type=.BoxService.$rpcServiceStub.stream$rpcMethod origin=null flow: GET_VAR 'flow: kotlinx.coroutines.flow.Flow declared in .BoxService.$rpcServiceStub.stream' type=kotlinx.coroutines.flow.Flow origin=null - dataType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : .BoxService.$rpcServiceStub.stream$rpcMethod - returnType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : kotlin.String + serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.stream' type=.BoxService.$rpcServiceStub origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlinx.rpc.RemoteService @@ -514,7 +565,7 @@ FILE fqName: fileName:/flowParameter.kt CALL 'public abstract fun stream (flow: kotlinx.coroutines.flow.Flow): kotlin.String declared in .BoxService' type=kotlin.String origin=null $this: CALL 'public final fun withService (): T of kotlinx.rpc.withService declared in kotlinx.rpc' type=.BoxService origin=null : .BoxService - $receiver: GET_OBJECT 'CLASS OBJECT name:TestRpcClient modality:FINAL visibility:public superTypes:[kotlinx.rpc.RPCClient]' type=kotlinx.rpc.codegen.test.TestRpcClient + $receiver: GET_OBJECT 'CLASS OBJECT name:TestRpcClient modality:FINAL visibility:public superTypes:[kotlinx.rpc.RpcClient]' type=kotlinx.rpc.codegen.test.TestRpcClient flow: CALL 'public final fun flow (block: @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1, kotlin.Unit>): kotlinx.coroutines.flow.Flow declared in kotlinx.coroutines.flow' type=kotlinx.coroutines.flow.Flow origin=null : kotlin.String block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1, kotlin.Unit> origin=LAMBDA diff --git a/tests/compiler-plugin-tests/src/testData/box/multiModule.fir.ir.txt b/tests/compiler-plugin-tests/src/testData/box/multiModule.fir.ir.txt index 8e60a084e..a74628ac4 100644 --- a/tests/compiler-plugin-tests/src/testData/box/multiModule.fir.ir.txt +++ b/tests/compiler-plugin-tests/src/testData/box/multiModule.fir.ir.txt @@ -18,23 +18,23 @@ FILE fqName: fileName:/module_lib_multiModule.kt GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:__rpc_stub_id type:kotlin.Long visibility:private [final]' type=kotlin.Long origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.' type=.BoxService.$rpcServiceStub origin=null PROPERTY name:__rpc_client visibility:private modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RPCClient visibility:private [final] + FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RpcClient visibility:private [final] EXPRESSION_BODY - GET_VAR '__rpc_client: kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub.' type=kotlinx.rpc.RPCClient origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub) returnType:kotlinx.rpc.RPCClient + GET_VAR '__rpc_client: kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub.' type=kotlinx.rpc.RpcClient origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub) returnType:kotlinx.rpc.RpcClient correspondingProperty: PROPERTY name:__rpc_client visibility:private modality:FINAL [val] $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub BLOCK_BODY - RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RPCClient visibility:private [final]' type=kotlinx.rpc.RPCClient origin=null + RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RpcClient visibility:private [final]' type=kotlinx.rpc.RpcClient origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.' type=.BoxService.$rpcServiceStub origin=null PROPERTY name:coroutineContext visibility:public modality:FINAL [val] overridden: - public abstract coroutineContext: kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RPCClient + public abstract coroutineContext: kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RpcClient FIELD PROPERTY_BACKING_FIELD name:coroutineContext type:kotlin.coroutines.CoroutineContext visibility:private [final] EXPRESSION_BODY - CALL 'public abstract fun provideStubContext (serviceId: kotlin.Long): kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RPCClient' type=kotlin.coroutines.CoroutineContext origin=null - $this: CALL 'private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RPCClient origin=GET_PROPERTY + CALL 'public abstract fun provideStubContext (serviceId: kotlin.Long): kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RpcClient' type=kotlin.coroutines.CoroutineContext origin=null + $this: CALL 'private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RpcClient origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null @@ -47,78 +47,127 @@ FILE fqName: fileName:/module_lib_multiModule.kt RETURN type=kotlin.Nothing from='public final fun (): kotlin.coroutines.CoroutineContext declared in .BoxService.$rpcServiceStub' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:coroutineContext type:kotlin.coroutines.CoroutineContext visibility:private [final]' type=kotlin.coroutines.CoroutineContext origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.' type=.BoxService.$rpcServiceStub origin=null - CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.internal.RPCStubObject<.BoxService>] + CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BoxService.$rpcServiceStub.Companion - PROPERTY name:methodNames visibility:private modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:methodNames type:kotlin.collections.Map visibility:private [final] + PROPERTY name:fqName visibility:public modality:FINAL [val] + overridden: + public abstract fqName: kotlin.String declared in kotlinx.rpc.descriptor.RpcServiceDescriptor + FIELD PROPERTY_BACKING_FIELD name:fqName type:kotlin.String visibility:private [final] + EXPRESSION_BODY + CONST String type=kotlin.String value="BoxService" + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlin.String + correspondingProperty: PROPERTY name:fqName visibility:public modality:FINAL [val] + overridden: + public abstract fun (): kotlin.String declared in kotlinx.rpc.descriptor.RpcServiceDescriptor + $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:fqName type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + PROPERTY name:simpleInvokator visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:simpleInvokator type:kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> visibility:private [final] + EXPRESSION_BODY + TYPE_OP type=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> origin=SAM_CONVERSION typeOperand=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> + FUN_EXPR type=kotlin.coroutines.SuspendFunction2<.BoxService, kotlin.Any?, kotlin.Any?> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (service:.BoxService, data:kotlin.Any?) returnType:kotlin.Any? [suspend] + VALUE_PARAMETER name:service index:0 type:.BoxService + VALUE_PARAMETER name:data index:1 type:kotlin.Any? + BLOCK_BODY + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.BoxService.$rpcServiceStub.simple$rpcMethod [val] + CALL 'public final fun dataCast (methodName: kotlin.String, serviceName: kotlin.String): T of kotlinx.rpc.internal.dataCast declared in kotlinx.rpc.internal' type=.BoxService.$rpcServiceStub.simple$rpcMethod origin=null + : .BoxService.$rpcServiceStub.simple$rpcMethod + $receiver: GET_VAR 'data: kotlin.Any? declared in .BoxService.$rpcServiceStub.Companion.simpleInvokator.' type=kotlin.Any? origin=null + methodName: CONST String type=kotlin.String value="simple" + serviceName: CONST String type=kotlin.String value="BoxService" + RETURN type=kotlin.Nothing from='local final fun (service: .BoxService, data: kotlin.Any?): kotlin.Any? declared in .BoxService.$rpcServiceStub.Companion.simpleInvokator' + CALL 'public abstract fun simple (): kotlin.String declared in .BoxService' type=kotlin.String origin=null + $this: GET_VAR 'service: .BoxService declared in .BoxService.$rpcServiceStub.Companion.simpleInvokator.' type=.BoxService origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> + correspondingProperty: PROPERTY name:simpleInvokator visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:simpleInvokator type:kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> visibility:private [final]' type=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + PROPERTY name:callableMap visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:callableMap type:kotlin.collections.Map.BoxService>> visibility:private [final] EXPRESSION_BODY - CALL 'public final fun mapOf (vararg pairs: kotlin.Pair): kotlin.collections.Map declared in kotlin.collections' type=kotlin.collections.Map origin=null + CALL 'public final fun mapOf (vararg pairs: kotlin.Pair): kotlin.collections.Map declared in kotlin.collections' type=kotlin.collections.Map.BoxService>> origin=null : kotlin.String - : kotlin.reflect.KType - pairs: VARARG type=kotlin.Array> varargElementType=kotlin.Pair - CALL 'public final fun to (that: B of kotlin.to): kotlin.Pair declared in kotlin' type=kotlin.Pair origin=null + : kotlinx.rpc.descriptor.RpcCallable<.BoxService> + pairs: VARARG type=kotlin.Array.BoxService>>> varargElementType=kotlin.Pair.BoxService>> + CALL 'public final fun to (that: B of kotlin.to): kotlin.Pair declared in kotlin' type=kotlin.Pair.BoxService>> origin=null : kotlin.String - : kotlin.reflect.KType + : kotlinx.rpc.descriptor.RpcCallable<.BoxService> $receiver: CONST String type=kotlin.String value="simple" - that: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : .BoxService.$rpcServiceStub.simple$rpcMethod - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlin.collections.Map - correspondingProperty: PROPERTY name:methodNames visibility:private modality:FINAL [val] + that: CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, dataType: kotlin.reflect.KType, returnType: kotlin.reflect.KType, invokator: kotlinx.rpc.descriptor.RpcInvokator, parameters: kotlin.Array) declared in kotlinx.rpc.descriptor.RpcCallable' type=kotlinx.rpc.descriptor.RpcCallable<.BoxService> origin=null + : .BoxService + name: CONST String type=kotlin.String value="simple" + dataType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : .BoxService.$rpcServiceStub.simple$rpcMethod + returnType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : kotlin.String + invokator: CALL 'private final fun (): kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> declared in .BoxService.$rpcServiceStub.Companion' type=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion' type=.BoxService.$rpcServiceStub.Companion origin=null + parameters: CALL 'public final fun emptyArray (): kotlin.Array declared in kotlin' type=kotlin.Array origin=null + : kotlinx.rpc.descriptor.RpcParameter + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlin.collections.Map.BoxService>> + correspondingProperty: PROPERTY name:callableMap visibility:private modality:FINAL [val] $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion BLOCK_BODY - RETURN type=kotlin.Nothing from='private final fun (): kotlin.collections.Map declared in .BoxService.$rpcServiceStub.Companion' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:methodNames type:kotlin.collections.Map visibility:private [final]' type=kotlin.collections.Map origin=null - receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + RETURN type=kotlin.Nothing from='private final fun (): kotlin.collections.Map.BoxService>> declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:callableMap type:kotlin.collections.Map.BoxService>> visibility:private [final]' type=kotlin.collections.Map.BoxService>> origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null CONSTRUCTOR visibility:private <> () returnType:.BoxService.$rpcServiceStub.Companion [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.internal.RPCStubObject<.BoxService>]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>]' FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlinx.rpc.internal.RPCStubObject + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:kotlin.Any VALUE_PARAMETER name:other index:0 type:kotlin.Any? FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] overridden: - public open fun hashCode (): kotlin.Int declared in kotlinx.rpc.internal.RPCStubObject + public open fun hashCode (): kotlin.Int declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:kotlin.Any FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] overridden: - public open fun toString (): kotlin.String declared in kotlinx.rpc.internal.RPCStubObject + public open fun toString (): kotlin.String declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:methodTypeOf visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, methodName:kotlin.String) returnType:kotlin.reflect.KType? + FUN name:createInstance visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, serviceId:kotlin.Long, client:kotlinx.rpc.RpcClient) returnType:.BoxService overridden: - public abstract fun methodTypeOf (methodName: kotlin.String): kotlin.reflect.KType? declared in kotlinx.rpc.internal.RPCStubObject + public abstract fun createInstance (serviceId: kotlin.Long, client: kotlinx.rpc.RpcClient): T of kotlinx.rpc.descriptor.RpcServiceDescriptor declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion - VALUE_PARAMETER name:methodName index:0 type:kotlin.String + VALUE_PARAMETER name:serviceId index:0 type:kotlin.Long + VALUE_PARAMETER name:client index:1 type:kotlinx.rpc.RpcClient BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun methodTypeOf (methodName: kotlin.String): kotlin.reflect.KType? declared in .BoxService.$rpcServiceStub.Companion' - CALL 'public abstract fun get (key: K of kotlin.collections.Map): V of kotlin.collections.Map? declared in kotlin.collections.Map' type=kotlin.reflect.KType? origin=GET_ARRAY_ELEMENT - $this: CALL 'private final fun (): kotlin.collections.Map declared in .BoxService.$rpcServiceStub.Companion' type=kotlin.collections.Map origin=GET_PROPERTY - $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.methodTypeOf' type=.BoxService.$rpcServiceStub.Companion origin=null - key: GET_VAR 'methodName: kotlin.String declared in .BoxService.$rpcServiceStub.Companion.methodTypeOf' type=kotlin.String origin=null - FUN name:rpcFields visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, service:.BoxService) returnType:kotlin.collections.List> + RETURN type=kotlin.Nothing from='public open fun createInstance (serviceId: kotlin.Long, client: kotlinx.rpc.RpcClient): .BoxService declared in .BoxService.$rpcServiceStub.Companion' + CONSTRUCTOR_CALL 'public constructor (__rpc_stub_id: kotlin.Long, __rpc_client: kotlinx.rpc.RpcClient) declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null + __rpc_stub_id: GET_VAR 'serviceId: kotlin.Long declared in .BoxService.$rpcServiceStub.Companion.createInstance' type=kotlin.Long origin=null + __rpc_client: GET_VAR 'client: kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub.Companion.createInstance' type=kotlinx.rpc.RpcClient origin=null + FUN name:getCallable visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, name:kotlin.String) returnType:kotlinx.rpc.descriptor.RpcCallable? overridden: - public abstract fun rpcFields (service: T of kotlinx.rpc.internal.RPCStubObject): kotlin.collections.List> declared in kotlinx.rpc.internal.RPCStubObject + public abstract fun getCallable (name: kotlin.String): kotlinx.rpc.descriptor.RpcCallable? declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion - VALUE_PARAMETER name:service index:0 type:.BoxService + VALUE_PARAMETER name:name index:0 type:kotlin.String BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun rpcFields (service: .BoxService): kotlin.collections.List> declared in .BoxService.$rpcServiceStub.Companion' - TYPE_OP type=kotlin.collections.List> origin=CAST typeOperand=kotlin.collections.List> - CALL 'public final fun emptyList (): kotlin.collections.List declared in kotlin.collections' type=kotlin.collections.List origin=null - : kotlin.Any? - FUN name:withClient visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, serviceId:kotlin.Long, client:kotlinx.rpc.RPCClient) returnType:.BoxService + RETURN type=kotlin.Nothing from='public open fun getCallable (name: kotlin.String): kotlinx.rpc.descriptor.RpcCallable? declared in .BoxService.$rpcServiceStub.Companion' + CALL 'public abstract fun get (key: K of kotlin.collections.Map): V of kotlin.collections.Map? declared in kotlin.collections.Map' type=kotlinx.rpc.descriptor.RpcCallable? origin=GET_ARRAY_ELEMENT + $this: CALL 'private final fun (): kotlin.collections.Map.BoxService>> declared in .BoxService.$rpcServiceStub.Companion' type=kotlin.collections.Map.BoxService>> origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.getCallable' type=.BoxService.$rpcServiceStub.Companion origin=null + key: GET_VAR 'name: kotlin.String declared in .BoxService.$rpcServiceStub.Companion.getCallable' type=kotlin.String origin=null + FUN name:getFields visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, service:.BoxService) returnType:kotlin.collections.List> overridden: - public abstract fun withClient (serviceId: kotlin.Long, client: kotlinx.rpc.RPCClient): T of kotlinx.rpc.internal.RPCStubObject declared in kotlinx.rpc.internal.RPCStubObject + public abstract fun getFields (service: T of kotlinx.rpc.descriptor.RpcServiceDescriptor): kotlin.collections.List> declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion - VALUE_PARAMETER name:serviceId index:0 type:kotlin.Long - VALUE_PARAMETER name:client index:1 type:kotlinx.rpc.RPCClient + VALUE_PARAMETER name:service index:0 type:.BoxService BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun withClient (serviceId: kotlin.Long, client: kotlinx.rpc.RPCClient): .BoxService declared in .BoxService.$rpcServiceStub.Companion' - CONSTRUCTOR_CALL 'public constructor (__rpc_stub_id: kotlin.Long, __rpc_client: kotlinx.rpc.RPCClient) declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null - __rpc_stub_id: GET_VAR 'serviceId: kotlin.Long declared in .BoxService.$rpcServiceStub.Companion.withClient' type=kotlin.Long origin=null - __rpc_client: GET_VAR 'client: kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub.Companion.withClient' type=kotlinx.rpc.RPCClient origin=null - CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] OBJECT name:simple$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RPCMethodClassArguments] + RETURN type=kotlin.Nothing from='public open fun getFields (service: .BoxService): kotlin.collections.List> declared in .BoxService.$rpcServiceStub.Companion' + TYPE_OP type=kotlin.collections.List> origin=CAST typeOperand=kotlin.collections.List> + CALL 'public final fun emptyList (): kotlin.collections.List declared in kotlin.collections' type=kotlin.collections.List origin=null + : kotlin.Any? + CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] OBJECT name:simple$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RpcMethodClass] annotations: Serializable(with = ) $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BoxService.$rpcServiceStub.simple$rpcMethod @@ -136,7 +185,7 @@ FILE fqName: fileName:/module_lib_multiModule.kt CONSTRUCTOR_CALL 'internal constructor (serialName: kotlin.String, objectInstance: T of kotlinx.serialization.internal.ObjectSerializer, classAnnotations: kotlin.Array) declared in kotlinx.serialization.internal.ObjectSerializer' type=kotlinx.serialization.internal.ObjectSerializer<.BoxService.$rpcServiceStub.simple$rpcMethod> origin=null : serialName: CONST String type=kotlin.String value="BoxService.$rpcServiceStub.simple$rpcMethod" - objectInstance: GET_OBJECT 'CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] OBJECT name:simple$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RPCMethodClassArguments]' type=.BoxService.$rpcServiceStub.simple$rpcMethod + objectInstance: GET_OBJECT 'CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] OBJECT name:simple$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RpcMethodClass]' type=.BoxService.$rpcServiceStub.simple$rpcMethod classAnnotations: CALL 'public final fun arrayOf (vararg elements: T of kotlin.arrayOf): kotlin.Array declared in kotlin' type=kotlin.Array origin=null : kotlin.Annotation elements: VARARG type=kotlin.Array varargElementType=kotlin.Annotation @@ -153,7 +202,7 @@ FILE fqName: fileName:/module_lib_multiModule.kt CONSTRUCTOR GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] visibility:private <> () returnType:.BoxService.$rpcServiceStub.simple$rpcMethod [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] OBJECT name:simple$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RPCMethodClassArguments]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] OBJECT name:simple$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RpcMethodClass]' FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any @@ -175,15 +224,15 @@ FILE fqName: fileName:/module_lib_multiModule.kt $this: GET_VAR ': .BoxService.$rpcServiceStub.simple$rpcMethod declared in .BoxService.$rpcServiceStub.simple$rpcMethod.serializer' type=.BoxService.$rpcServiceStub.simple$rpcMethod origin=null FUN name:asArray visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.simple$rpcMethod) returnType:kotlin.Array overridden: - public abstract fun asArray (): kotlin.Array declared in kotlinx.rpc.internal.RPCMethodClassArguments + public abstract fun asArray (): kotlin.Array declared in kotlinx.rpc.internal.RpcMethodClass $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.simple$rpcMethod BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun asArray (): kotlin.Array declared in .BoxService.$rpcServiceStub.simple$rpcMethod' CALL 'public final fun emptyArray (): kotlin.Array declared in kotlin' type=kotlin.Array origin=null : kotlin.Any? - CONSTRUCTOR visibility:public <> (__rpc_stub_id:kotlin.Long, __rpc_client:kotlinx.rpc.RPCClient) returnType:.BoxService.$rpcServiceStub [primary] + CONSTRUCTOR visibility:public <> (__rpc_stub_id:kotlin.Long, __rpc_client:kotlinx.rpc.RpcClient) returnType:.BoxService.$rpcServiceStub [primary] VALUE_PARAMETER name:__rpc_stub_id index:0 type:kotlin.Long - VALUE_PARAMETER name:__rpc_client index:1 type:kotlinx.rpc.RPCClient + VALUE_PARAMETER name:__rpc_client index:1 type:kotlinx.rpc.RpcClient BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedStubKey] CLASS name:$rpcServiceStub modality:FINAL visibility:public superTypes:[.BoxService]' @@ -213,21 +262,16 @@ FILE fqName: fileName:/module_lib_multiModule.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .BoxService.$rpcServiceStub.simple' - CALL 'public abstract fun call (call: kotlinx.rpc.RPCCall): T of kotlinx.rpc.RPCClient.call declared in kotlinx.rpc.RPCClient' type=kotlin.String origin=null + CALL 'public abstract fun call (call: kotlinx.rpc.RpcCall): T of kotlinx.rpc.RpcClient.call declared in kotlinx.rpc.RpcClient' type=kotlin.String origin=null : kotlin.String - $this: CALL 'private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RPCClient origin=GET_PROPERTY + $this: CALL 'private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RpcClient origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.simple' type=.BoxService.$rpcServiceStub origin=null - call: CONSTRUCTOR_CALL 'public constructor (serviceTypeString: kotlin.String, serviceId: kotlin.Long, callableName: kotlin.String, type: kotlinx.rpc.RPCCall.Type, data: kotlin.Any, dataType: kotlin.reflect.KType, returnType: kotlin.reflect.KType) declared in kotlinx.rpc.RPCCall' type=kotlinx.rpc.RPCCall origin=null - serviceTypeString: CONST String type=kotlin.String value="BoxService" + call: CONSTRUCTOR_CALL 'public constructor (descriptor: kotlinx.rpc.descriptor.RpcServiceDescriptor<*>, callableName: kotlin.String, data: kotlin.Any, serviceId: kotlin.Long) declared in kotlinx.rpc.RpcCall' type=kotlinx.rpc.RpcCall origin=null + descriptor: GET_OBJECT 'CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>]' type=.BoxService.$rpcServiceStub.Companion + callableName: CONST String type=kotlin.String value="simple" + data: GET_OBJECT 'CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] OBJECT name:simple$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RpcMethodClass]' type=.BoxService.$rpcServiceStub.simple$rpcMethod serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.simple' type=.BoxService.$rpcServiceStub origin=null - callableName: CONST String type=kotlin.String value="simple" - type: GET_ENUM 'ENUM_ENTRY name:Method' type=kotlinx.rpc.RPCCall.Type - data: GET_OBJECT 'CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] OBJECT name:simple$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RPCMethodClassArguments]' type=.BoxService.$rpcServiceStub.simple$rpcMethod - dataType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : .BoxService.$rpcServiceStub.simple$rpcMethod - returnType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : kotlin.String FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlinx.rpc.RemoteService @@ -266,7 +310,7 @@ FILE fqName: fileName:/module_main_multiModule.kt CALL 'public abstract fun simple (): kotlin.String declared in .BoxService' type=kotlin.String origin=null $this: CALL 'public final fun withService (): T of kotlinx.rpc.withService declared in kotlinx.rpc' type=.BoxService origin=null : .BoxService - $receiver: GET_OBJECT 'CLASS OBJECT name:TestRpcClient modality:FINAL visibility:public superTypes:[kotlinx.rpc.RPCClient]' type=kotlinx.rpc.codegen.test.TestRpcClient + $receiver: GET_OBJECT 'CLASS OBJECT name:TestRpcClient modality:FINAL visibility:public superTypes:[kotlinx.rpc.RpcClient]' type=kotlinx.rpc.codegen.test.TestRpcClient RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .box' WHEN type=kotlin.String origin=IF BRANCH diff --git a/tests/compiler-plugin-tests/src/testData/box/simple.fir.ir.txt b/tests/compiler-plugin-tests/src/testData/box/simple.fir.ir.txt index 0c72b176d..85252e8df 100644 --- a/tests/compiler-plugin-tests/src/testData/box/simple.fir.ir.txt +++ b/tests/compiler-plugin-tests/src/testData/box/simple.fir.ir.txt @@ -17,23 +17,23 @@ FILE fqName: fileName:/simple.kt GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:__rpc_stub_id type:kotlin.Long visibility:private [final]' type=kotlin.Long origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.' type=.BoxService.$rpcServiceStub origin=null PROPERTY name:__rpc_client visibility:private modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RPCClient visibility:private [final] + FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RpcClient visibility:private [final] EXPRESSION_BODY - GET_VAR '__rpc_client: kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub.' type=kotlinx.rpc.RPCClient origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub) returnType:kotlinx.rpc.RPCClient + GET_VAR '__rpc_client: kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub.' type=kotlinx.rpc.RpcClient origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub) returnType:kotlinx.rpc.RpcClient correspondingProperty: PROPERTY name:__rpc_client visibility:private modality:FINAL [val] $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub BLOCK_BODY - RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RPCClient visibility:private [final]' type=kotlinx.rpc.RPCClient origin=null + RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:__rpc_client type:kotlinx.rpc.RpcClient visibility:private [final]' type=kotlinx.rpc.RpcClient origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.' type=.BoxService.$rpcServiceStub origin=null PROPERTY name:coroutineContext visibility:public modality:FINAL [val] overridden: - public abstract coroutineContext: kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RPCClient + public abstract coroutineContext: kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RpcClient FIELD PROPERTY_BACKING_FIELD name:coroutineContext type:kotlin.coroutines.CoroutineContext visibility:private [final] EXPRESSION_BODY - CALL 'public abstract fun provideStubContext (serviceId: kotlin.Long): kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RPCClient' type=kotlin.coroutines.CoroutineContext origin=null - $this: CALL 'private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RPCClient origin=GET_PROPERTY + CALL 'public abstract fun provideStubContext (serviceId: kotlin.Long): kotlin.coroutines.CoroutineContext declared in kotlinx.rpc.RpcClient' type=kotlin.coroutines.CoroutineContext origin=null + $this: CALL 'private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RpcClient origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null @@ -46,78 +46,127 @@ FILE fqName: fileName:/simple.kt RETURN type=kotlin.Nothing from='public final fun (): kotlin.coroutines.CoroutineContext declared in .BoxService.$rpcServiceStub' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:coroutineContext type:kotlin.coroutines.CoroutineContext visibility:private [final]' type=kotlin.coroutines.CoroutineContext origin=null receiver: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.' type=.BoxService.$rpcServiceStub origin=null - CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.internal.RPCStubObject<.BoxService>] + CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BoxService.$rpcServiceStub.Companion - PROPERTY name:methodNames visibility:private modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:methodNames type:kotlin.collections.Map visibility:private [final] + PROPERTY name:fqName visibility:public modality:FINAL [val] + overridden: + public abstract fqName: kotlin.String declared in kotlinx.rpc.descriptor.RpcServiceDescriptor + FIELD PROPERTY_BACKING_FIELD name:fqName type:kotlin.String visibility:private [final] + EXPRESSION_BODY + CONST String type=kotlin.String value="BoxService" + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlin.String + correspondingProperty: PROPERTY name:fqName visibility:public modality:FINAL [val] + overridden: + public abstract fun (): kotlin.String declared in kotlinx.rpc.descriptor.RpcServiceDescriptor + $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:fqName type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + PROPERTY name:simpleInvokator visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:simpleInvokator type:kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> visibility:private [final] + EXPRESSION_BODY + TYPE_OP type=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> origin=SAM_CONVERSION typeOperand=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> + FUN_EXPR type=kotlin.coroutines.SuspendFunction2<.BoxService, kotlin.Any?, kotlin.Any?> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (service:.BoxService, data:kotlin.Any?) returnType:kotlin.Any? [suspend] + VALUE_PARAMETER name:service index:0 type:.BoxService + VALUE_PARAMETER name:data index:1 type:kotlin.Any? + BLOCK_BODY + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.BoxService.$rpcServiceStub.simple$rpcMethod [val] + CALL 'public final fun dataCast (methodName: kotlin.String, serviceName: kotlin.String): T of kotlinx.rpc.internal.dataCast declared in kotlinx.rpc.internal' type=.BoxService.$rpcServiceStub.simple$rpcMethod origin=null + : .BoxService.$rpcServiceStub.simple$rpcMethod + $receiver: GET_VAR 'data: kotlin.Any? declared in .BoxService.$rpcServiceStub.Companion.simpleInvokator.' type=kotlin.Any? origin=null + methodName: CONST String type=kotlin.String value="simple" + serviceName: CONST String type=kotlin.String value="BoxService" + RETURN type=kotlin.Nothing from='local final fun (service: .BoxService, data: kotlin.Any?): kotlin.Any? declared in .BoxService.$rpcServiceStub.Companion.simpleInvokator' + CALL 'public abstract fun simple (): kotlin.String declared in .BoxService' type=kotlin.String origin=null + $this: GET_VAR 'service: .BoxService declared in .BoxService.$rpcServiceStub.Companion.simpleInvokator.' type=.BoxService origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> + correspondingProperty: PROPERTY name:simpleInvokator visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:simpleInvokator type:kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> visibility:private [final]' type=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + PROPERTY name:callableMap visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:callableMap type:kotlin.collections.Map.BoxService>> visibility:private [final] EXPRESSION_BODY - CALL 'public final fun mapOf (vararg pairs: kotlin.Pair): kotlin.collections.Map declared in kotlin.collections' type=kotlin.collections.Map origin=null + CALL 'public final fun mapOf (vararg pairs: kotlin.Pair): kotlin.collections.Map declared in kotlin.collections' type=kotlin.collections.Map.BoxService>> origin=null : kotlin.String - : kotlin.reflect.KType - pairs: VARARG type=kotlin.Array> varargElementType=kotlin.Pair - CALL 'public final fun to (that: B of kotlin.to): kotlin.Pair declared in kotlin' type=kotlin.Pair origin=null + : kotlinx.rpc.descriptor.RpcCallable<.BoxService> + pairs: VARARG type=kotlin.Array.BoxService>>> varargElementType=kotlin.Pair.BoxService>> + CALL 'public final fun to (that: B of kotlin.to): kotlin.Pair declared in kotlin' type=kotlin.Pair.BoxService>> origin=null : kotlin.String - : kotlin.reflect.KType + : kotlinx.rpc.descriptor.RpcCallable<.BoxService> $receiver: CONST String type=kotlin.String value="simple" - that: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : .BoxService.$rpcServiceStub.simple$rpcMethod - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlin.collections.Map - correspondingProperty: PROPERTY name:methodNames visibility:private modality:FINAL [val] + that: CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, dataType: kotlin.reflect.KType, returnType: kotlin.reflect.KType, invokator: kotlinx.rpc.descriptor.RpcInvokator, parameters: kotlin.Array) declared in kotlinx.rpc.descriptor.RpcCallable' type=kotlinx.rpc.descriptor.RpcCallable<.BoxService> origin=null + : .BoxService + name: CONST String type=kotlin.String value="simple" + dataType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : .BoxService.$rpcServiceStub.simple$rpcMethod + returnType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null + : kotlin.String + invokator: CALL 'private final fun (): kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> declared in .BoxService.$rpcServiceStub.Companion' type=kotlinx.rpc.descriptor.RpcInvokator.Method<.BoxService> origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion' type=.BoxService.$rpcServiceStub.Companion origin=null + parameters: CALL 'public final fun emptyArray (): kotlin.Array declared in kotlin' type=kotlin.Array origin=null + : kotlinx.rpc.descriptor.RpcParameter + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.BoxService.$rpcServiceStub.Companion) returnType:kotlin.collections.Map.BoxService>> + correspondingProperty: PROPERTY name:callableMap visibility:private modality:FINAL [val] $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion BLOCK_BODY - RETURN type=kotlin.Nothing from='private final fun (): kotlin.collections.Map declared in .BoxService.$rpcServiceStub.Companion' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:methodNames type:kotlin.collections.Map visibility:private [final]' type=kotlin.collections.Map origin=null - receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null + RETURN type=kotlin.Nothing from='private final fun (): kotlin.collections.Map.BoxService>> declared in .BoxService.$rpcServiceStub.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:callableMap type:kotlin.collections.Map.BoxService>> visibility:private [final]' type=kotlin.collections.Map.BoxService>> origin=null + receiver: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.' type=.BoxService.$rpcServiceStub.Companion origin=null CONSTRUCTOR visibility:private <> () returnType:.BoxService.$rpcServiceStub.Companion [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.internal.RPCStubObject<.BoxService>]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>]' FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlinx.rpc.internal.RPCStubObject + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:kotlin.Any VALUE_PARAMETER name:other index:0 type:kotlin.Any? FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] overridden: - public open fun hashCode (): kotlin.Int declared in kotlinx.rpc.internal.RPCStubObject + public open fun hashCode (): kotlin.Int declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:kotlin.Any FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] overridden: - public open fun toString (): kotlin.String declared in kotlinx.rpc.internal.RPCStubObject + public open fun toString (): kotlin.String declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:methodTypeOf visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, methodName:kotlin.String) returnType:kotlin.reflect.KType? + FUN name:createInstance visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, serviceId:kotlin.Long, client:kotlinx.rpc.RpcClient) returnType:.BoxService overridden: - public abstract fun methodTypeOf (methodName: kotlin.String): kotlin.reflect.KType? declared in kotlinx.rpc.internal.RPCStubObject + public abstract fun createInstance (serviceId: kotlin.Long, client: kotlinx.rpc.RpcClient): T of kotlinx.rpc.descriptor.RpcServiceDescriptor declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion - VALUE_PARAMETER name:methodName index:0 type:kotlin.String + VALUE_PARAMETER name:serviceId index:0 type:kotlin.Long + VALUE_PARAMETER name:client index:1 type:kotlinx.rpc.RpcClient BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun methodTypeOf (methodName: kotlin.String): kotlin.reflect.KType? declared in .BoxService.$rpcServiceStub.Companion' - CALL 'public abstract fun get (key: K of kotlin.collections.Map): V of kotlin.collections.Map? declared in kotlin.collections.Map' type=kotlin.reflect.KType? origin=GET_ARRAY_ELEMENT - $this: CALL 'private final fun (): kotlin.collections.Map declared in .BoxService.$rpcServiceStub.Companion' type=kotlin.collections.Map origin=GET_PROPERTY - $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.methodTypeOf' type=.BoxService.$rpcServiceStub.Companion origin=null - key: GET_VAR 'methodName: kotlin.String declared in .BoxService.$rpcServiceStub.Companion.methodTypeOf' type=kotlin.String origin=null - FUN name:rpcFields visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, service:.BoxService) returnType:kotlin.collections.List> + RETURN type=kotlin.Nothing from='public open fun createInstance (serviceId: kotlin.Long, client: kotlinx.rpc.RpcClient): .BoxService declared in .BoxService.$rpcServiceStub.Companion' + CONSTRUCTOR_CALL 'public constructor (__rpc_stub_id: kotlin.Long, __rpc_client: kotlinx.rpc.RpcClient) declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null + __rpc_stub_id: GET_VAR 'serviceId: kotlin.Long declared in .BoxService.$rpcServiceStub.Companion.createInstance' type=kotlin.Long origin=null + __rpc_client: GET_VAR 'client: kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub.Companion.createInstance' type=kotlinx.rpc.RpcClient origin=null + FUN name:getCallable visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, name:kotlin.String) returnType:kotlinx.rpc.descriptor.RpcCallable? overridden: - public abstract fun rpcFields (service: T of kotlinx.rpc.internal.RPCStubObject): kotlin.collections.List> declared in kotlinx.rpc.internal.RPCStubObject + public abstract fun getCallable (name: kotlin.String): kotlinx.rpc.descriptor.RpcCallable? declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion - VALUE_PARAMETER name:service index:0 type:.BoxService + VALUE_PARAMETER name:name index:0 type:kotlin.String BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun rpcFields (service: .BoxService): kotlin.collections.List> declared in .BoxService.$rpcServiceStub.Companion' - TYPE_OP type=kotlin.collections.List> origin=CAST typeOperand=kotlin.collections.List> - CALL 'public final fun emptyList (): kotlin.collections.List declared in kotlin.collections' type=kotlin.collections.List origin=null - : kotlin.Any? - FUN name:withClient visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, serviceId:kotlin.Long, client:kotlinx.rpc.RPCClient) returnType:.BoxService + RETURN type=kotlin.Nothing from='public open fun getCallable (name: kotlin.String): kotlinx.rpc.descriptor.RpcCallable? declared in .BoxService.$rpcServiceStub.Companion' + CALL 'public abstract fun get (key: K of kotlin.collections.Map): V of kotlin.collections.Map? declared in kotlin.collections.Map' type=kotlinx.rpc.descriptor.RpcCallable? origin=GET_ARRAY_ELEMENT + $this: CALL 'private final fun (): kotlin.collections.Map.BoxService>> declared in .BoxService.$rpcServiceStub.Companion' type=kotlin.collections.Map.BoxService>> origin=GET_PROPERTY + $this: GET_VAR ': .BoxService.$rpcServiceStub.Companion declared in .BoxService.$rpcServiceStub.Companion.getCallable' type=.BoxService.$rpcServiceStub.Companion origin=null + key: GET_VAR 'name: kotlin.String declared in .BoxService.$rpcServiceStub.Companion.getCallable' type=kotlin.String origin=null + FUN name:getFields visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.Companion, service:.BoxService) returnType:kotlin.collections.List> overridden: - public abstract fun withClient (serviceId: kotlin.Long, client: kotlinx.rpc.RPCClient): T of kotlinx.rpc.internal.RPCStubObject declared in kotlinx.rpc.internal.RPCStubObject + public abstract fun getFields (service: T of kotlinx.rpc.descriptor.RpcServiceDescriptor): kotlin.collections.List> declared in kotlinx.rpc.descriptor.RpcServiceDescriptor $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.Companion - VALUE_PARAMETER name:serviceId index:0 type:kotlin.Long - VALUE_PARAMETER name:client index:1 type:kotlinx.rpc.RPCClient + VALUE_PARAMETER name:service index:0 type:.BoxService BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun withClient (serviceId: kotlin.Long, client: kotlinx.rpc.RPCClient): .BoxService declared in .BoxService.$rpcServiceStub.Companion' - CONSTRUCTOR_CALL 'public constructor (__rpc_stub_id: kotlin.Long, __rpc_client: kotlinx.rpc.RPCClient) declared in .BoxService.$rpcServiceStub' type=.BoxService.$rpcServiceStub origin=null - __rpc_stub_id: GET_VAR 'serviceId: kotlin.Long declared in .BoxService.$rpcServiceStub.Companion.withClient' type=kotlin.Long origin=null - __rpc_client: GET_VAR 'client: kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub.Companion.withClient' type=kotlinx.rpc.RPCClient origin=null - CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] OBJECT name:simple$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RPCMethodClassArguments] + RETURN type=kotlin.Nothing from='public open fun getFields (service: .BoxService): kotlin.collections.List> declared in .BoxService.$rpcServiceStub.Companion' + TYPE_OP type=kotlin.collections.List> origin=CAST typeOperand=kotlin.collections.List> + CALL 'public final fun emptyList (): kotlin.collections.List declared in kotlin.collections' type=kotlin.collections.List origin=null + : kotlin.Any? + CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] OBJECT name:simple$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RpcMethodClass] annotations: Serializable(with = ) $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BoxService.$rpcServiceStub.simple$rpcMethod @@ -135,7 +184,7 @@ FILE fqName: fileName:/simple.kt CONSTRUCTOR_CALL 'internal constructor (serialName: kotlin.String, objectInstance: T of kotlinx.serialization.internal.ObjectSerializer, classAnnotations: kotlin.Array) declared in kotlinx.serialization.internal.ObjectSerializer' type=kotlinx.serialization.internal.ObjectSerializer<.BoxService.$rpcServiceStub.simple$rpcMethod> origin=null : serialName: CONST String type=kotlin.String value="BoxService.$rpcServiceStub.simple$rpcMethod" - objectInstance: GET_OBJECT 'CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] OBJECT name:simple$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RPCMethodClassArguments]' type=.BoxService.$rpcServiceStub.simple$rpcMethod + objectInstance: GET_OBJECT 'CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] OBJECT name:simple$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RpcMethodClass]' type=.BoxService.$rpcServiceStub.simple$rpcMethod classAnnotations: CALL 'public final fun arrayOf (vararg elements: T of kotlin.arrayOf): kotlin.Array declared in kotlin' type=kotlin.Array origin=null : kotlin.Annotation elements: VARARG type=kotlin.Array varargElementType=kotlin.Annotation @@ -152,7 +201,7 @@ FILE fqName: fileName:/simple.kt CONSTRUCTOR GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] visibility:private <> () returnType:.BoxService.$rpcServiceStub.simple$rpcMethod [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] OBJECT name:simple$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RPCMethodClassArguments]' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] OBJECT name:simple$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RpcMethodClass]' FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any @@ -174,15 +223,15 @@ FILE fqName: fileName:/simple.kt $this: GET_VAR ': .BoxService.$rpcServiceStub.simple$rpcMethod declared in .BoxService.$rpcServiceStub.simple$rpcMethod.serializer' type=.BoxService.$rpcServiceStub.simple$rpcMethod origin=null FUN name:asArray visibility:public modality:OPEN <> ($this:.BoxService.$rpcServiceStub.simple$rpcMethod) returnType:kotlin.Array overridden: - public abstract fun asArray (): kotlin.Array declared in kotlinx.rpc.internal.RPCMethodClassArguments + public abstract fun asArray (): kotlin.Array declared in kotlinx.rpc.internal.RpcMethodClass $this: VALUE_PARAMETER name: type:.BoxService.$rpcServiceStub.simple$rpcMethod BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun asArray (): kotlin.Array declared in .BoxService.$rpcServiceStub.simple$rpcMethod' CALL 'public final fun emptyArray (): kotlin.Array declared in kotlin' type=kotlin.Array origin=null : kotlin.Any? - CONSTRUCTOR visibility:public <> (__rpc_stub_id:kotlin.Long, __rpc_client:kotlinx.rpc.RPCClient) returnType:.BoxService.$rpcServiceStub [primary] + CONSTRUCTOR visibility:public <> (__rpc_stub_id:kotlin.Long, __rpc_client:kotlinx.rpc.RpcClient) returnType:.BoxService.$rpcServiceStub [primary] VALUE_PARAMETER name:__rpc_stub_id index:0 type:kotlin.Long - VALUE_PARAMETER name:__rpc_client index:1 type:kotlinx.rpc.RPCClient + VALUE_PARAMETER name:__rpc_client index:1 type:kotlinx.rpc.RpcClient BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedStubKey] CLASS name:$rpcServiceStub modality:FINAL visibility:public superTypes:[.BoxService]' @@ -212,21 +261,16 @@ FILE fqName: fileName:/simple.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .BoxService.$rpcServiceStub.simple' - CALL 'public abstract fun call (call: kotlinx.rpc.RPCCall): T of kotlinx.rpc.RPCClient.call declared in kotlinx.rpc.RPCClient' type=kotlin.String origin=null + CALL 'public abstract fun call (call: kotlinx.rpc.RpcCall): T of kotlinx.rpc.RpcClient.call declared in kotlinx.rpc.RpcClient' type=kotlin.String origin=null : kotlin.String - $this: CALL 'private final fun (): kotlinx.rpc.RPCClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RPCClient origin=GET_PROPERTY + $this: CALL 'private final fun (): kotlinx.rpc.RpcClient declared in .BoxService.$rpcServiceStub' type=kotlinx.rpc.RpcClient origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.simple' type=.BoxService.$rpcServiceStub origin=null - call: CONSTRUCTOR_CALL 'public constructor (serviceTypeString: kotlin.String, serviceId: kotlin.Long, callableName: kotlin.String, type: kotlinx.rpc.RPCCall.Type, data: kotlin.Any, dataType: kotlin.reflect.KType, returnType: kotlin.reflect.KType) declared in kotlinx.rpc.RPCCall' type=kotlinx.rpc.RPCCall origin=null - serviceTypeString: CONST String type=kotlin.String value="BoxService" + call: CONSTRUCTOR_CALL 'public constructor (descriptor: kotlinx.rpc.descriptor.RpcServiceDescriptor<*>, callableName: kotlin.String, data: kotlin.Any, serviceId: kotlin.Long) declared in kotlinx.rpc.RpcCall' type=kotlinx.rpc.RpcCall origin=null + descriptor: GET_OBJECT 'CLASS GENERATED[kotlinx.rpc.codegen.FirRpcServiceStubCompanionObject] OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlinx.rpc.descriptor.RpcServiceDescriptor<.BoxService>]' type=.BoxService.$rpcServiceStub.Companion + callableName: CONST String type=kotlin.String value="simple" + data: GET_OBJECT 'CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] OBJECT name:simple$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RpcMethodClass]' type=.BoxService.$rpcServiceStub.simple$rpcMethod serviceId: CALL 'private final fun (): kotlin.Long declared in .BoxService.$rpcServiceStub' type=kotlin.Long origin=GET_PROPERTY $this: GET_VAR ': .BoxService.$rpcServiceStub declared in .BoxService.$rpcServiceStub.simple' type=.BoxService.$rpcServiceStub origin=null - callableName: CONST String type=kotlin.String value="simple" - type: GET_ENUM 'ENUM_ENTRY name:Method' type=kotlinx.rpc.RPCCall.Type - data: GET_OBJECT 'CLASS GENERATED[kotlinx.rpc.codegen.RPCGeneratedRpcMethodClassKey] OBJECT name:simple$rpcMethod modality:FINAL visibility:public superTypes:[kotlin.Any; kotlinx.rpc.internal.RPCMethodClassArguments]' type=.BoxService.$rpcServiceStub.simple$rpcMethod - dataType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : .BoxService.$rpcServiceStub.simple$rpcMethod - returnType: CALL 'public final fun typeOf (): kotlin.reflect.KType declared in kotlin.reflect' type=kotlin.reflect.KType origin=null - : kotlin.String FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlinx.rpc.RemoteService @@ -263,7 +307,7 @@ FILE fqName: fileName:/simple.kt CALL 'public abstract fun simple (): kotlin.String declared in .BoxService' type=kotlin.String origin=null $this: CALL 'public final fun withService (): T of kotlinx.rpc.withService declared in kotlinx.rpc' type=.BoxService origin=null : .BoxService - $receiver: GET_OBJECT 'CLASS OBJECT name:TestRpcClient modality:FINAL visibility:public superTypes:[kotlinx.rpc.RPCClient]' type=kotlinx.rpc.codegen.test.TestRpcClient + $receiver: GET_OBJECT 'CLASS OBJECT name:TestRpcClient modality:FINAL visibility:public superTypes:[kotlinx.rpc.RpcClient]' type=kotlinx.rpc.codegen.test.TestRpcClient RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .box' WHEN type=kotlin.String origin=IF BRANCH