square / square/wire

Name conflict when generating with --android

Open
#475 4 comments 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

When generating code with the --android flag set, generated messages import android.os.Parcelable.

I have a message called Creator, which now conflicts with Parcelable.Creator. In particular, this creates an issue in the Builder class that is generated:

public static final class Builder extends com.squareup.wire.Message.Builder<Creator, Builder>

In the type parameters, Creator should reference the newly generated outer message class Creator, but instead resolves to Parcelable.Creator, causing a whole chain of errors when trying to compile.

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 reproducing generation with the --android flag using a message named Creator, then inspect the generated Builder declaration and its type parameters. Done means the generated Creator reference resolves to the outer message rather than Parcelable.Creator, and the generated code compiles without the reported cascade of errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.