square / square/wire

Kotlin generated builder rename method if name conflicts with proto types.

Open
#1,641 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
4.4k
Forks
627
Avg merge
3d 15m
Merged PRs (30d)
20

Description

For instance

optional int32 int32 = 1;

in Java, the builder will be

    public Builder int32(Integer int32) {
      this.int32 = int32;
      return this;
    }

in Kotlin, the builder will be (it includes the package in the name)

    fun squareup_proto3_kotlin_alltypes_int32(squareup_proto3_kotlin_alltypes_int32: Int): Builder {
      this.squareup_proto3_kotlin_alltypes_int32 = squareup_proto3_kotlin_alltypes_int32
      return this
    }

Maybe it was by design to keep the builder's setter samely named as the property?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Kotlin builder-generation entry point for protobuf fields and reproduce the generated output for a field named int32. Compare the Kotlin and Java naming behavior shown in the issue, then determine whether the package-qualified setter is intentional. Done means the naming conflict has a documented or corrected resolution, with generation coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.