Skip to content

Commit 10dd827

Browse files
committed
Fix compilation
1 parent b8fbc1b commit 10dd827

File tree

6 files changed

+17
-11
lines changed

6 files changed

+17
-11
lines changed

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

Lines changed: 4 additions & 3 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.codegen.extension
@@ -9,15 +9,16 @@ import org.jetbrains.kotlin.cli.common.messages.MessageCollector
99
import org.jetbrains.kotlin.ir.IrStatement
1010
import org.jetbrains.kotlin.ir.declarations.IrClass
1111
import org.jetbrains.kotlin.ir.util.hasAnnotation
12+
import org.jetbrains.kotlin.ir.util.isInterface
1213
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
1314

1415
internal class RpcIrServiceProcessor(
1516
@Suppress("unused")
1617
private val logger: MessageCollector,
1718
) : IrElementTransformer<RpcIrContext> {
1819
override fun visitClass(declaration: IrClass, data: RpcIrContext): IrStatement {
19-
if (declaration.hasAnnotation(RpcClassId.rpcAnnotation)
20-
|| declaration.hasAnnotation(RpcClassId.grpcAnnotation)
20+
if ((declaration.hasAnnotation(RpcClassId.rpcAnnotation)
21+
|| declaration.hasAnnotation(RpcClassId.grpcAnnotation)) && declaration.isInterface
2122
) {
2223
processService(declaration, data)
2324
}

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
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.codegen
66

77
import kotlinx.rpc.codegen.common.RpcClassId
88
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
99
import org.jetbrains.kotlin.fir.FirSession
10+
import org.jetbrains.kotlin.fir.declarations.FirClass
1011
import org.jetbrains.kotlin.fir.declarations.FirClassLikeDeclaration
12+
import org.jetbrains.kotlin.fir.declarations.utils.isInterface
1113
import org.jetbrains.kotlin.fir.extensions.FirDeclarationPredicateRegistrar
1214
import org.jetbrains.kotlin.fir.extensions.FirSupertypeGenerationExtension
1315
import org.jetbrains.kotlin.fir.extensions.predicateBasedProvider
@@ -24,7 +26,10 @@ abstract class FirRpcSupertypeGeneratorAbstract(
2426
}
2527

2628
override fun needTransformSupertypes(declaration: FirClassLikeDeclaration): Boolean {
27-
return session.predicateBasedProvider.matches(FirRpcPredicates.rpc, declaration)
29+
return session.predicateBasedProvider.matches(
30+
predicate = FirRpcPredicates.rpc,
31+
declaration = declaration,
32+
) && declaration is FirClass && declaration.isInterface
2833
}
2934

3035
protected fun computeAdditionalSupertypesAbstract(

grpc/grpc-core/src/commonMain/kotlin/kotlinx/rpc/grpc/Status.kt

Lines changed: 2 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
@file:Suppress("MemberVisibilityCanBePrivate")
@@ -30,6 +30,6 @@ public interface Status {
3030
DATA_LOSS(15),
3131
UNAUTHENTICATED(16);
3232

33-
public val valueAscii: ByteArray = value.toString().toByteArray(Charsets.US_ASCII)
33+
public val valueAscii: ByteArray = value.toString().encodeToByteArray()
3434
}
3535
}

grpc/grpc-core/src/jvmMain/kotlin/kotlinx/rpc/grpc/ServerServiceDefinition.jvm.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
package kotlinx.rpc.grpc
88

9-
internal actual typealias ServerServiceDefinition = io.grpc.ServerServiceDefinition
9+
public actual typealias ServerServiceDefinition = io.grpc.ServerServiceDefinition

protobuf-plugin/src/main/kotlin/kotlinx/rpc/protobuf/ModelToKotlinGenerator.kt

Lines changed: 2 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.protobuf
@@ -275,7 +275,7 @@ class ModelToKotlinGenerator(
275275
name = "definitionFor",
276276
modifiers = "override",
277277
args = "impl: ${service.name.simpleName}",
278-
returnType = "kotlinx.rpc.grpc.internal.ServerServiceDefinition",
278+
returnType = "kotlinx.rpc.grpc.ServerServiceDefinition",
279279
) {
280280
scope("return ${service.name.simpleName}ServerDelegate(impl).bindService()")
281281
}

versions-root/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ grpc-stub = { module = "io.grpc:grpc-stub", version.ref = "grpc" }
100100
grpc-util = { module = "io.grpc:grpc-util", version.ref = "grpc" }
101101
grpc-netty = { module = "io.grpc:grpc-netty", version.ref = "grpc" }
102102
grpc-protobuf = { module = "io.grpc:grpc-protobuf", version.ref = "grpc" }
103-
grpc-kotlin-stub = { module = "io.grpc:grpc-protobuf", version.ref = "grpc-kotlin" }
103+
grpc-kotlin-stub = { module = "io.grpc:grpc-kotlin-stub", version.ref = "grpc-kotlin" }
104104
grpc-protoc-gen-java = { module = "io.grpc:protoc-gen-grpc-java", version.ref = "grpc" }
105105
grpc-protoc-gen-kotlin = { module = "io.grpc:protoc-gen-grpc-kotlin", version.ref = "grpc-kotlin" }
106106

0 commit comments

Comments
 (0)