Hi Yufei,

I also like records and I think they should be used freely.

The Immutables library excels mostly when fluent builders,
validations, redactions or lazy initializations are required. That
said, records can have Immutables builders too.

I think we should accept new contributions favoring records over
Immutables, however I see little value in changing existing code just
to remove Immutables.

Thanks,
Alex

On Wed, Oct 28, 2026 at 2:14 AM Dmitri Bourlatchkov <[email protected]> wrote:
>
> Hi Yufei,
>
> Yes, I think your observation is very relevant.
>
> I see that new PRs already use records, and I agree that this trend is
> perfectly fine for Polaris.
>
> I'd leave this to reviewers to suggest records where appropriate.
> Converting existing code from immutables to records just for the sake of
> using records is something that makes me hesitate, though.
>
> Cheers,
> Dmitri.
>
> On Tue, Oct 27, 2026 at 6:23 PM Yufei Gu <[email protected]> wrote:
>
> > Hi all,
> >
> > Can we make Java records the default for simple value types in Polaris?
> >
> > Classes like StsDestination, AuthorizationDecision, and
> > ProductionReadinessCheck.Error have only a few fields. They seem
> > straightforward to express as records without needing Immutables.
> >
> > One reason for using Immutables is avoiding boilerplate. I think that
> > tradeoff has changed with AI coding. Records already generate the basic
> > methods, and agents can easily write and update the remaining helpers, such
> > as factories, validation, and defensive copies. We should focus more on
> > whether the resulting code is simpler than on the effort of writing those
> > methods.
> >
> > We can keep Immutables where complex builders or existing model hierarchies
> > make it useful. For simple types, I’d prefer standard Java and fewer
> > dependencies on generated classes.
> >
> > I suggest starting with a few small conversions, checking that behavior
> > stays the same, and comparing the code. If that looks good, we can document
> > records as the default for new simple types.
> >
> > Thoughts?
> > Yufei
> >

Reply via email to