Convert class to record

Use inspections to convert classes to Java 16 records

IntelliJ IDEA can identify classes that are data holders and can be converted to records. The class will be highlighted with a warning (yellow underline) - press ⌥⏎ (macOS) / Alt+Enter (Windows/Linux) and IntelliJ IDEA will suggest converting the class to a record.

The fields will be become record components, the constructor and accessors will be removed. If we had equals, hashCode and toString methods on our class, we can optionally remove these and rely on the default record implementation.

Related Resources

Go to Next Error
Quickly move to the next (or previous) error or warning in the file.
Context Actions
Use Alt+Enter to show available context actions
Inspections Widget
The top-right corner of your editor shows you information about the state of your class