4 ms·
Yes, you can override accessors and mutability is the main reason. It has been discussed a number of times on the various amber mailing lists, here is one [1].
by kasperni 7y ago
Yes, you can override accessors and mutability is the main reason. It has been discussed a number of times on the various amber mailing lists, here is one [1].
Yes, records can implement interfaces. The syntax is {ClassModifier} record TypeIdentifier [TypeParameters] RecordHeader [SuperInterfaces] RecordBody
[1] https://mail.openjdk.java.net/pipermail/amber-spec-experts/2019-March/001046.html https://mail.openjdk.java.net/pipermail/amber-spec-experts/2...
- doctor_eval 7y agoOK thanks. I misread an article as saying that records couldn’t be extended, but on rereading, it actually said that java.lang.Record couldn’t be extended other than by declaring a record. That makes a lot more sense, and certainly explains the use of methods instead of fields. Thanks! (I continue to dislike the syntax, FWIW)