Re:Kotlin Features I miss most in Java
by minus7 on Sunday October 29, 2017 @06:37PM
(#15581902)
Lombok addresses one pain point of Java (constructors/getters/setters), Kotlin addresses more. Lombok also does a bit of magic, so should be used with care. E.g. @AllArgsConstructor is a dangerous one if you change the order of fields, especially if you don't have IDE support for Lombok.
[ Parent
| on HN ]
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.
Re:Kotlin Features I miss most in Java
by joneholland on Sunday October 29, 2017 @09:23PM
(#15582539)
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.