News for hackers. Stuff that matters.
Re:Lombok Saved My Ass by azth on Saturday November 16, 2019 @08:54PM (#21556087)
> but at least the @Data annotation makes it much more readable IMO.

Record types for Java are being worked on, and we should be getting them hopefully at some point in the (near) future.

Re:Lombok Saved My Ass by mkurz on Sunday November 17, 2019 @02:23AM (#21556944)
> Record types for Java are being worked on, and we should be getting them hopefully at some point in the (near) future.

Just 2 days ago JEP 359 [0] was marked to be fixed [1] in Java 14 (as preview feature)!

[0] https://openjdk.java.net/jeps/359

[1] https://bugs.openjdk.java.net/browse/JDK-8222777 (see "History")

Re:Lombok Saved My Ass by lmilcin on Sunday November 17, 2019 @10:48AM (#21558401)
If you use @Data you say that all fields will be available with getters and setters that will have no other special logic.

Why not consider making those fields public then and not bother with @Data?.

This is how Java language was designed, then everybody started mindlessly putting getters and setters around private fields to pretend they are private while giving everybody access to do whatever they want with them (silly).

Now you are putting @Data to further muddle the problem which basically does not exist.

Re:Lombok Saved My Ass by pacala on Sunday November 17, 2019 @01:33PM (#21559237)
hash, equals, toString.
Re:Lombok Saved My Ass by vbezhenar on Sunday November 17, 2019 @02:13AM (#21556910)
Records are strange feature. They are immutable, they can't be abstract, they can't extend, they have implementations of some methods. I don't need anything of that. I just need short syntax to declare property with trivial getter/setter and that's about it. This is strange proposal.
Re:Lombok Saved My Ass by azth on Sunday November 17, 2019 @04:26AM (#21557188)
The concept of records already exists in other languages, including JVM languages (like Scala and Kotlin). The fact that they're immutable and final is important. If they weren't, there would be subtle bugs caused by that. Scala actively recommends that case classes not be extended precisely due to this fact. Overriding methods for equality and hash code make it such that these classes can be used as keys in maps or entries in sets.
Re:Lombok Saved My Ass by rumanator on Sunday November 17, 2019 @01:49PM (#21559320)
Records are strange feature. > They are immutable, they can't be abstract, they can't extend, they have implementations of some methods. I don't need anything of that.

Some people find data transfer objects to be very useful, even fundamental to implement a well architects software project.

Re:Lombok Saved My Ass by rienbdj on Sunday November 17, 2019 @04:30AM (#21557193)
If you want an object with a few getters and setters, just make a class.

This proposal is to remove the boiler plate of creating immutable objects with value semantics.

Re:Lombok Saved My Ass by _ZeD_ on Sunday November 17, 2019 @02:18AM (#21556924)
never soon enough!