Re:Java 14 Feature Spotlight: Records
by angus_gh on Tuesday February 04, 2020 @04:21PM
(#22241116)
Where did you get the idea that records can't use annotations, have methods, or implement interfaces?:
"Beyond the restrictions above, records behave like normal classes: they can be declared top level or nested, they can be generic, they can implement interfaces, and they are instantiated via the new keyword. The record's body may declare static methods, static fields, static initializers, constructors, instance methods, and nested types. The record, and the individual components in a state description, may be annotated."
"Beyond the restrictions above, records behave like normal classes: they can be declared top level or nested, they can be generic, they can implement interfaces, and they are instantiated via the new keyword. The record's body may declare static methods, static fields, static initializers, constructors, instance methods, and nested types. The record, and the individual components in a state description, may be annotated."
https://openjdk.java.net/jeps/359