Migration to 0.5.0
Edit pageLast modified: 28 January 2025Version 0.5.0
introduces breaking changes.
Annotation type-safety
This release introduces annotation type-safety. As a result, some code that previously compiled successfully may now produce errors:
@Rpc
interface MyService : RemoteService
class MyServiceImpl : MyService
fun <@Rpc T : Any> withService() {}
withService<MyService>() // ok
withService<MyServiceImpl>() // ok in 0.4.0, error in 0.5.0
This should not cause any major issues, as the affected code was already incorrect in previous releases and would have failed at runtime in 0.4.0
.
Strict Mode and Service API deprecations
This release introduces Strict Mode. Some service declarations are now deprecated with a warning. In upcoming releases, these warnings will be replaced with errors.
Deprecated service APIs:
StateFlow
andSharedFlow
usageFields in services
Nested Flows
Not top-level server side flows
For more information, see the Strict Mode documentation.
API Renaming
The following APIs were renamed to satisfy Kotlin style guides and bring even more consistency to the library:
Old | New |
---|---|
kotlinx.rpc.RPCClient | kotlinx.rpc.RpcClient |
kotlinx.rpc.RPCServer | kotlinx.rpc.RpcServer |
kotlinx.rpc.UninitializedRPCFieldException | kotlinx.rpc.UninitializedRpcFieldException |
kotlinx.rpc.RPCEagerField | kotlinx.rpc.RpcEagerField |
kotlinx.rpc.RPCEagerField | kotlinx.rpc.RpcEagerField |
kotlinx.rpc.internal.utils.InternalRPCApi | kotlinx.rpc.internal.utils.InternalRpcApi |
kotlinx.rpc.internal.utils.ExperimentalRPCApi | kotlinx.rpc.internal.utils.ExperimentalRpcApi |
kotlinx.rpc.krpc.RPCConfig | kotlinx.rpc.krpc.KrpcConfig |
kotlinx.rpc.krpc.RPCConfigBuilder | kotlinx.rpc.krpc.KrpcConfigBuilder |
kotlinx.rpc.krpc.RPCTransport | kotlinx.rpc.krpc.KrpcTransport |
kotlinx.rpc.krpc.RPCTransportMessage | kotlinx.rpc.krpc.KrpcTransportMessage |
kotlinx.rpc.krpc.client.KRPCClient | kotlinx.rpc.krpc.client.KrpcClient |
kotlinx.rpc.krpc.server.KRPCServer | kotlinx.rpc.krpc.server.KrpcServer |
kotlinx.rpc.krpc.ktor.client.installRPC | kotlinx.rpc.krpc.ktor.client.installKrpc |
kotlinx.rpc.krpc.ktor.client.RPC | kotlinx.rpc.krpc.ktor.client.Krpc |
kotlinx.rpc.krpc.ktor.client.KtorRPCClient | kotlinx.rpc.krpc.ktor.client.KtorRpcClient |
kotlinx.rpc.krpc.ktor.server.RPC | kotlinx.rpc.krpc.ktor.server.Krpc |
kotlinx.rpc.krpc.ktor.server.RPCRoute | kotlinx.rpc.krpc.ktor.server.KrpcRoute |
kotlinx.rpc.krpc.serialization.RPCSerialFormat | kotlinx.rpc.krpc.serialization.KrpcSerialFormat |
kotlinx.rpc.krpc.serialization.RPCSerialFormatBuilder | kotlinx.rpc.krpc.serialization.KrpcSerialFormatBuilder |
kotlinx.rpc.krpc.serialization.RPCSerialFormatConfiguration | kotlinx.rpc.krpc.serialization.KrpcSerialFormatConfiguration |
kotlinx.rpc.krpc.serialization.cbor.RPCCborSerialFormat | kotlinx.rpc.krpc.serialization.cbor.KrpcCborSerialFormat |
kotlinx.rpc.krpc.serialization.json.RPCJsonSerialFormat | kotlinx.rpc.krpc.serialization.json.KrpcJsonSerialFormat |
kotlinx.rpc.krpc.serialization.protobuf.RPCProtobufSerialFormat | kotlinx.rpc.krpc.serialization.protobuf.KrpcProtobufSerialFormat |
Service Descriptors
New API is introduced to access compiler generated code - Service Descriptors.