square / square/wire

feature request: wire-compiler: provide an option to generate Guava immutable collections for repeated proto fields

Open
#189 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

Hi.

I really like the compact immutable types wire-compiler generates.
However, they use old Java collections which are not immutable.

As an option I suggest let the compiler generate constructor with Guava ImmutableList parameter for repeated proto fields, instead of old Java List.
This way, if you want immutability and you agree to pay the price to be dependent on Guava, you have the way to do that.

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 wire-compiler code that generates constructors and types for repeated proto fields, then trace how existing immutable collection types are selected. Check the compiler's tests for generated repeated fields and define coverage showing the option produces Guava ImmutableList parameters while the default output remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Feature
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.