Skip to content

Commit 800aa35

Browse files
committed
Added deprecated typealiases for old named
1 parent e3489ba commit 800aa35

File tree

12 files changed

+65
-3
lines changed

12 files changed

+65
-3
lines changed

core/src/commonMain/kotlin/kotlinx/rpc/RpcEagerField.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ package kotlinx.rpc
99
*/
1010
@Target(AnnotationTarget.PROPERTY)
1111
public annotation class RpcEagerField
12+
13+
@Deprecated("Use RpcEagerField instead", ReplaceWith("RpcEagerField"), level = DeprecationLevel.ERROR)
14+
public typealias RPCEagerField = RpcEagerField

core/src/commonMain/kotlin/kotlinx/rpc/RpcServer.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import kotlinx.coroutines.CoroutineScope
88
import kotlin.coroutines.CoroutineContext
99
import kotlin.reflect.KClass
1010

11+
@Deprecated("Use RpcServer instead", ReplaceWith("RpcServer"), level = DeprecationLevel.ERROR)
12+
public typealias RPCServer = RpcServer
13+
1114
/**
1215
* RpcServer is used to accept RPC messages, route them to a specific service, and process given responses.
1316
* Server may contain multiple services.

core/src/commonMain/kotlin/kotlinx/rpc/UninitializedRpcFieldException.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,18 @@ package kotlinx.rpc
66

77
import kotlin.reflect.KProperty
88

9+
@Deprecated(
10+
"Use UninitializedRpcFieldException instead",
11+
ReplaceWith("UninitializedRpcFieldException"),
12+
level = DeprecationLevel.ERROR,
13+
)
14+
public typealias UninitializedRPCFieldException = UninitializedRpcFieldException
15+
916
/**
1017
* Thrown when an uninitialized field of an RPC service is accessed.
1118
*
1219
* Use [awaitFieldInitialization] to await for the field initialization
1320
*/
14-
public class UninitializedRpcFieldException(serviceName: String, property: KProperty<*>): Exception() {
21+
public class UninitializedRpcFieldException(serviceName: String, property: KProperty<*>) : Exception() {
1522
override val message: String = "${property.name} field of RPC service \"$serviceName\" in not initialized"
1623
}

krpc/krpc-client/src/commonMain/kotlin/kotlinx/rpc/krpc/client/KrpcClient.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import kotlinx.serialization.StringFormat
2424
import kotlin.coroutines.CoroutineContext
2525
import kotlin.coroutines.cancellation.CancellationException
2626

27+
@Deprecated("Use KrpcClient instead", ReplaceWith("KrpcClient"), level = DeprecationLevel.ERROR)
28+
public typealias KRPCClient = KrpcClient
29+
2730
/**
2831
* Default implementation of [RpcClient].
2932
* Takes care of tracking requests and responses,

krpc/krpc-core/src/commonMain/kotlin/kotlinx/rpc/krpc/KrpcConfig.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import kotlinx.rpc.krpc.serialization.KrpcSerialFormat
1212
import kotlinx.rpc.krpc.serialization.KrpcSerialFormatBuilder
1313
import kotlinx.rpc.krpc.serialization.KrpcSerialFormatConfiguration
1414

15+
@Deprecated("Use KrpcConfigBuilder instead", ReplaceWith("KrpcConfigBuilder"), level = DeprecationLevel.ERROR)
16+
public typealias RPCConfigBuilder = KrpcConfigBuilder
17+
1518
/**
1619
* Builder for [KrpcConfig]. Provides DSL to configure parameters for KrpcClient and/or KrpcServer.
1720
*/
@@ -148,6 +151,9 @@ public sealed class KrpcConfigBuilder private constructor() {
148151
}
149152
}
150153

154+
@Deprecated("Use KrpcConfig instead", ReplaceWith("KrpcConfig"), level = DeprecationLevel.ERROR)
155+
public typealias RPCConfig = KrpcConfig
156+
151157
/**
152158
* Configuration class that is used by kRPC protocol's client and server (KrpcClient and KrpcServer).
153159
*/

krpc/krpc-core/src/commonMain/kotlin/kotlinx/rpc/krpc/KrpcTransport.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ package kotlinx.rpc.krpc
66

77
import kotlinx.coroutines.CoroutineScope
88

9+
@Deprecated("Use KrpcTransportMessage instead", ReplaceWith("KrpcTransportMessage"), level = DeprecationLevel.ERROR)
10+
public typealias RPCTransportMessage = KrpcTransportMessage
11+
912
/**
1013
* A single message that can be transferred from one RPC endpoint to another.
1114
* Can be either of string or binary type.
@@ -16,6 +19,9 @@ public sealed interface KrpcTransportMessage {
1619
public class BinaryMessage(public val value: ByteArray) : KrpcTransportMessage
1720
}
1821

22+
@Deprecated("Use KrpcTransport instead", ReplaceWith("KrpcTransport"), level = DeprecationLevel.ERROR)
23+
public typealias RPCTransport = KrpcTransport
24+
1925
/**
2026
* An abstraction of transport capabilities for KrpcClient and KrpcServer.
2127
*

krpc/krpc-ktor/krpc-ktor-client/src/commonMain/kotlin/kotlinx/rpc/krpc/ktor/client/Krpc.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@ import kotlinx.rpc.krpc.KrpcConfigBuilder
1212

1313
internal val KrpcClientPluginAttributesKey = AttributeKey<KrpcConfigBuilder.Client>("KrpcClientPluginAttributesKey")
1414

15+
@Deprecated("Use Krpc instead", ReplaceWith("Krpc"), level = DeprecationLevel.ERROR)
16+
public val RPC: ClientPlugin<KrpcConfigBuilder.Client> get() = Krpc
17+
1518
/**
1619
* Ktor client plugin that allows to configure RPC globally for all instances obtained via [rpc] functions.
1720
*/
1821
public val Krpc: ClientPlugin<KrpcConfigBuilder.Client> = createClientPlugin("Krpc", { KrpcConfigBuilder.Client() }) {
1922
client.attributes.put(KrpcClientPluginAttributesKey, pluginConfig)
2023
}
2124

25+
@Deprecated("Use installKrpc instead", ReplaceWith("installKrpc"), level = DeprecationLevel.ERROR)
26+
public fun HttpClientConfig<*>.installRPC(
27+
configure: KrpcConfigBuilder.Client.() -> Unit = {}
28+
) = installKrpc(configure)
29+
2230
/**
2331
* Installs [WebSockets] and [Krpc] client plugins
2432
*/

krpc/krpc-ktor/krpc-ktor-server/src/jvmMain/kotlin/kotlinx/rpc/krpc/ktor/server/Krpc.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import kotlinx.rpc.krpc.KrpcConfigBuilder
1111

1212
internal val KrpcServerPluginAttributesKey = AttributeKey<KrpcConfigBuilder.Server>("KrpcServerPluginAttributesKey")
1313

14+
@Deprecated("Use Krpc instead", ReplaceWith("Krpc"), level = DeprecationLevel.ERROR)
15+
public val RPC: ApplicationPlugin<KrpcConfigBuilder.Server> get() = Krpc
16+
1417
/**
1518
* Ktor server plugin that allows to configure RPC globally for all mounted servers.
1619
*/

krpc/krpc-ktor/krpc-ktor-server/src/jvmMain/kotlin/kotlinx/rpc/krpc/ktor/server/KrpcRoute.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import kotlinx.rpc.krpc.KrpcConfigBuilder
1111
import kotlin.coroutines.CoroutineContext
1212
import kotlin.reflect.KClass
1313

14+
@Deprecated("Use KrpcRoute instead", ReplaceWith("KrpcRoute"), level = DeprecationLevel.ERROR)
15+
public typealias RPCRoute = KrpcRoute
16+
1417
/**
1518
* RpcRoute class represents an RPC server that is mounted in Ktor routing.
1619
* This class provides API to register services and optionally setup configuration.

krpc/krpc-serialization/krpc-serialization-core/src/commonMain/kotlin/kotlinx/rpc/krpc/serialization/KrpcSerialFormat.kt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import kotlinx.serialization.SerialFormat
1010
import kotlinx.serialization.StringFormat
1111
import kotlinx.serialization.modules.SerializersModule
1212

13+
@Deprecated("Use KrpcSerialFormat instead", ReplaceWith("KrpcSerialFormat"), level = DeprecationLevel.ERROR)
14+
public typealias RPCSerialFormat<Format, FormatBuilder> = KrpcSerialFormat<Format, FormatBuilder>
15+
1316
/**
1417
* [KrpcSerialFormat] interface defines an object which helps kRPC protocol to work with various serialization formats
1518
*
@@ -32,6 +35,13 @@ public interface KrpcSerialFormat<Format : SerialFormat, FormatBuilder : Any> {
3235
public fun FormatBuilder.applySerializersModule(serializersModule: SerializersModule)
3336
}
3437

38+
@Deprecated(
39+
"Use KrpcSerialFormatBuilder instead",
40+
ReplaceWith("KrpcSerialFormatBuilder"),
41+
level = DeprecationLevel.ERROR,
42+
)
43+
public typealias RPCSerialFormatBuilder<Format, FormatBuilder> = KrpcSerialFormatBuilder<Format, FormatBuilder>
44+
3545
/**
3646
* Special wrapper class that is used to register serialization format in [KrpcSerialFormatConfiguration]
3747
* Comes in two instances: [KrpcSerialFormatBuilder.Binary] and [KrpcSerialFormatBuilder.String]
@@ -71,7 +81,7 @@ public sealed class KrpcSerialFormatBuilder<Format : SerialFormat, FormatBuilder
7181
rpcSerialFormat: KrpcSerialFormat<Format, FormatBuilder>,
7282
from: Format? = null,
7383
builder: FormatBuilder.() -> Unit,
74-
): KrpcSerialFormatBuilder<Format, FormatBuilder>(rpcSerialFormat, from, builder)
84+
) : KrpcSerialFormatBuilder<Format, FormatBuilder>(rpcSerialFormat, from, builder)
7585

7686
/**
7787
* @see KrpcSerialFormatBuilder
@@ -80,5 +90,5 @@ public sealed class KrpcSerialFormatBuilder<Format : SerialFormat, FormatBuilder
8090
rpcSerialFormat: KrpcSerialFormat<Format, FormatBuilder>,
8191
from: Format? = null,
8292
builder: FormatBuilder.() -> Unit,
83-
): KrpcSerialFormatBuilder<Format, FormatBuilder>(rpcSerialFormat, from, builder)
93+
) : KrpcSerialFormatBuilder<Format, FormatBuilder>(rpcSerialFormat, from, builder)
8494
}

0 commit comments

Comments
 (0)