JavaScript name hashCode is generated for different inherited members [Kotlin Multiplatform] [JS]
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 4.4k
- Forks
- 627
- Avg merge
- 3d 15m
- Merged PRs (30d)
- 20
Description
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
- Create a new Kotlin Multiplatform project with the Android Studio "New project..." wizard
- Add
jsas one of the targets - Add
wiregradle plugin andwire-runtimedependency and add thewireconfiguration block in thebuild.gradle.ktsfile - Create a simple
.protofile incommonMain/proto, mine is:syntax = "proto2"; message Position { required float x = 1; required float y = 2; } - Run the build and check the generated class
- NOTE: if the error doesn't show up, go to "File -> Invalidate Caches...", check all the checkboxes and press "Invalidate and Restart", then resync and rebuild the project
Environment
IDE: Android Studio Jellyfish | 2023.3.1
Kotlin Version: 1.9.24
Wire Version: both 4.9.9 and 5.0.0-alpha01 (I didn't test older versions)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the JS sample's build.gradle.kts and the reproduced commonMain/proto Position definition, using the listed Kotlin, Wire, and JS setup. Compare the generated class with buildersOnly enabled and confirm the JavaScript hashCode diagnostic; done means the diagnostic is no longer produced while the generated class remains usable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, kotlin
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100