> One of the nice things in Java is that we don't automatically copy ideas from other languages but deliberate on them first
Sure, but I’m sure it was not an automatic copy, but a well thought-out design by the very competent design team.
> It breaks encapsulation entirely
Records are almost by definition open. They are only the sum[1] of their constituents. They are part of a more data-oriented approach.
Of course the “old” OOP concerns may apply, and there is an escape hatch — one can make a class from a record, and with the coming destructors it won’t need any recompilation, every existing pattern match can work, yet its inner workings can be encapsulated. But this is not the primary purpose for them — they are just plain old data.
EDIT: though now that I thought a bit about it, hopefully with `withers` we get an alternative syntax for pattern matching on records, like `ColoredPoint { point: 3DPoint { x } }`. That way pattern matching won’t be tied to the order of the fields. Surely records don’t change often, but still.
[1] if we are being pedantic, they are the product of their constituents, they are named product types.