Skip to content

Commit 7a2c065

Browse files
committed
Added deprecation notes
1 parent f634c1e commit 7a2c065

File tree

6 files changed

+70
-7
lines changed

6 files changed

+70
-7
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package kotlinx.rpc
@@ -8,6 +8,10 @@ package kotlinx.rpc
88
* The field marked with this annotation will be initialized with the service creation.
99
*/
1010
@Target(AnnotationTarget.PROPERTY)
11+
@Deprecated(
12+
"Fields are deprecated, see https://kotlin.github.io/kotlinx-rpc/0-5-0.html",
13+
level = DeprecationLevel.WARNING,
14+
)
1115
public annotation class RpcEagerField
1216

1317
@Deprecated("Use RpcEagerField instead", ReplaceWith("RpcEagerField"), level = DeprecationLevel.ERROR)

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package kotlinx.rpc
@@ -18,6 +18,10 @@ public typealias UninitializedRPCFieldException = UninitializedRpcFieldException
1818
*
1919
* Use [awaitFieldInitialization] to await for the field initialization
2020
*/
21+
@Deprecated(
22+
"Fields are deprecated, see https://kotlin.github.io/kotlinx-rpc/0-5-0.html",
23+
level = DeprecationLevel.WARNING,
24+
)
2125
public class UninitializedRpcFieldException(serviceName: String, property: KProperty<*>) : Exception() {
2226
override val message: String = "${property.name} field of RPC service \"$serviceName\" in not initialized"
2327
}

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package kotlinx.rpc
@@ -27,6 +27,10 @@ import kotlin.reflect.KClass
2727
* @param getter function that returns the field of the context service to wait for.
2828
* @return service filed after it was initialized.
2929
*/
30+
@Deprecated(
31+
"Fields are deprecated, see https://kotlin.github.io/kotlinx-rpc/0-5-0.html",
32+
level = DeprecationLevel.WARNING,
33+
)
3034
public suspend fun <@Rpc T : Any, R> T.awaitFieldInitialization(getter: T.() -> R): R {
3135
val field = getter()
3236

@@ -56,6 +60,10 @@ public suspend fun <@Rpc T : Any, R> T.awaitFieldInitialization(getter: T.() ->
5660
* @param T service type
5761
* @return specified service, after all of it's field were initialized.
5862
*/
63+
@Deprecated(
64+
"Fields are deprecated, see https://kotlin.github.io/kotlinx-rpc/0-5-0.html",
65+
level = DeprecationLevel.WARNING,
66+
)
5967
public suspend inline fun <@Rpc reified T : Any> T.awaitFieldInitialization(): T {
6068
return awaitFieldInitialization(T::class)
6169
}
@@ -79,6 +87,10 @@ public suspend inline fun <@Rpc reified T : Any> T.awaitFieldInitialization(): T
7987
* @param kClass [KClass] of the [T] type.
8088
* @return specified service, after all of it's field were initialized.
8189
*/
90+
@Deprecated(
91+
"Fields are deprecated, see https://kotlin.github.io/kotlinx-rpc/0-5-0.html",
92+
level = DeprecationLevel.WARNING,
93+
)
8294
public suspend fun <@Rpc T : Any> T.awaitFieldInitialization(kClass: KClass<T>): T {
8395
serviceDescriptorOf(kClass)
8496
.getFields(this)

core/src/commonMain/kotlin/kotlinx/rpc/descriptor/RpcServiceDescriptor.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package kotlinx.rpc.descriptor
@@ -44,6 +44,10 @@ public interface RpcServiceDescriptor<@Rpc T : Any> {
4444
public val fqName: String
4545

4646
@InternalRpcApi
47+
@Deprecated(
48+
"Fields are deprecated, see https://kotlin.github.io/kotlinx-rpc/0-5-0.html",
49+
level = DeprecationLevel.WARNING,
50+
)
4751
public fun getFields(service: T): List<RpcDeferredField<*>>
4852

4953
public fun getCallable(name: String): RpcCallable<T>?
@@ -68,6 +72,10 @@ public sealed interface RpcInvokator<@Rpc T : Any> {
6872
}
6973

7074
@ExperimentalRpcApi
75+
@Deprecated(
76+
"Fields are deprecated, see https://kotlin.github.io/kotlinx-rpc/0-5-0.html",
77+
level = DeprecationLevel.WARNING,
78+
)
7179
public fun interface Field<@Rpc T : Any> : RpcInvokator<T> {
7280
public fun call(service: T): Any?
7381
}

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package kotlinx.rpc
@@ -25,6 +25,10 @@ import kotlinx.rpc.internal.RpcFlow
2525
* @param serviceId id of the service, that made the call
2626
* @return Flow instance to be consumed.
2727
*/
28+
@Deprecated(
29+
"Fields are deprecated, see https://kotlin.github.io/kotlinx-rpc/0-5-0.html",
30+
level = DeprecationLevel.WARNING,
31+
)
2832
public fun <T> RpcClient.registerPlainFlowField(
2933
serviceScope: CoroutineScope,
3034
descriptor: RpcServiceDescriptor<*>,
@@ -46,6 +50,10 @@ public fun <T> RpcClient.registerPlainFlowField(
4650
* @param serviceId id of the service, that made the call
4751
* @return SharedFlow instance to be consumed.
4852
*/
53+
@Deprecated(
54+
"Fields are deprecated, see https://kotlin.github.io/kotlinx-rpc/0-5-0.html",
55+
level = DeprecationLevel.WARNING,
56+
)
4957
public fun <T> RpcClient.registerSharedFlowField(
5058
serviceScope: CoroutineScope,
5159
descriptor: RpcServiceDescriptor<*>,
@@ -67,6 +75,10 @@ public fun <T> RpcClient.registerSharedFlowField(
6775
* @param serviceId id of the service, that made the call
6876
* @return StateFlow instance to be consumed.
6977
*/
78+
@Deprecated(
79+
"Fields are deprecated, see https://kotlin.github.io/kotlinx-rpc/0-5-0.html",
80+
level = DeprecationLevel.WARNING,
81+
)
7082
public fun <T> RpcClient.registerStateFlowField(
7183
serviceScope: CoroutineScope,
7284
descriptor: RpcServiceDescriptor<*>,

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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package kotlinx.rpc.krpc
@@ -27,18 +27,30 @@ public sealed class KrpcConfigBuilder private constructor() {
2727
* parameters, and thus they cannot be encoded and transferred.
2828
* So then creating their instance on an endpoint, the library should know which parameters to use.
2929
*/
30+
@Deprecated(
31+
"SharedFlow support is deprecated, see https://kotlin.github.io/kotlinx-rpc/0-5-0.html",
32+
level = DeprecationLevel.WARNING,
33+
)
3034
@Suppress("MemberVisibilityCanBePrivate")
3135
public class SharedFlowParametersBuilder internal constructor() {
3236
/**
3337
* The number of values replayed to new subscribers (cannot be negative, defaults to zero).
3438
*/
39+
@Deprecated(
40+
"SharedFlow support is deprecated, see https://kotlin.github.io/kotlinx-rpc/0-5-0.html",
41+
level = DeprecationLevel.WARNING,
42+
)
3543
public var replay: Int = DEFAULT_REPLAY
3644

3745
/**
3846
* The number of values buffered in addition to replay.
3947
* emit does not suspend while there is a buffer space remaining
4048
* (optional, cannot be negative, defaults to zero).
4149
*/
50+
@Deprecated(
51+
"SharedFlow support is deprecated, see https://kotlin.github.io/kotlinx-rpc/0-5-0.html",
52+
level = DeprecationLevel.WARNING,
53+
)
4254
public var extraBufferCapacity: Int = DEFAULT_EXTRA_BUFFER_CAPACITY
4355

4456
/**
@@ -50,10 +62,15 @@ public sealed class KrpcConfigBuilder private constructor() {
5062
* In the absence of subscribers only the most recent replay values are stored
5163
* and the buffer overflow behavior is never triggered and has no effect.
5264
*/
65+
@Deprecated(
66+
"SharedFlow support is deprecated, see https://kotlin.github.io/kotlinx-rpc/0-5-0.html",
67+
level = DeprecationLevel.WARNING,
68+
)
5369
public var onBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND
5470

5571
@InternalRpcApi
5672
public fun builder(): () -> MutableSharedFlow<Any?> = {
73+
@Suppress("DEPRECATION")
5774
MutableSharedFlow(replay, extraBufferCapacity, onBufferOverflow)
5875
}
5976

@@ -69,12 +86,18 @@ public sealed class KrpcConfigBuilder private constructor() {
6986
}
7087
}
7188

89+
@Suppress("DEPRECATION")
7290
protected var sharedFlowBuilder: () -> MutableSharedFlow<Any?> = SharedFlowParametersBuilder().builder()
7391

7492
/**
7593
* @see SharedFlowParametersBuilder
7694
*/
77-
public fun sharedFlowParameters(builder: SharedFlowParametersBuilder.() -> Unit) {
95+
@Deprecated(
96+
"SharedFlow support is deprecated, see https://kotlin.github.io/kotlinx-rpc/0-5-0.html",
97+
level = DeprecationLevel.WARNING,
98+
)
99+
public fun sharedFlowParameters(builder: @Suppress("DEPRECATION") SharedFlowParametersBuilder.() -> Unit) {
100+
@Suppress("DEPRECATION")
78101
sharedFlowBuilder = SharedFlowParametersBuilder().apply(builder).builder()
79102
}
80103

0 commit comments

Comments
 (0)