Skip to main content

Java development tools

Java™ 18 Support

Java 18 Java 18 is out and Eclipse JDT supports Java 18 in 4.24.

The release notably includes the following Java 18 features:
JEP 420: Pattern Matching for switch (Second Preview).
JEP 413: Code Snippets in Java API Documentation.

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

JUnit

JUnit 5 'Rerun failures first' support Support for rerunning a test with failures first from the JUnit View is now supported for JUnit 5 tests. This support already existed for JUnit4 tests but was previously disabled for JUnit5 testing.

To run, click on the Rerun Test - Failures First button in the JUnit view.

Before

After pressing the button:

After

Java Editor

Remove unused private method parameters A new cleanup and quick-assist has been added to remove unused parameters of private methods. If removing parameters might lead to a conflict with an another method, the private method is renamed to be unique. The cleanup is not available if there is a method reference to the method, as in stream.filter(MyClass::foo)

To apply the cleanup, select the Remove unused private method parameters checkbox on the Unnecessary Code tab in your cleanup profile:

Preference

With the cleanup, the following code:

Before

changes to:

After

To remove a single parameter, a quick-assist has been added that can be activated with CTRL+1 with the cursor located anywhere on the parameter.

Extend Interface A new quick-assist has been added to extend an Interface. When selected, the new Interface wizard opens up.

Before

Extend Replace System.getProperty() calls clean up The existing clean up has been extended to replace more System.getProperty() calls with suitable Java method calls instead. The previous Boolean type property option has been renamed to Boxed type property and now handles Boolean, Integer, and Long. To specify, select the Replace sytem property with constant option and the sub-option: Boxed type property on the Java Feature page of your cleanup profile.

Options

For the given code:

Before

One gets:

After

Create sub type for sealed super type A new set of quick-fixes has been added to create sub-type for a sealed type which does not have any permitted types. When selected, the appropriate new Class/Record/Interface wizard opens up.

These quick fixes have been added to fix the error : Sealed class or interface lacks the permits clause and no class or interface from the same compilation unit declares Cls1 as its direct superclass or superinterface

As shown below, two new quick fixes have been added to create sub-type for a sealed super class.

Before

As shown below, six new quick fixes have been added to create sub-type for a sealed super interface.

Before

Debug

Console support for stack from Debug view Surprisingly enough, Java Stack Trace Console never supported navigation to Java types for Java stack traces copied from Debug view via Copy Stack action.

Now, the console will underline type names and line numbers and clicking on links will jump to the corresponding source code. If the type name is not unique, default Select type dialog will appear to allow selection of the right type.

Console shows links to Java types

Previous Up Next

Back to the top