Manuel Lilienberg
03/16/2026, 7:37 PMe: 'equals' overrides nothing. Potential signatures for overriding:
expect fun equals(other: Any?): Boolean
e: Operator '===' cannot be applied to 'HelloRequestInternal' and 'Any?'.
Is this a known issue or misconfiguration? More details from my coding agent in the thread.Manuel Lilienberg
03/16/2026, 7:37 PMequals and === in _rpc_internal classes fail to compile with Kotlin 2.3.0
Plugin version: kotlinx-rpc 0.11.0-grpc-185 Kotlin version: 2.3.0 Gradle version: 9.4.0 Configuration: rpc { protoc() } with Kotlin Multiplatform (JVM + iOS targets), protos in src/commonMain/proto
Description:
The protoc-gen-kotlin-multiplatform code generator produces _rpc_internal classes that extend InternalMessage and contain override fun equals(other: Any?) and if (this === other) statements that fail to compile.
Example generated code (e.g. test/_rpc_internal/Test.kt):
class HelloRequestInternal: HelloRequest.Builder, InternalMessage(fieldsWithPresence = 1) {
// ...
override fun equals(other: Any?): Boolean { // ERROR: 'equals' overrides nothing
checkRequiredFields()
if (this === other) return true // ERROR: Operator '===' cannot be applied
if (other == null || this::class != other::class) return false
other as HelloRequestInternal
// ...
}
}
Compiler errors:
e: 'equals' overrides nothing. Potential signatures for overriding:
expect fun equals(other: Any?): Boolean
e: Operator '===' cannot be applied to 'HelloRequestInternal' and 'Any?'.
This affects every generated message class that has fields with presence tracking. The issue appears to be that InternalMessage does not expose equals as open, or there is a mismatch between the generated override signature and what Kotlin 2.3.0 expects in a commonMain (expect/actual) context.
Reproduction:
Create a KMP project with jvm(), iosArm64(), iosSimulatorArm64() targets
Add any .proto file with a message containing fields to src/commonMain/proto/
Configure rpc { protoc() }
1. Run ./gradlew compileCommonMainKotlinMetadata
The bufGenerateCommonMain task succeeds, but compileCommonMainKotlinMetadata fails on every generated _rpc_internal class.Johannes Zottele
03/17/2026, 8:54 AMimport "google/protobuf/empty.proto";
Also, could you check whether the Any parameter in the generated equals method resolves to com.google.protobuf.kotlin.Any instead of kotlin.Any?
If yes, we have a bug in our name resolution which causes a type conflict.Alexander Sysoev
03/17/2026, 9:05 AMManuel Lilienberg
03/17/2026, 9:57 AMsyntax = "proto3";
package test;
import "google/protobuf/any.proto";
message MyMessage {
google.protobuf.Any payload = 1;
}
service MyService {
rpc GetMessage(MyMessage) returns (MyMessage);
}
1. With the star import (import com.google.protobuf.kotlin.*) -- compileCommonMainKotlinMetadata FAILS with 'equals' overrides nothing
2. Without the star import -- compileCommonMainKotlinMetadata SUCCEEDSAlexander Sysoev
03/17/2026, 12:01 PMManuel Lilienberg
03/18/2026, 10:32 AMAlexander Sysoev
03/18/2026, 11:40 AM