Record types for Java are being worked on, and we should be getting them hopefully at some point in the (near) future.
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")
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.
This proposal is to remove the boiler plate of creating immutable objects with value semantics.
Some people find data transfer objects to be very useful, even fundamental to implement a well architects software project.