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