Skip to main content

Java development tools

New Java™ Language Features

Java Language Features

The release notably includes the following Java features:
JEP 440: Record Patterns.
JEP 441: Pattern Matching for Switch.

Java Editor

Quick Fix to add default case You can use the new Quick Fix (Ctrl+1) to add the missing default case to an enhanced switch statement. For example,

add default case quick fix

will result in:

result of add default case quick fix

Quick Fix to remove default case You can use the new Quick Fix (Ctrl+1) to remove the default case when it is present with unconditional pattern in a switch. For example,

remove default case quick fix

will result in:

result of remove default case quick fix

Quick Fix to insert break statement You can use the new Quick Fix (Ctrl+1) to insert the break statement when there is an illegal fall-through to a pattern in a switch statement. For example,

insert break statement quick fix

will result in:

result of insert break statement quick fix

Cleanup and quick fix to replace deprecated method calls A new cleanup has been added to the Source > Clean Up > Source Fixing tab page to replace deprecated method calls with inlined content. Choosing this option will inline the implementation of the deprecated method if and only if:
  1. The deprecated method has Javadoc that specifies a @deprecated tag which ends with "use {@link ...}" or "replace by {@link ...}"
  2. The {@link ...} tag refers to a method
  3. The linked method is actually called in the implementation of the deprecated method
  4. Methods and fields accessed in the linked method are visible at the location it will be inlined (e.g. using a package private method is ok to call if in same package)
For example, cleaning up the following:

deprecated method call to inline

will result in inlining the deprecated foo() call in foo2:

result of deprecated method call inline

The functionality is also available as a quick fix for an individual call to a deprecated method that is marked with warning or error. One can also select a deprecated method call and initiate as a quick assist (select call and click CTRL + 1).

Quick assist to rename constant fields A new quick assist has been added to rename static constant fields to follow a standard syntax using upper-case and underscores rather than camel case. To use: select the constant and click CTRL+1. For example,

rename constant quick assist

will offer to rename the constant "valConstant1" to "VAL_CONSTANT1".

JDT Developers

Pushdown of refactors and proposals to jdt.manipulations A significant amount of code was pushed down from org.eclipse.jdt.ui into org.eclipse.jdt.core.manipulations, specifically most of the proposal and refactor operations. This will allow these operations to be used in a headless environment.

Previous Up Next

Back to the top