Skip to main content

Java development tools

Java™ 19 Support

Java 19 Java 19 is out and Eclipse JDT supports Java 19 in 4.26.

The release notably includes the following Java 19 features:
JEP 405: Record Patterns (Preview).
JEP 427: Pattern Matching for Switch (Third Preview).
JEP 425: Virtual Threads (Preview).
JEP 428: Structured Concurrency (Incubator).

Please note that preview option should be on for preview language features. For an informal introduction of the support, please refer to Java 19 Examples wiki.

Java Editor

New assists for class Some existing actions found in the Source menu have been made available as quick assists for a class. These actions are:
  1. Generate getters and setters
  2. Generate hashCode()/equals() methods
  3. Generate toString() method

All three actions require that there at least be one field in the class and that the action is required: namely, that getters/setters, hashCode()/equals(), or toString() methods do not already exist. Each action will bring up a dialog for the user to make additional specifications (e.g. which fields to use).

To use the quick assist, select a class and specify CTRL+1.

New Assists

Improved 'Extract local variable' The extract local variable refactoring available from Refactor > Extract Local Variable has been improved to recognize situations where adding the local variable may cause a NullPointerException as it precedes code used to check for null. In these cases, the positioning of the local variable is altered so the null check occurs before the variable declaration.

For example, in the following class, a call to the String length() method is made after verifying the String variable is not null.

Before

If we select the s.length() call and choose to extract this to a local variable to replace all occurrences, the result is:

Before

Note how the declaration is after the if statement to ensure that the check for null occurs first

Up Next

Back to the top