Records have been added to the Java language. Records are a new kind of class in the Java language. They act as transparent carriers for immutable data with less ceremony than normal classes. Since nested classes were first introduced to Java, with the exception of static final fields initialized by constant expressions, nested class declarations that are inner have been prohibited from declaring static members. This restriction applies to non-static member classes, local classes, and anonymous classes. [JEP 384: Records (Second Preview)](https://openjdk.java.net/jeps/384) added support for local interfaces, enum classes, and record classes, all of which are static definitions. This was a well-received enhancement, permitting coding styles that reduce the scope of certain declarations to local contexts. While [JEP 384](https://openjdk.java.net/jeps/384) allowed for static local classes and interfaces, it did not relax the restriction on static member classes and interfaces of inner classes. An inner class could declare a static interface inside one of its method bodies, but not as a class member. As a natural next step, [JEP 395](https://openjdk.java.net/jeps/395) further relaxes nesting restrictions, and permits static classes, methods, fields, etc., to be declared within inner classes. For further details, see [JEP 395](https://openjdk.java.net/jeps/395).
|