Java development tools
Java™ 14 Support |
|
Java 14 |
Java 14 is out and Eclipse JDT supports Java 14 for 4.16.
The release notably includes the following Java 14 features:
Please note that the enable preview features option should be on for preview language features. For an informal introduction of the support, please refer to the Java 14 Examples wiki. |
Set JDK Compliance to 14 | You can set the JDK compliance to 14 and enable the preview features in Preferences > Java > Compiler: |
Template to create new record |
You can use the new_record template to create a record in an empty .java file:
|
Record Creation Wizard |
You can create a new record using the Record creation wizard that can be opened by:
-clearPersistedState for your existing workspace.
|
Enable preview features | You can now quickly enable the preview features on an applicable Java project by right-clicking on it and selecting Configure > Enable preview features: You can also change the default severity (warning) of the preview features compile problem in the opened Project properties dialog: |
Java Editor |
|
Non-blocking Java code completion |
By default, code completions in the Java editor are now configured to be computed (when possible) in a separate non-UI thread
in order to prevent UI freezes in case of long computations.
Users can restore the legacy behavior in Preferences > Java > Editor > Content Assist > Advanced by unchecking the
enable non-blocking completion checkbox; integrators
can change the value of the |
Merge control workflows |
A new clean up has been added that merges conditions of if/else if/else that have the same blocks when it is possible.
The code in the blocks should be the same.
An else block may be different and won't be merged.
One condition may be made opposite to allow the merge.
The conditions are merged with To select the clean up, invoke Source > Clean Up..., use a custom profile, and on the Configure... dialog select Merge conditions of if/else if/else that have the same blocks on the Unnecessary Code tab. For the given code: You get this after the clean up: |
Local variable type inference |
A new clean up has been added that makes use of the var keyword for the local variable when it is possible and is enabled only for Java 10 and higher.
The clean up replaces the explicit variable type by To select the clean up, invoke Source > Clean Up..., use a custom profile, and on the Configure... dialog select Use the local variable type inference on the Code Style tab. For the given code: You get this after the clean up: |
Prefer lazy logical operators |
A new clean up has been added that replaces eager logical operators by lazy operators when it is possible.
The clean up respectively replaces To select the clean up, invoke Source > Clean Up..., use a custom profile, and on the Configure... dialog select Use the lazy logical operator on the Code Style tab. For the given code: You get this after the clean up: |
Quick fix to change return statement to yield statement in Switch Expression |
A quick fix has been added to convert a return statement in a Switch Expression to yield statement.
|
Java Formatter |
|
Record declarations support |
A lot of new settings have appeared in the formatter profile to control the formatting of record declarations.
They are very similar to existing settings related to other type declarations.
To see them all, you can use the filter field and type in the keyword record .
|
Debug |
|
Synthetic variables inspection |
The JDT debugger is now capable of inspecting synthetic variables which are generated by the Java compilers.
One such example is debugging the following method java.util.stream.ReferencePipeline.filter(Predicate<? super P_OUT>)
and inspecting the predicate variable.
Before: Now: |
Preferences |
|
Substring Matching |
The content assist preference option Show Substring Matches has been removed and the feature is now always enabled.
Any application or user can still disable it using the VM property: -Djdt.codeCompleteSubstringMatch=false |