Skip to main content

Java development tools

Java 13 Support

Java 13 Java 13 is out and Eclipse JDT supports Java 13 for 4.13 via Marketplace.

The release notably includes the following Java 13 features:
JEP 354: Switch Expressions (Preview).
JEP 355: Text Blocks (Preview).

Please note that these are preview language feature and hence enable preview option should be on. For an informal introduction of the support, please refer to Java 13 Examples wiki.

Java Views and Dialogs

Synchronize standard and error output in console The Eclipse Console view currently can not ensure that mixed standard and error output is shown in the same order as it is produced by the running process. For Java applications the launch configuration Common Tab now provides an option to merge standard and error output. This ensures that standard and error output is shown in the same order it was produced but at the same time disables the individual coloring of error output.

Differences between merging enabled and disabled

Java Editor

Convert to enhanced 'for' loop using Collections The Java quickfix/cleanup Convert to enhanced 'for' loop is now offered on for loops that are iterating through Collections. The loop must reference the size method as part of the condition and if accessing elements in the body, must use the get method. All other Collection methods other than isEmpty invalidate the quickfix being offered.

for loop using Collections before

for loop using Collections quickfix

for loop using Collections after

Initialize 'final' fields A Java quickfix is now offered to initialize an uninitialized final field in the class constructor. The fix will initialize a String to the empty string, a numeric base type to 0, and for class fields it initializes them using their default constructor if available or null if no default constructor exists.

unitialized final field before

final field initialized in constructor

Autoboxing and Unboxing Use Autoboxing and Unboxing when possible. These features are enabled only for Java 5 and higher.

Improved redundant modifier removal Remove redundant modifier now also removes useless abstract modifier on the interfaces.

For the given code:

You get this:

Javadoc comment generation for module Adding a Javadoc comment to a Java module (module-info.java) will result in automatic annotations being added per the new module comment preferences.

Javadoc module comment preferences

The $(tags) directive will add @uses and @provides tags for all uses and provides module statements.

Javadoc module comment example

Chain Completion Code Assist

Code assist for "Chain Template Proposals" will be available. These will traverse reachable local variables, fields, and methods, to produce a chain whose return type is compatible with the expected type in a particular context.

The preference to enable the feature can be found in the Advanced sub-menu of the Content Assist menu group (Preferences > Java > Editor > Content Assist > Advanced) .

Chain completion code assist

Java Formatter

Remove excess blank lines All the settings in the Blank lines section can now be configured to remove excess blank lines, effectively taking precedence over the Number of empty lines to preserve setting. Each setting has its own button to turn the feature on, right next to its number control. The button is enabled only if the selected number of lines is smaller than the Number of empty lines to preserve, because otherwise any excess lines are removed anyway.

Changes in blank lines settings There's quite a lot of changes in the Blank lines section of the formatter profile.

Some of the existing subsections and settings are now phrased differently to better express their function:

  • The Blank lines within class declarations subsection is now Blank lines within type declaration
  • Before first declaration is now Before first member declaration
  • Before declarations of the same kind is now Between member declarations of different kind
  • Before member class declarations is now Between member type declarations
  • Before field declarations is now Between field declarations
  • Before method declarations is now Between method/constructor declarations

More importantly, a few new settings have been added to support more places where the number of empty lines can be controlled:

  • After last member declaration in a type (to complement previously existing Before first member declaration setting)
  • Between abstract method declarations in a type (these cases were previously handled by Between method/constructor declarations)
  • At end of method/constructor body (to complement previously existing At beginning of method/constructor body setting)
  • At beginning of code block and At end of code block
  • Before statement with code block and After statement with code block
  • Between statement groups in 'switch'

Most of the new settings have been put in a new subsection Blank lines within method/constructor declarations.

JUnit

JUnit 5.5.1 JUnit 5.5.1 is here and Eclipse JDT has been updated to use this version.

Debug

Enhanced support for --patch-module during launch The Java Launch Configuration now supports patching of different modules by different sources during the launch. This can be verified in the Override Dependencies... dialog in the Dependencies tab in a Java Launch Configuration.

Java Build

Full build on JDT core preferences change Manually changing the settings file .settings/org.eclipse.jdt.core.prefs of a project will result in a full project build, if the workspace auto-build is on. For example, pulling different settings from a git repository or generating the settings with a tool will now trigger a build. Note that this includes timestamp changes, even if actual settings file contents were not changed.

For the 4.13 release, it is possible to disable this new behavior with the VM property: -Dorg.eclipse.disableAutoBuildOnSettingsChange=true. It is planned to remove this VM property in a future release.

Previous Up Next

Back to the top