|
|
|
|
|
by angus_gh
2331 days ago
|
|
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." https://openjdk.java.net/jeps/359 |
|