## Java Development Tools

Here are descriptions of some of the more interesting or significant changes made to the Java development tools (JDT) for the 4.34 release of Eclipse. They are grouped into:

- New Language Features
- Java Editor
- Java Compiler
- Java Views and Dialogs

See also the Eclipse Platform What's New document for changes in the Platform.

We also recommend to read the Tips and Tricks.

## New Java Language Features

New Java Language Features | The release notably includes the following Java features: JEP 467: Markdown Documentation Comments JEP 455: Primitive Types in Patterns, instanceof, and switch (Preview) JEP 476: Module Import Declarations (Preview) JEP 477: Implicitly Declared Classes and Instance Main Methods (Third Preview) JEP 482: Flexible Constructor Bodies (Second Preview)

## Java Editor

New boolean if/else clean-up

A new clean-up has been created to combine two opposite boolean returns controlled by an if statement into a single return where possible.

To use the clean-up, go to the Code Style tab of the clean-up configuration dialog under Control statements and select: Simplify boolean if/else to single return if possible.

For example, applying the clean-up to the following code:

results in:

Rename unused to unnamed quickfix/cleanup

The quick-fix/clean-up for unused local variables has been enhanced when using Java 22 or above to rename to the unnamed variable ("_") where appropriate. These situations include:

- unused lambda parameters
- unused try-with-resources resources
- unused pattern variables in switch
- unused variables in enhanced for statement
- unused variables in regular for statement

In these cases, a quick-fix will be offered to rename to the unnamed variable. The quick-fix is a multi-fix and will also offer to fix multiple instances of the problem.

For example, hovering one of the unused variables in the file will show:

and selecting to fix multiple problems of the same category results in:

The new rename functionality is embedded into the existing Remove unused local variables clean-up found on the Unnecessary Code tab of the clean-up configuration dialog. The clean-up will rename to the unnamed variable for unused locals or lambda parameters when the compliance level is 22 or above.

Null handling for if/else to switch clean-up

The if/else to switch clean-up has been enhanced to properly handle the case where the value can be null. In the if/else statement, this is handled intrinsically either by an else statement or falling through the if/else if, but when converting to a switch statement, either the switch must be embedded in an if statement to test for null or for Java 21 or above, a case null statement needs to be added.

The clean-up is accessed on the Code style tab of the clean-up configuration dialog under Control statements and selecting: Convert if/else if/else chain with 3 blocks min to switch.

Applying the clean-up to the following code:

results in the following when Java version is less than 21

and results in the following when the Java release is set to 21 and up:

## Java Views and Dialogs

Rendering Markdown Documentation Comments | In this release, JDT has added HTML parsing and rendering support for markdown documentation comments on Java programming elements. This comes as a standard feature at source level 23. The HTML rendering is provided both on hover and Javadoc view. Here are some examples of how the markdown comments get rendered: Hovering in the editor: Javadoc View:
New Filter Options in Call Hierarchy | This change helps filtering your results after calling the Call Hierarchy on a method. With more filter options that are also much more understandable, you can filter your results much better than before. In the following picture you can see the new filter Options!
Show the Filters in the buttons bar of the Call Hierarchy view | Thanks to this change, you can easily access the filters after calling the call hierarchy on a method. With the new, more accessible filters button, changing the filters is easier than ever, especially now that there are more and better options to filter the results. You can still use the old way to access the filter like so:

## Java Compiler

Configure problem severity for unused lambda parameters | You can configure the problem severity for unused lambda parameters with the new option in Preferences > Java > Compiler > Errors/Warnings: