Open xit0c opened 3 months ago
What's your idea for a fix?
I don't know wire's internals but it seems it's happening because of a conflict with Message
's hashcode
property.
I see that in the js
implementation @JsName
is used to override its name, so maybe it's the annotation that is not working. Any thoughts on that?
A possible solution could be to rename that property to something like internalHashcode
(or cachedHashCode
as in the annotation) and at that point the error should be gone and the annotation won't even be needed anymore. But again, since I don't know wire's internals and therefore the implications this little refactor could have, maybe this solution isn't feasible.
In a Kotlin Multiplatform project that targets JS, a Wire generated class shows this error in its constructor:
JavaScript name hashCode is generated for different inherited members: var hashCode: Int and fun hashCode(): Int
.Setting
buildersOnly = true
in the plugin configuration (as shown in Wire's js sample) still gives the same error.Fortunately, the build is not broken by that error and the class can still be used without problems, but since I noticed it I thought it was worth reporting it.
Maybe this is a duplicate of #1424, but that issue doesn't have any progress and it is inactive since 2020.
Reproduction Steps
js
as one of the targetswire
gradle plugin andwire-runtime
dependency and add thewire
configuration block in thebuild.gradle.kts
fileCreate a simple
.proto
file incommonMain/proto
, mine is:Environment
IDE: Android Studio Jellyfish | 2023.3.1 Kotlin Version:
1.9.24
Wire Version: both4.9.9
and5.0.0-alpha01
(I didn't test older versions)