Skip to content

Commit 17d8c5c

Browse files
committed
Cleanup of deprecated code and features
1 parent f0f1244 commit 17d8c5c

File tree

60 files changed

+63
-1263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+63
-1263
lines changed

compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/RpcIrContext.kt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,10 @@ internal class RpcIrContext(
3232
irBuiltIns.arrayClass.typeWith(anyNullable, Variance.OUT_VARIANCE)
3333
}
3434

35-
val coroutineScope by lazy {
36-
getIrClassSymbol("kotlinx.coroutines", "CoroutineScope")
37-
}
38-
3935
val kTypeClass by lazy {
4036
getIrClassSymbol("kotlin.reflect", "KType")
4137
}
4238

43-
val suspendFunction0 by lazy {
44-
getIrClassSymbol("kotlin.coroutines", "SuspendFunction0")
45-
}
46-
4739
val suspendFunction2 by lazy {
4840
getIrClassSymbol("kotlin.coroutines", "SuspendFunction2")
4941
}
@@ -92,10 +84,6 @@ internal class RpcIrContext(
9284
getRpcIrClassSymbol("RpcParameter", "descriptor")
9385
}
9486

95-
val rpcDeferredField by lazy {
96-
getRpcIrClassSymbol("RpcDeferredField", "internal")
97-
}
98-
9987
val rpcMethodClass by lazy {
10088
getRpcIrClassSymbol("RpcMethodClass", "internal")
10189
}
@@ -139,10 +127,6 @@ internal class RpcIrContext(
139127
namedFunction("kotlin", "emptyArray")
140128
}
141129

142-
val emptyList by lazy {
143-
namedFunction("kotlin.collections", "emptyList")
144-
}
145-
146130
val mapOf by lazy {
147131
namedFunction("kotlin.collections", "mapOf") {
148132
vsApi {

compiler-plugin/compiler-plugin-backend/src/main/core/kotlinx/rpc/codegen/extension/RpcStubGenerator.kt

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ private object Stub {
3737
private object Descriptor {
3838
const val CALLABLE_MAP = "callableMap"
3939
const val FQ_NAME = "fqName"
40-
const val GET_FIELDS = "getFields"
4140
const val GET_CALLABLE = "getCallable"
4241
const val CREATE_INSTANCE = "createInstance"
4342
}
@@ -616,8 +615,6 @@ internal class RpcStubGenerator(
616615
generateGetCallableFunction()
617616

618617
generateCreateInstanceFunction()
619-
620-
generateGetFieldsFunction()
621618
}
622619

623620
/**
@@ -1186,61 +1183,6 @@ internal class RpcStubGenerator(
11861183
}
11871184
}
11881185

1189-
/**
1190-
* Function for getting a list of all RPC fields in a given service as [RpcDeferredField<*>]
1191-
*
1192-
* ```kotlin
1193-
* final override fun getFields(service: MyService): List<RpcDeferredField<*>> {
1194-
* return listOf( // or emptyList() if no fields
1195-
* service.<field-1>,
1196-
* ...
1197-
* service.<field-n>,
1198-
* ) as List<RpcDeferredField<*>>
1199-
* }
1200-
* ```
1201-
*
1202-
* Where:
1203-
* - `<field-k>` - the k-th field of a given service
1204-
*/
1205-
private fun IrClass.generateGetFieldsFunction() {
1206-
val listType = ctx.irBuiltIns.listClass.typeWith(ctx.rpcDeferredField.starProjectedType)
1207-
1208-
addFunction {
1209-
name = Name.identifier(Descriptor.GET_FIELDS)
1210-
visibility = DescriptorVisibilities.PUBLIC
1211-
modality = Modality.OPEN
1212-
1213-
returnType = listType
1214-
}.apply {
1215-
overriddenSymbols = listOf(ctx.rpcServiceDescriptor.functionByName(Descriptor.GET_FIELDS))
1216-
1217-
vsApi {
1218-
dispatchReceiverParameterVS = stubCompanionObjectThisReceiver
1219-
.copyToVS(this@apply, origin = IrDeclarationOrigin.DEFINED)
1220-
}
1221-
1222-
addValueParameter {
1223-
name = Name.identifier("service")
1224-
type = declaration.serviceType
1225-
}
1226-
1227-
body = irBuilder(symbol).irBlockBody {
1228-
val anyListType = ctx.irBuiltIns.listClass.typeWith(ctx.anyNullable)
1229-
1230-
val listCall = irCall(
1231-
callee = ctx.functions.emptyList,
1232-
type = anyListType,
1233-
).apply listApply@{
1234-
arguments {
1235-
types { +ctx.anyNullable }
1236-
}
1237-
}
1238-
1239-
+irReturn(irAs(listCall, listType))
1240-
}
1241-
}
1242-
}
1243-
12441186
// Associated object annotation works on JS, WASM, and Native platforms.
12451187
// See https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect/find-associated-object.html
12461188
private fun addAssociatedObjectAnnotationIfPossible() {

compiler-plugin/compiler-plugin-cli/src/main/latest/kotlinx/rpc/codegen/RpcCompilerPlugin.kt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ class RpcCommandLineProcessor : CommandLineProcessor {
1818
override val pluginId = "kotlinx-rpc"
1919

2020
override val pluginOptions = listOf(
21-
StrictModeCliOptions.STATE_FLOW,
22-
StrictModeCliOptions.SHARED_FLOW,
23-
StrictModeCliOptions.NESTED_FLOW,
24-
StrictModeCliOptions.STREAM_SCOPED_FUNCTIONS,
25-
StrictModeCliOptions.SUSPENDING_SERVER_STREAMING,
26-
StrictModeCliOptions.NOT_TOP_LEVEL_SERVER_FLOW,
27-
StrictModeCliOptions.FIELDS,
2821
RpcFirCliOptions.ANNOTATION_TYPE_SAFETY,
2922
)
3023

@@ -33,10 +26,6 @@ class RpcCommandLineProcessor : CommandLineProcessor {
3326
value: String,
3427
configuration: CompilerConfiguration,
3528
) {
36-
if (option.processAsStrictModeOption(value, configuration)) {
37-
return
38-
}
39-
4029
when (option) {
4130
RpcFirCliOptions.ANNOTATION_TYPE_SAFETY -> {
4231
@Suppress("NullableBooleanElvis")

compiler-plugin/compiler-plugin-common/src/main/core/kotlinx/rpc/codegen/common/Names.kt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
package kotlinx.rpc.codegen.common
66

7-
import org.jetbrains.kotlin.name.CallableId
87
import org.jetbrains.kotlin.name.ClassId
98
import org.jetbrains.kotlin.name.FqName
109
import org.jetbrains.kotlin.name.Name
@@ -21,16 +20,6 @@ object RpcClassId {
2120
val stateFlow = ClassId(FqName("kotlinx.coroutines.flow"), Name.identifier("StateFlow"))
2221
}
2322

24-
object RpcCallableId {
25-
val streamScoped = CallableId(FqName("kotlinx.rpc.krpc"), Name.identifier("streamScoped"))
26-
val withStreamScope = CallableId(FqName("kotlinx.rpc.krpc"), Name.identifier("withStreamScope"))
27-
val StreamScope = CallableId(FqName("kotlinx.rpc.krpc"), Name.identifier("StreamScope"))
28-
val invokeOnStreamScopeCompletion = CallableId(
29-
FqName("kotlinx.rpc.krpc"),
30-
Name.identifier("invokeOnStreamScopeCompletion"),
31-
)
32-
}
33-
3423
object RpcNames {
3524
val SERVICE_STUB_NAME: Name = Name.identifier("\$rpcServiceStub")
3625

compiler-plugin/compiler-plugin-k2/src/main/core/kotlinx/rpc/codegen/FirRpcAdditionalCheckers.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package kotlinx.rpc.codegen
77
import kotlinx.rpc.codegen.checkers.FirCheckedAnnotationHelper
88
import kotlinx.rpc.codegen.checkers.FirRpcDeclarationCheckers
99
import kotlinx.rpc.codegen.checkers.FirRpcExpressionCheckers
10-
import kotlinx.rpc.codegen.checkers.diagnostics.FirRpcStrictModeDiagnostics
1110
import org.jetbrains.kotlin.config.CompilerConfiguration
1211
import org.jetbrains.kotlin.fir.FirSession
1312
import org.jetbrains.kotlin.fir.analysis.checkers.declaration.DeclarationCheckers
@@ -32,7 +31,6 @@ class FirRpcAdditionalCheckers(
3231
session = session,
3332
serializationIsPresent = serializationIsPresent,
3433
annotationTypeSafetyEnabled = configuration.get(RpcFirConfigurationKeys.ANNOTATION_TYPE_SAFETY, true),
35-
modes = configuration.strictModeAggregator(),
3634
)
3735

3836
override val declarationCheckers: DeclarationCheckers = FirRpcDeclarationCheckers(ctx)
@@ -43,10 +41,7 @@ class FirCheckersContext(
4341
private val session: FirSession,
4442
val serializationIsPresent: Boolean,
4543
val annotationTypeSafetyEnabled: Boolean,
46-
modes: StrictModeAggregator,
4744
) {
48-
val strictModeDiagnostics = FirRpcStrictModeDiagnostics(modes)
49-
5045
val typeParametersCache = session.firCachesFactory.createCache { typeParameter: FirTypeParameterSymbol ->
5146
FirCheckedAnnotationHelper.checkedAnnotations(session, typeParameter)
5247
}

compiler-plugin/compiler-plugin-k2/src/main/core/kotlinx/rpc/codegen/StrictMode.kt

Lines changed: 0 additions & 142 deletions
This file was deleted.

compiler-plugin/compiler-plugin-k2/src/main/core/kotlinx/rpc/codegen/checkers/FirRpcCheckers.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.fir.analysis.checkers.expression.FirFunctionCallChec
1616
class FirRpcDeclarationCheckers(ctx: FirCheckersContext) : DeclarationCheckers() {
1717
override val regularClassCheckers: Set<FirRegularClassChecker> = setOfNotNull(
1818
FirRpcAnnotationCheckerVS(ctx),
19-
if (ctx.serializationIsPresent) FirRpcStrictModeClassCheckerVS(ctx) else null,
19+
if (ctx.serializationIsPresent) FirRpcStrictModeClassCheckerVS() else null,
2020
FirRpcServiceDeclarationCheckerVS(ctx),
2121
)
2222

@@ -36,6 +36,5 @@ class FirRpcDeclarationCheckers(ctx: FirCheckersContext) : DeclarationCheckers()
3636
class FirRpcExpressionCheckers(ctx: FirCheckersContext) : ExpressionCheckers() {
3737
override val functionCallCheckers: Set<FirFunctionCallChecker> = setOf(
3838
FirCheckedAnnotationFunctionCallCheckerVS(ctx),
39-
FirRpcStrictModeExpressionCheckerVS(ctx),
4039
)
4140
}

0 commit comments

Comments
 (0)