Data Oriented Programming, Beyond Records

Brian Goetz brian.goetz at oracle.com
Thu Jan 15 01:00:09 UTC 2026


> AFAIK `final class Point2D(int x, int y) {}` does not work? You need 
> the following:
>
> ```java
> class Point(int x, int y) {
>     private final component int x;
>     private final component int y;
> }
> ```
> So that's the benefit. No need to specify the fields a second time.
>

If you want it to be equivalent to the record declaration, you also have 
to make the class final (and extend Record.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-spec-observers/attachments/20260114/f1c3aadd/attachment.htm>


More information about the amber-spec-observers mailing list