Skip to main content

Java development tools

Java™ 11 Support

Eclipse support for Java™ 11 Java™ 11 is here, and JDT supports it completely.
  • The Eclipse compiler for Java (ECJ) implements the new Java 11 language enhancements.
  • For an informal list of examples of Java 11 features, please have a look here.
Addition of Java 11 JRE A Java 11 JRE is recognized by Eclipse for launching. It can be added from the Window > Preferences > Java > Installed JREs > Add... page. It can also be added from the Package Explorer using the project's context menu.

An option to set compiler compliance to 11 on a Java project is also provided.

Quick fix to change project compliance and JRE to 11 A quick fix Change project compliance and JRE to 11 is provided to quickly change the current project to be compatible with Java 11.

Quick assist to add 'var' type to lambda parameters A new quick assist is provided that allows you to add var type to lambda parameters. This quick assist is only available if the project compliance is Java 11 or above.

Quick assist to replace lambda parameter types with 'var' A new quick assist is provided that allows you to replace lambda parameter types with var. This quick assist is only available if the project compliance is Java 11 or above.

Quick assist to replace 'var' in lambda parameter types with inferred types A new quick assist is provided that allows you to replace var with inferred lambda parameter types. This quick assist is only available if the project compliance is Java 11 or above.

Java Editor

Code Minings support in Java editor Java editor can now show the number of implementations and references for a Java element as decorative text (Code Minings) above the element.

  • This feature can be enabled in Preferences > Java > Editor > Code Minings:

  • The reference count includes the implementation count.

  • Clicking on references launches the search for references:

  • Clicking on implementations opens the Type Hierarchy view:

  • This is implemented using the Code Mining extension-point.

Quick assist to remove lambda parameter types A new quick assist is provided that allows you to remove lambda parameter types.

Extract local variable to var type When extracting to a local variable, an option to declare the local variable type as var has been provided. This option is only available if the project compliance is Java 10 or above.

When you select the highlighted option, the local variable type will be of type var.

Result:

Template to create module declaration The module-info.java file now offers a new template for the creation of a module declaration.

Java Views and Dialogs

New build path problem reported If a project which only has main source folders depends on a project which only has test source folders, a build path error is now reported. This can be disabled in Preferences > Java > Compiler > Building or in the corresponding project specific settings.

A quick fix Configure problem severity that opens this settings page is now offered for configurable build path problems reported in the problems view.

Disable completion insertion triggers A new option Disable insertion triggers except 'Enter' has been added to the Preferences > Java > Editor > Content-Assist page.

When this preference is selected, the pre-defined trigger characters to insert a completion proposal will be ignored while typing. Here, the proposal can be inserted by pressing Enter.

Disabling insertion triggers is usually convenient to avoid insertion of undesired proposals when the content assist pop-up is shown too often. For example, when too many characters are used as triggers for auto activation of code assist.

Convert Java 8 (or below) project to modular project You can now convert a project with compliance set to Java 8 or below to a modular project by selecting the Create module-info.java action from the context menu on the project.

When you select this action on a Java 8 (or below) project and if a JRE with version 9 or above is present in the workspace, then the following dialog appears.

The highest available JRE is selected and the compliance setting for the project is also updated accordingly. After this the Create module-info.java dialog opens.

Java Formatter

Keep braced code on one line Previously, the code formatter profile had a set of settings to control whether to put line breaks between empty braces of various kind. Now they have been replaced with more general settings that can additionally keep fragments of braced code on one line when they contain only one item (for example one statement in a code block) or when they have more items but can still fit in the maximum line width. The options can also be set to preserve existing state so that the user can decide on each case individually.

While previously there was only one setting for empty code blocks, now there are separate settings for loops, 'if then' statements and lambdas.

A special option to keep 'return' or 'throw' clause on one line in 'if then' statements is still available. Similarly, there's a new specific setting for simple getters and setters.

The settings can be found under New Lines > Keep braced code on one line in the Profile Editor (Preferences > Java > Code Style > Formatter > Edit...).

JUnit

JUnit 5.3.1 JUnit 5.3.1 is here and Eclipse has been updated to use it.
Quick assist to create JUnit test case You can now open the New JUnit Test Case wizard quickly by invoking Quick Assist (Ctrl+1) on a type declaration:

JDT Developers

Make JDT builder use null as scheduling rule By configuring the org.eclipse.jdt.core/useNullSchedulingRule preference to true, the JDT builder will use null as the scheduling rule instead of the workspace root. The preference can be changed using the Preferences APIs, or by editing the plugin_customization.ini file of your application.

This prevents the Java builder from locking the whole workspace. The user can continue to work in parallel and other builders can also run in parallel, which results in faster builds and faster UI feedback.

As of 4.10, this is considered as an experimental feature and is introduced mainly for testing purposes.

Previous Up Next

Back to the top