Monday, July 29, 2024 - 06:22

The latest version of the Eclipse IDE, 2024-06, improves the ease-of-use and performance of the IDE through the addition of new features, the removal of obsolete ones, platform improvements, and tweaks to existing features. 

Enhancements to Plug-In Development Environment

There are a few notable improvements to the Plug-in Development Environment (PDE) that streamline our editors and make them more efficient and easier to use.

First is the removal of unused attributes in the feature editor:

  • download-size
  • install-size
  • unpack
  • fragment

These attributes have been obsolete and without effect for a long time. By removing them, we’ve reduced the complexity of the editor and the size of the feature.xml file. Any existing attributes will be ignored and removed with the next modification through the editor.

We’ve also removed support for the fragment attribute in plugin elements. This attribute was also unused and unnecessarily increased the size of the .product file. It will be ignored and removed with the next modification through the editor.

Introduction of OSGi Repository Target Location

We’ve also added support for a new target location type, the OSGi repository. 

The OSGi Specification defines an XML format for representing a repository, as outlined in the Repository Service Specification. This format provides access to external resources based on their associated requirements and capabilities. Typically, such a repository contains a set of bundles and is analogous to a p2 update site.

By adding support for the OSGi repository to the toolset, the IDE facilitates more streamlined and efficient integration of the PDE with OSGi standard repositories, thereby improving the overall development workflow.

Updated Java Development Tools

There have been several noteworthy improvements to the Java Development Tools, full details of which can be found in the documentation. This includes the addition of support for the following Java 21 features:

Analysis of Resource Leaks Improved With Annotations in Java Compiler

The compiler’s ability to identify improperly closed resources (implementations of AutoCloseable) has been enhanced. 

Flow analysis for resource leaks previously focused only on resources created and closed within the same method, struggling with those shared across different methods or objects. Now, with the introduction of the @Owning annotation, the compiler analyses resource data flows using two key concepts:

  • Resource Source, which allocates a resource within the current method and assumes responsibility for its closure.
  • Resource Sink, which refers to where a resource is consumed, either through closure or delegation to other code that assumes responsibility thereafter.

Consistent Line Positioning in Java Formatter

Switch statements and arrow expressions can now be aligned uniformly, ensuring all arrows are positioned consistently in line. 

To configure this feature, access the formatter profile editor and locate the setting under Indentation > Align items in columns > Arrows in switch statements/expressions. This option enables precise alignment of arrows, enhancing code readability and structure within switch statements and arrow expressions in your Java codebase.

 

Formatter options and code preview

Progress Indication Added to JUnit

Progress indication in the form of a progress dialog and progress bar has been introduced to JUnit Run/Debug configurations. 

When referencing a test method, a search process previously causing UI freezes now includes a progress dialog, alleviating delays during initial opening of the Run/Debug Configurations dialog. If the user cancels the search, a notification will appear in the notification area of the Run/Debug Configurations dialog. Additionally, the text field “Test method:” will be disabled, and the “Run/Debug” button will also be disabled. However, the “Search...” button next to “Test method:” will remain enabled and can be used to initiate the search again. 

Hover to Reveal Values of Constants in Java Editor

A new hover feature now reveals the values of integer or float constants specified in binary, octal, or hex formats. When hovering over such constants, it displays their decimal values followed by their hexadecimal equivalents.

To enable the hover, go to the Java > Editor > Hovers preference page. You can activate it by choosing the Combined Hover option or selecting the Java Constant checkbox.

Example of Java Constant Hover

Cleanup Improvements for Converting to, and Cleaning Up, Lambdas

Several Java cleanup improvements now focus on converting to lambdas and simplifying existing ones. Notably, the “Convert functional interface instances” preference in Java 8’s Features tab now includes “Simplify method reference syntax for lambda conversions.” Enabled by default, it promotes method reference syntax in cleanup processes converting from anonymous classes. Disabling it avoids potential runtime NullPointerExceptions, requiring users to select “Simplify lambda expression and method reference syntax” on the Code Style tab for method reference usage. 

Quick fixes for converting anonymous classes also favour method reference syntax by default. 

Another improvement in lambda cleanups and quick fixes is the recognition that the use of `instanceof` can be replaced with a method reference to `isInstance.’ For example, with this feature enabled, the following code: 

 

Lambda Cleanup Example Before

 

Will automatically convert to:

Lambda Cleanup Example After

 

The new Quick Fix feature can be used for several other purposes as well, including to:

  • Add the missing default case to an enhanced switch statement.
  • Insert the break statement in cases where there is an illegal fall-through to a pattern in a switch statement.

Replace Deprecated Method Calls With Quick Fix and New Cleanup Method

A new cleanup option has been added to the Source > Clean Up > Source Fixing tab to replace deprecated method calls with in-lined content. When selected, this option will inline the implementation of a deprecated method under specific conditions:

  • The deprecated method has Javadoc with a @deprecated tag ending with “use {@link ...}” or "replace by {@link ...}".
  • The {@link ...} tag references another method.
  • The referenced method is invoked in the deprecated method’s implementation.
  • Methods and fields accessed within the referenced method are visible at the location where it will be in-lined (e.g., using a package-private method is acceptable if both are in the same package).

Quick Assist Added for Renaming Constant Fields

We’ve also added a new quick assist feature to rename static constant fields to follow a standard syntax using upper-case and underscores rather than camel case. This can be used by selecting the constant and clicking CTRL+1. 

New “Make Static” Refactoring for Converting Instance Methods to Static Ones

A new refactoring called “Make Static” for converting instance methods to static ones where applicable has been added. This allows an extra parameter to handle instance references like fields or methods that were used within the original method. Calls to the method are adjusted accordingly, passing either “this” or “the” specific instance as needed.

Conditions for applying this refactoring include:

  • The method is not a constructor.
  • It does not override or is overridden by methods in parent or child types.
  • The method’s type is not local, anonymous, or an annotation.

To execute, simply select a method invocation, excluding super method invocations.

 

Platform Improvements to IDE Resolve Confusion and Add Features

The Eclipse IDE platform itself has also been improved to address some inconsistencies and clear up some confusing formatting, and we’ve added a few new features. 

First, the Features tab has been enhanced with a filter field, making it much easier for users to search for and find detailed information about specific features. Previously, the Features tab within the Installation Details dialog didn’t have a filter field, a feature that is present in the dialog’s Plug-ins tab, making it more challenging to locate specific feature details.

The Eclipse IDE launch dialog will now also alert users about an unresolved character when they enter the tilde (~) character to represent their home directory, as is done in many operating system shells. The dialog window will display the fully resolved path within a label to provide clear and immediate insight into the exact path being referenced. This will help avoid potential confusion and ensure accurate path specification.

Search terms are also now displayed alongside the “Quick Search” label in the title bar of each dialog. Previously, every quick search instance was uniformly labelled quick search, making it challenging to distinguish between them. Now each window is uniquely identifiable, enhancing navigation and user clarity. 

Support Added for Incremental View Updates 

In Eclipse IDE, views are panels that display specific information or allow interaction with different aspects of a project. Users can customize their layout and content to suit their workflow preferences.

When SWT/JFace attempts to render extensive numbers of elements, it often reaches the limits of the native widget infrastructure, resulting in sometimes minutes-long freezes.

With the latest version of the Eclipse IDE, most of the frequently used views, including Package Explorer, Project Explorer Problems, Java Outline, and Junit, now support incremental view updates to address issues with UI freezes in large viewers. 

These views restrict the initial display of children to 1000 per parent element and allow for additional elements to be shown incrementally. Users can adjust the increment number in the preferences menu under General > Initial maximum number of elements shown in views.

Compare Editors Displays Difference Count Between Files

The compare editor toolbar in Eclipse IDE now displays the count of differences between two files next to the scroll bar. This functionality is very helpful when dealing with large files containing numerous changes that would be cumbersome to tally manually.

 

A screenshot of a computer  Description automatically generated

Automatic Configuration for Windows Defender

Eclipse IDE-based applications may experience slowed startup and overall performance due to Microsoft Defender on Windows 10 systems or later. The Eclipse IDE now detects active Microsoft Defender instances, notifies users, and offers the option to exclude itself from future Defender scans for smoother operation.

On Windows, the General -> Startup and Shutdown preference page provides additional information and allows users to disable the startup check for new installations. It also enables users to rerun the exclusion check for the current installation.

Users of custom Eclipse IDE-based products can use the org.eclipse.ui.ide.workbench application to suppress the new startup check. To do this, add the following entry to the product’s preferenceCustomization properties file: org.eclipse.ui/windows.defender.startup.check.skip=true.

Learn More and Contribute to the Eclipse IDE

To learn more about these and other improvements in the Eclipse IDE over the past year and download the latest version, visit the Eclipse IDE webpage.

If you are interested in contributing to Eclipse IDE, you can kickstart your journey as an open source contributor with the guidance of our dedicated mentors. Join us in Eclipse IDE Matrix Chat Room to connect and collaborate!

About the Author

Alshama M S

Alshama M S

Alshama M S is a software developer at IBM, who is a part of the Eclipse SDK Project and working in the Plug-in Development Environment team.

Elsa Zacharia

Elsa Zacharia

Elsa Zacharia is a software developer at IBM, working under the SWT component of the Eclipse IDE Project.

Suby Surendran

Suby Surendran

Suby is a software engineer at IBM and is currently working as Eclipse JDT Contributor with a focus on Java Debugger.