The Eclipse 2023-06 (4.28) was recently released and numerous improvements have been made over the past year: too many to cover in one article. Here we will cover the most notable improvements based on the New and Noteworthy content for Eclipse IDE releases 4.25 to 4.28.
Eclipse Platform Enhances Searches, Security, and Quality of Life
Five notable improvements have been made that are explained below:
- Open Resource dialog now defaults to substring search
- Text editor improvements
- Security improvements
- Launch/Debug context menus directly show relevant launch configurations
- Selected tab in a CTabFolder now has a highlighted bar
Open Resource Dialog Defaults to Substring Search
Searches in the Open Resource dialog will now be searched anywhere in the file name. This means that while searching from the middle of a file name, you no longer need to include a leading asterisk (“*”).
Simply add a leading angle bracket (“>”) to the search pattern to enforce the previous behavior of matching only prefixes.
Text Editor Improvements
Several improvements have also been made to the text editor.
Onboarding Information Displayed in Editor Section
When there is no editor open, the editor section now displays the most significant, helpful commands and their key binding as shown below.
Word Wrap Default Preference
In the General > Editors > Text Editors page, a new preference has been added to specify that word wrap should be enabled when opening text editors while the default setting is disabled.
Security Improvements
There have also been some efforts to address known security vulnerabilities in the Eclipse IDE.
Man-in-the-Middle Vulnerability Addressed
To address the man-in-the-middle vulnerability — CVE-2021-41033 — all access to external update sites and their artifacts is forced to use the https protocol, even when http is specified.
To return to the previous behavior, add the line “Dp2.httpRule=allow” as the last line of the eclipse.ini. This can be relevant inside a corporate environment where the firewall may introduce certificates into the network traffic that are not recognised by the Java runtime. It can be used to prevent “PKIX path validation failed” exceptions that can otherwise only be resolved by importing the firewall certificate into the Java runtime's cacerts.
IDE Now Tracks Trusted Hosts
To address a security vulnerability allowing arbitrary metadata to be used without any notification to the user — CVE-2021-41037 — all access to external update sites and their artifacts is monitored and reported during installation, so users are aware of the content’s source and can choose whether to trust it. Simply installing content, even without installing any associated artifacts, can reconfigure the installation, which could potentially be used for malicious purposes. To resolve this, a “Trust Authorities'' dialogue that displays the sites that have been contacted, information about those sites, and information about the specific material that is being installed from each site is displayed whenever new content or updates are being installed.
Artifacts Signed With Revoked Keys Treated as Suspicious
If a PGP key is compromised, the key may be revoked. Artifacts signed before the revocation date are generally still valid, but an attacker can create back-dated signatures. Therefore, any artifact signed with a revoked key, and any internal exception that occurs while processing the revocation information of the key, will result in that artifact being treated as a suspicious artifact, leading to a “Trust Artifacts” prompt.
Untrusted Artifact Will No Longer Be Cached
The “Trust Artifacts” dialog’s handling of the “Cancel” option has been changed as an additional security measure. If you choose to reject the content, such as by pressing Cancel or closing the dialog, any of the prompted artifacts that have been downloaded during the current install or update operation will be removed from the disk. This avoids caching of untrusted artifacts.
Shortcuts Replaced by Resolved Launches
In the “Run As/Debug As” context-menus, the shortcuts that can resolve directly to one or more launch configurations (i.e., which implement “ILaunchShortcut2”) are replaced by the resolved launch directly.
Highlighted Bar Added to CTabFolder
To easily identify the currently selected tab in a CTabFolder, it now has a highlighted bar.
Updated Java Support, Quick Fixes, and More JDT Improvements
The following are some of the latest features in JDT:
- Support for new Java versions
- JUnit quick fixes and feature additions
- New quick fixes and quick assists
- Code Assist Support
- New Cleanups
Support for New Java Versions
Improved Java 19 support includes the following Java 19 features:
- JEP 405:Record Patterns (Preview)
- JEP 427: Pattern Matching for Switch (Third Preview)
- JEP 425: Virtual Threads (Preview)
- JEP 428: Structured Concurrency (Incubator)
Improved Java 20 support includes the following Java 20 features:
- JEP 429: Scoped Values (Incubator)
- JEP 434: Foreign Function & Memory API (Second Preview)
- JEP 438: Vector API (Fifth Incubator)
JUnit Quick Fixes and Feature Additions
The New JUnit Test Suite Wizard has been improved to now support the creation of a JUnit 5 test suite using the “@Suite” annotation. Go to New > Other > Java > JUnit > JUnit Test Suite to launch the New JUnit Test Suite Wizard for the current package. The wizard appears as follows:
The result of this is:
The Launch JUnit tests in subpackages functionality has been enhanced. Now, JUnit tests in sub packages will be found by the JUnitLauncher and launched as well.
For example, in the following project, selecting the package test and right-clicking to “Run as > JUnit Plug-in Test” will result in:
New Quick Fixes and Quick Assists
The Source menu now offers quick assists for a class, making certain existing actions readily accessible. These helpful actions include generating getters and setters, “hashCode()” and “equals()” methods, as well as the “toString()” method.
Each action will bring up a dialog for the user to make additional specifications (e.g., which fields to use). To use the quick assist, select a class and specify “CTRL+1”.
Code Assist Support for Inline Tags
We’ve also added support for inline tags in the Eclipse IDE.
As of Java 16, the Javadoc “@return” tag can be specified as an inline tag (with curly braces), allowing it to generate method descriptions and Returns sections simultaneously. Using {@return <return description>} syntax, the Javadoc displays “Returns <return description>” for the method’s main description and in the Returns section. Eclipse now recognizes this inline tag, ensuring accurate Javadoc hover.
For details on the inline @return tag, see: Javadoc Comment Spec.
New Cleanups
There have also been some new cleanups added to the Eclipse IDE.
Convert While Loops to Enhanced for Loops
The cleanup to convert to enhanced for loops has, where possible, been improved. It will now convert eligible “While” statements that use an iterator into enhanced for loops.
With cleanup, the following:
is now changed to:
Convert to Switch Expression
The enhanced cleanup feature in Eclipse now recognizes switch statements where each case ends with either a return statement or an exception throw. In such cases, the switch statement is automatically converted into a return of a switch expression. This improvement simplifies code and promotes cleaner and more efficient switch statement usage.
With the cleanup, the following:
is changed to:
Debug Improvements to Popups and Name Preferences
There are also two significant improvements to debug in the Eclipse IDE.
Clicking Items Now Navigates to Declaration in Editor
An improvement has been made to the “All References” and “All Instances” popups. Clicking on items now attempts to open and navigate to the declaration in the editor if the source code is available. This enhancement facilitates faster code navigation and exploration.
New Launch Config Name Preference
A new set of preferences has been added to specify that the launch configuration name generated uses the fully qualified typename. Once set, new configurations can either be manually created in the “Run Configurations” or “Debug Configurations” dialogs, or automatically generated by specifying “Run as...” or “Debug as...” from the context menu, which will qualify the generated name. Existing configurations are not altered.
To specify the new preferences, go to Preferences > Java > Launching.
Launching a Java application results in:
Eclipse PDE Improvements Add Numerous Enhancements
Some of the notable improvements in PDE include:
- Support for the OSGi bundle and OSGi versioning annotations
- Support for automatic manifest generation
- Support for auto-completion for build.properties file
- Support for schema and feature compilers for project-specific preferences
Support for OSGi Bundle and OSGi Versioning Annotations
PDE now supports the usage of OSGi bundle and OSGi versioning annotations to be used in a plug-in Project. To enable the annotations, you only need to add them to the target platform, such as by using the following locations:
It should be mentioned that directory locations and update sites are also accepted. For example, you can now use these annotations on a package-info.java file or on an interface. They can then be processed by other tools, such as BNDor Tycho. PDE now also supports the “@Export and @Version” annotations if they are put on a package-info.java file. The MANIFEST.MF is then updated as shown below:
The same works for “@Header” annotation—adding it results in an extra header being added to the MANIFEST.MF:
Support for Automatic Manifest Generation
Eclipse PDE now supports generating the manifest automatically. Create a new plug-in project and select the standard OSGi framework type, then select “Generate OSGi metadata automatically.”
Review and adjust the usual settings like name and version as needed, then finish the wizard to create the project:
Support for Auto-Completion for “build.properties” File
Eclipse PDE now supports auto-completion of keys in the “build.properties” file. Users no longer need to remember the complete words in the “build.properties” header specification. Now, they can simply start typing as much as they know and use the auto-completion key bindings (usually “ctrl+space”) to obtain the list of potential valid headers that match the user's intent:
Support for Schema and Feature Compilers for Project-Specific Preferences
PDE now supports all available compilers for project preferences. Previously, the project specific preferences property page contained only the plug-in, or manifest, compiler, while the schema and feature compiler settings were available in the workspace-wide settings. This restriction has now been removed and all the compiler settings are available for project-specific settings as well:
Learn More and Download the Eclipse IDE
To learn more about these and other improvements to the Eclipse IDE over the past year and to download the latest version, visit the Eclipse IDE webpage.
Don't forget to save this link into your bookmarks and share it with your friends.