Java™ 17 Support |
|
Java 17 |
Java 17 is out and Eclipse JDT supports Java 17 in 4.22.
The release notably includes the following Java 17 features:
Please note that preview option should be on for preview language features. For an informal introduction of the support, please refer to Java 17 Examples wiki. |
JUnit |
|
Support execution of JUnit tests that are records |
For Java 16 and up, JUnit tests can now be implemented as records. Right-clicking on an individual test or the record itself and selecting Run as will allow executing the test via either the JUnit Plug-in Test or JUnit Test context menu choices.
The following is an example of such a test: |
JUnit 5.8.1 | JUnit 5.8.1 is here and Eclipse JDT has been updated to use this version. |
JUnit 4.13.2 | JUnit 4.13.2 is here and Eclipse JDT has been updated to use this version. |
Java Editor |
|
Convert String concat to Text block |
A new cleanup and quick-assist has been added to convert appropriate String concatenations into Java Text Blocks. Appropriate String concatenations must have at least 3 non-empty substrings with one per line and the Java level must be 15 or higher. Line comments for all substrings but the last line will be lost after conversion. Spaces at the end of substrings preceding the newline will result in \s being substituted while substrings that do not end with newlines will have a \ added at the end of the line to preserve concatenation.
To apply the cleanup, select the Convert String concatenation to Text Block checkbox on the Java Feature tab in your cleanup profile: With the cleanup, the following: Is changed to: To change a single String concatenation, a quick-assist has been added that can be activated with CTRL+1 with the cursor located anywhere in the appropriate concatenation. |
Surround with try-with-resources quickfix |
A new quickfix has been created to offer Surround with try-with-resources for resource leaks and potential resource leaks when the resource in question implements AutoCloseable.
Examples of quickfix: |
Java Views and Dialogs |
|
Improved lambda support in the Call Hierarchy view |
The Call Hierarchy view is enhanced with showing not only the callers of the lambda function, but the callers of the declaring function too.
For the following code: Checking the callers of the function() will show this: The [declaration] node in the tree is the new addition, which shows the callers of the definer() function, in this case, only the main() function. |
Paste into Open Type dialog |
If text is pasted into the Open Type dialog then it is automatically cleaned up to the included type name by best effort. The heuristics support:
|
Debug |
|
Label Objects during debugging |
During debugging a Java application, often we have to deal with lot's of object instances, and it's not always easy to distinguish between them.
That's why the experience is improved, with the ability to set a label on individual objects.
After setting a label, everywhere the object appears it is displayed with a distinctive color and with the label: |