Field and message with same name generate invalid code
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 4.4k
- Forks
- 627
- Avg merge
- 3d 15m
- Merged PRs (30d)
- 20
Description
If we have a message that’s unwisely named not-to-pattern, say, taco and a field of that type with the same name, optional taco taco = 1 then the generated code is malformed because Javac cannot differentiate between the field and class name.
Solutions for fixing this are awkward. Do we allocate a different field name? Or always fully-qualify the class?
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
The issue names no files or tests. Reproduce the malformed generated Java with the optional taco taco = 1 example, then trace the generator path that handles fields and message types with identical names. Done means the generated code compiles with Javac and preserves valid access to both the field and its type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100