Fail with error when a field is identically named as the options static field
Open
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 4.4k
- Forks
- 627
- Avg merge
- 3d 15m
- Merged PRs (30d)
- 20
Description
Consider the following proto definition:
message Testing {
optional string field = 1 [(squareup.someOption) = 123];
optional string FIELD_OPTIONS_FIELD = 2;
}
This will generate a Java class containing the following incorrect code:
public static final FieldOptions FIELD_OPTIONS_FIELD = new FieldOptions.Builder()
.someOption(123)
.build();
....
@WireField(
tag = 2,
adapter = "com.squareup.wire.ProtoAdapter#STRING"
)
public final String FIELD_OPTIONS_FIELD;
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
Reproduce the issue from the provided proto definition and inspect the generated Java class, focusing on the collision between the static FIELD_OPTIONS_FIELD member and the generated message field. Confirm that the generated class no longer declares conflicting members and remains compilable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100