Statements (51)
Predicate | Object |
---|---|
gptkbp:instanceOf |
Java language feature
|
gptkbp:compatibleWith |
Be abstract
Declare instance fields other than record components Declare instance initializers Declare native methods Declare synchronized methods Declare type parameters on record components Extend other classes |
gptkbp:feature |
Cannot declare type parameters on record components
Can declare static fields and methods Can implement interfaces Can override methods Cannot be abstract Cannot declare instance initializers Cannot declare native methods Cannot declare synchronized methods Cannot extend other classes Canonical constructor Compact constructor support Component-based deconstruction Supports pattern matching (since Java 16 preview, Java 17 standard) Fields are final and private Implicitly extends java.lang.Record Implicitly final No setters generated Serializable by default Supports annotations on components Supports compact constructors Supports generic records Supports local records Supports nested types Supports serialization Supports static fields Supports static initializers Supports static methods Cannot declare instance fields other than record components Automatically generates equals(), hashCode(), toString() |
gptkbp:hasSyntax |
record Point(int x, int y) {}
|
https://www.w3.org/2000/01/rdf-schema#label |
Records (since Java 16)
|
gptkbp:introducedIn |
gptkb:Java_16
|
gptkbp:JEP_number |
gptkb:JEP_395
|
gptkbp:partOf |
gptkb:Project_Amber
|
gptkbp:previouslyPreviewedIn |
gptkb:Java_14
Java 15 |
gptkbp:purpose |
Provide a compact syntax for declaring classes which are transparent holders for shallowly immutable data
|
gptkbp:relatedTo |
gptkb:Case_classes_in_Scala
gptkb:Data_classes_in_Kotlin gptkb:Records_in_C# |
gptkbp:status |
Standard feature since Java 16
|
gptkbp:bfsParent |
gptkb:Java_Standard_Edition
|
gptkbp:bfsLayer |
7
|