Skip to content

Commit d6b38c0

Browse files
committed
grpc: Address PR comments
Signed-off-by: Johannes Zottele <[email protected]>
1 parent a610c49 commit d6b38c0

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

compiler-plugin/compiler-plugin-backend/src/main/kotlin/kotlinx/rpc/codegen/extension/RpcDeclarationScanner.kt

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

55
package kotlinx.rpc.codegen.extension
66

7+
import kotlinx.rpc.codegen.common.RpcClassId
78
import kotlinx.rpc.codegen.common.RpcNames
89
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
910
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
@@ -17,7 +18,6 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression
1718
import org.jetbrains.kotlin.ir.util.dumpKotlinLike
1819
import org.jetbrains.kotlin.ir.util.getAnnotation
1920
import org.jetbrains.kotlin.ir.util.hasDefaultValue
20-
import org.jetbrains.kotlin.ir.util.kotlinFqName
2121

2222
/**
2323
* This class scans user declared RPC service
@@ -30,7 +30,7 @@ internal object RpcDeclarationScanner {
3030
fun scanServiceDeclaration(service: IrClass, ctx: RpcIrContext, logger: MessageCollector): ServiceDeclaration {
3131
var stubClass: IrClass? = null
3232

33-
val grpcAnnotation = service.getAnnotation(ctx.grpcAnnotation.owner.kotlinFqName)
33+
val grpcAnnotation = service.getAnnotation(RpcClassId.grpcAnnotation.asSingleFqName())
3434
val protoPackage = grpcAnnotation?.arguments?.getOrNull(0)?.asConstString() ?: ""
3535

3636
val declarations = service.declarations.memoryOptimizedMap { declaration ->

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ internal class RpcIrContext(
6464
getRpcIrClassSymbol("RpcServiceDescriptor", "descriptor")
6565
}
6666

67-
val grpcAnnotation by lazy {
68-
getIrClassSymbol("kotlinx.rpc.grpc.annotations", "Grpc")
69-
}
70-
7167
val grpcServiceDescriptor by lazy {
7268
getIrClassSymbol("kotlinx.rpc.grpc.descriptor", "GrpcServiceDescriptor")
7369
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private object Descriptor {
3636
const val CALLABLE_MAP = "callableMap"
3737
const val CALLABLES = "callables"
3838

39-
// the kotlin class name (derived from java_package and name)
39+
// the kotlin class name
4040
const val FQ_NAME = "fqName"
4141
const val SIMPLE_NAME = "simpleName"
4242
const val GET_CALLABLE = "getCallable"
@@ -1085,7 +1085,7 @@ internal class RpcStubGenerator(
10851085
*
10861086
* ```kotlin
10871087
* serviceDescriptor(
1088-
* name = MyService, // simpleName
1088+
* name = my.proto.package.MyService, // $declaration.serviceFqName
10891089
* methods = methodDescriptorMap.values, // Collection<MethodDescriptor<*, *>>
10901090
* schemaDescriptor = null, // for now, only null
10911091
* )

0 commit comments

Comments
 (0)