Hacker News new | ask | show | jobs
by depsypher 3160 days ago
Not sure where the danger is with @AllArgsConstructor. If you change the order of fields, it's the same as if you changed the order of the constructor parameters. You'll get compile errors and be forced to fix them (IDE or not). Seems as safe as anything to me.
1 comments

That assumes your constructor parameters are all unique types.
I would consider that a bit of a design smell, but yes. I think the danger point has more to do with training new converts: it is very unusual in any language that changing the order of class internals can change its external behavior.