Featured image: New features in CodeReady Studio and JBoss Tools

JBoss Tools 4.17.0 and Red Hat CodeReady Studio 12.17 for Eclipse 4.17 (2020-09) are now available. For this release, we focused on improving Quarkus and container-based development and fixing bugs. We also updated the Hibernate Tools runtime provider and Java Developer Tools (JDT) extensions, which are now compatible with Java 15. Additionally, we made many changes to platform views, dialogs, and toolbars in the user interface (UI).

Keep reading for an overview of what's new in JBoss Tools 4.17.0 and CodeReady Studio 12.17 for Eclipse 4.17 (2020-09).

Installation

First, let's look at how to install these updates. CodeReady Studio (previously Red Hat Developer Studio) comes with everything pre-bundled in its installer. Download the installer from the Red Hat CodeReady Studio product page and run it as follows:

$ java -jar codereadystudio-<installername>.jar

Installing JBoss Tools 4.17.0—aka "bring-your-own Eclipse (BYOE) CodeReady Studio"—requires a bit more effort. This release requires at least Eclipse 4.17 (2020-09), but we recommend installing the latest Eclipse 4.17 2020-09 Java EE bundle. Installing the newest bundle ensures that you get the most current Java dependencies.

Once you have Eclipse 4.17 (2020-09) or higher installed, you can open the Eclipse Marketplace tab and look for either JBoss Tools or Red Hat CodeReady Studio. Alternatively, you could download JBoss Tools 4.17.0 directly from our update site.

We'll look at updates for the new Red Hat OpenShift 4.6 release and improvements to Quarkus and container-based development in the next sections. We'll also look at updates to the Hibernate Tools runtime provider and the Java Developer Tools package for JDK 15.

JBoss Tools supports Red Hat OpenShift 4.6

JBoss Tools is transparently compatible with the new Red Hat OpenShift 4.6 release. Just define your connection to your OpenShift 4.6-based cluster, as you did before for an OpenShift 3 cluster. You will then be able to use the new tooling.

YAML file configuration in Quarkus

Quarkus now supports YAML configuration files. If you want to use YAML files to configure your Quarkus applications, do the following:

  1. Create a Quarkus project using the new Quarkus wizard.
  2. Create a new application.yaml or application.yml next to the application.properties in src/main/resources.

The editor will open with content assist and syntax validation for the YAML format.

See the Quarkus documentation for more information.

A new server adapter for WildFly 21

We added a server adapter to work with WildFly 21. The new server adapter supports Java EE 8, Jakarta EE 8, and Microprofile 3.3.

Hibernate runtime provider updates

We updated the Hibernate runtime providers as follows:

  • The Hibernate 5.4 runtime provider now incorporates Hibernate Core version 5.4.21 Final and Hibernate Tools version 5.4.21 Final.
  • The Hibernate 5.3 runtime provider now incorporates Hibernate Core version 5.3.18 Final and Hibernate Tools version 5.3.18 Final.

Views, dialogs, and toolbars

We've made several updates to improve views, dialogs, and toolbars in the user interface. I will detail those in the next sections.

Adjustable view fonts

You can use the new Tree and Table font for views preference to customize the font used for tree and table views. To find the new preference, navigate to Window > Preferences > General > Appearance > Colors and Fonts, and open the View and Editor Folders category. Figure 1 shows the dialog to select font preferences.

The Project Explorer with the 'Tree and Table font for views' option highlighted.
Figure 1: Set a font preference for trees and tables.

Figure 2 shows the Project Explorer with the font preferences set.

The Project Explorer with custom font preferences.
Figure 2: Custom font preferences in the Project Explorer.

GIFs removed from views

Several years ago, we migrated the icons for platform views to PNG files. Views that are already open store their reference to the image, so we left the GIF files in the code. We've now removed these files. If you have been using the same workspace for years, you might find yourself missing view icons. Close and reopen the view to refresh the icons.

No exit confirmation dialog

By default, Eclipse now automatically closes if you select the close icon on the last window. There is no additional confirmation dialog. If you want to get a confirmation dialog, you can enable it via Window > Preferences > General > Startup and Shutdown > Confirm exit when closing last window.

No new conversions for workbench models created before 2014

We've made a change to workbench models (workbench.xmi) that are stored in workspaces created with a release before 2014. If you have never opened the workbench model with a later release, it will not be automatically converted when you open it with the 2020-09 release.

Text editors

This release includes several new options in the text editor preferences.

Improved 'last edit' navigation

We've replaced the Last Edit Location navigation option with Previous Edit Location, which remembers 15 previous edit locations. We've also merged similar edit locations that are near each other so that each of the 15 remembered locations remains distinct. Figure 3 shows the navigation with the new Previous Edit Location and Next Edit Location options highlighted.

The navigation now displays Previous Edit Location and Next Edit Location options.
Figure 3: The new Previous Edit Location and Next Edit Location navigation options.

We've also added two new keyboard shortcuts to help you navigate to previous and next edit locations.

Previous edit location

Enter Ctrl+Alt+LEFT_ARROW (or, on a Mac, Ctrl+Opt+LEFT_ARROW) to navigate to the most recent edit location. This new navigation works the same way that Ctrl+Q always has in prior releases. Now, however, you can traverse the history of prior edit locations by holding down Ctrl+Alt and pressing the LEFT_ARROW. Each time you press the LEFT_ARROW, you move a step further back in the edit history. When you stop the traversal, future Ctrl+Alt+LEFT_ARROW actions are temporarily anchored to this historical location for easy exploration of that code region.

We enhanced the classic Ctrl+Q mapping enhanced with this new functionality, as well, so that Ctrl+Q and Ctrl+Alt+LEFT_ARROW are synonymous.

Next edit location

The Ctrl+Alt+RIGHT_ARROW (or, on a Mac, Ctrl+Opt+RIGHT_ARROW) navigation moves the anchor forward through your edit history. Just as you traverse backward with the LEFT_ARROW button, you can go forward by holding Ctrl+Alt and pressing the RIGHT_ARROW button. We also added a new menu item for this forward navigation.

Note: New edit locations are always inserted at the end of your file, so the original historical ordering is maintained. New edits also reset the last location anchor to the most recent edit. Thus, pressing Ctrl+Alt+LEFT_ARROW always brings you to the most recent edit rather than a historical one.

Date and timestamp on printed page headers

As shown in Figure 4, the editor now includes the current date and timestamp along with the filename in the header of each printed page.

A page with the date of Wednesday July 8, 2020, 6:36 PM.
Figure 4: A date has been added to the file header for printed pages.

Themes and styling

We've made several updates to improve themes and styling in the new JBoss Tools 4.17 and Red Hat CodeReady Studio 12.17 releases.

The GTK light theme has been updated

We updated the GTK (Gnome) toolkit's light theme to align with the default GTK 3 Adwaita theme. Figure 5 shows the old theme.

An Eclipse SDK workspace with the old GTK light theme.
Figure 5: The old GTK light theme.

Figure 6 shows the new GTK 3 Adwaita theme.

The Eclipse SDK workspace with the new theme.
Figure 6: The new GTK 3 Adwaita light theme.

A new default style for SWT under Windows

We've set the dark theme as the default for Eclipse's Standard Widget Toolkit (SWT) under Windows. This change affects menus and dropdown boxes and comes with a new selection highlighter.

Menus and dropdown boxes

The dark theme is the new native style for SWT menus under Windows. Figure 7 shows the Window menu in the new style.

The Window dropdown box with navigation options in the dark theme.
Figure 7: The Project Explorer with the new dark theme.

Figure 8 shows the Search menu.

A dropdown window shows available Java classes in the project.
Figure 8: The Search menu with the new dark theme.

SWT dropdown boxes also default to the dark theme, as shown in Figure 9.

A dropdown with the dark theme selected.
Figure 9: The dark theme is selected as the default.

The new selection highlighter

As shown in Figure 10, the active tab selection highlighter makes it easy to identify which tab is active when using the dark theme.

The active tab is highlighted on a dark background.
Figure 10: Active tab selection in the dark theme.

SWT also natively supports the selection highlighter for tables, as shown in Figure 11.

A table highlighted with a blue border on a dark background.
Figure 11: Tables are also highlighted.

Debugging

We've made one update to the general debugging features for this release.

Filter null bytes from console output

We extended the interpretation of ASCII control characters so that you can now filter null bytes in the console view. The view recognizes the characters \0 as a null byte. If interpretation is enabled, any null byte will be stripped and not shown in the console. This is most relevant for Linux, where a null byte in the console view prevents anything after it on the same line from being rendered. This feature is disabled by default; you can enable it on the Run/Debug > Console preference page.

Note: Binaries for Linux AArch64 (Arm64) are now available for testing. With this architecture's rising popularity, people can continue using the Eclipse IDE even when changing their machine.

Java Development Tools (JDT)

This release updates the Java Development Tools suite for Java 15, adds two new features to improve the JUnit view, and brings new optimization features to the Java editor.

Java 15

Eclipse JDT now supports Java 15 for Eclipse 4.17 via the Eclipse Marketplace. We've added these notable Java 15 features:

  • JEP 378: Text blocks (standard)
  • JEP 384: Records (second preview)
  • JEP 375: Pattern matching for Instanceof (second preview)
  • JEP 360: Sealed classes (preview)

Note that the Preview option should be on if you want to access preview language features. For an informal introduction to the new Java 15 features, see the Java 15 Examples wiki.

Updates in the JUnit view

We added two new features to improve the developer experience with JUnit in JDT.

Collapse all nodes

A new context-menu option allows you to collapse all nodes in the JUnit view, as shown in Figure 12.

Collapse All is highlighted in a dropdown list.
Figure 12: The new Collapse All option.

Sort test results by execution time

By default, test results are sorted by execution order, but you now have the option to sort results by execution time. Choosing Sort By > Execution Time from the JUnit View menu reorders the results after all the tests are complete. While tests are still running, they will be shown in the execution order, as shown in Figure 13.

JUnit tests shown in order of execution
Figure 13: JUnit tests shown in order of execution.

Figure 14 shows the view after sorting by execution time.

A list of JUnit tests sorted by execution time.
Figure 14: Tests sorted by execution time.

Improvements to the Java editor

We've added numerous features and small improvements to JDT's Java editor.

Substring/subword matches for types

The Content Assist feature now fully supports both substring and subword matches for types, as shown in Figure 15.

Content Assist returns matches for the search term 'linkedqueue'.
Figure 15: Content Assist supports substring and subword matches.

Substring matches are always shown. You can enable or disable subword matches with the existing Show subword matches option on the Java > Editor > Content Assist preference page.

Optimization tab

The lazy operator cleanup and the regex precompiler cleanup are now under the same tab, as shown in Figure 16. Both of these cleanups optimize time performance.

Both cleanups are under the optimization tab.
Figure 16: Two cleanups are available and selected under the Optimization tab.

Selecting the Precompile reused regular expressions option replaces certain usages of java.lang.String with java.util.regex.Pattern. To ensure that this cleanup only happens to strings being used as a regular expression, you must explicitly use the regular expression several times before the cleanup will execute. Otherwise, nothing happens.

Figure 17 shows a code snippet before running the Precompile reused regular expressions cleanup.

The 'MyClass' class before cleanup.
Figure 17: A Java class before cleanup.

After cleanup, the code looks like the snippet in Figure 18.

Class MyClass after replacing reused instances of java.lang.String with java.util.regex.Pattern.
Figure 18: The same Java class after cleanup.

To select this cleanup, navigate to Source > Clean Up and use a custom profile. Open the Configure dialog and select Precompile reused regular expressions on the Optimization tab.

Objects.equals()

Another new cleanup uses Objects.equals() to implement the equals(Object) method. This cleanup reduces code and makes the code easier to read. It is only available for Java 7 or higher. Although this kind of comparison is almost exclusively seen in the equals(Object) method, it can also reduce code in other methods.

To select the cleanup, navigate to Source > Clean Up and select a custom profile. On the Configure dialog, select Use Objects.equals() in the equals method implementation on the Unnecessary Code tab. Figure 19 shows the Use Objects.equals() cleanup option with a preview.

The cleanup selection and code preview are shown.
Figure 19: This cleanup replaces  equals(Object) instances with Objects.equals().

Figure 20 shows MyClass.java before cleanup.

A code sample in the editor window.
Figure 20: The sample Java class before cleanup.

After cleanup, you would get the code shown in Figure 21:

The code sample in the editor.
Figure 21: The cleaned-up Java class.

String.format quickfix

A new quickfix replaces string concatenation with String.format, similar to the existing ones for StringBuilder and MessageFormat, as shown in Figure 22.

The new quickfix option in a dropdown list, with a code preview on the right side of the screen.
Figure 22: A new quickfix replaces string concatenation with String.format.

A quickfix for method references (includes caveats for use)

With this release, we added a quickfix to create missing methods for method references.

Figure 23 shows the option to add a missing method in the code snippet.

A code snippet with the quickfix option highlighted.
Figure 23: Add the missing method 'action' to class 'E'.

This feature is new and under development. It comes with several caveats:

  • It is only available in current classes.
  • Expect it to work on simple use cases.
  • Method references invoking nested generics or type parameters might be challenging to resolve.

New editor preferences for JDT

We've added two new preference settings for Java views and dialogs and the Java formatter, respectively.

Toggle code mining

You can now enable or disable the ability to toggle code mining within an editor. As shown in Figure 24, you can set the toggle under the Find Actions menu (Ctrl+3).

The 'Toggle Code Mining' option is highlighted.
Figure 24: The new toggle option under Find Actions.

Assert statement wrapping

A new setting in the Java formatter profile controls the line wrapping of assert statements. You can now add a line wrap between an assert condition and its error message. You will find this setting in the Profile Editor (Preferences > Java > Code Style > Formatter > Edit) in the Line Wrapping > Wrapping Settings > Statements > 'assert' messages node. Figure 25 shows the new setting.

The &quot;'assert' messages&quot; setting is selected.
Figure 25: Add a line wrap between an assert condition and its error message.

New features in the JDT debugger

We've added several new debugging features in the JDT debugger.

Evaluating anonymous class instances

The JDT debugger can now evaluate expressions with anonymous class instances, as shown in Figure 26.

A code sample.
Figure 26: Evaluate an expression with an anonymous class instance.

Figure 27 shows the evaluated expression.

A code sample.
Figure 27: The evaluated expression.

JEP 358: Helpful NullPointerExceptions

The JDT debugger now has a checkbox option to activate command-line support for JEP 358. This is disabled below Java 14 and enabled by default for Java programs launched with Java 14 and above.

Figure 28 shows the -XX:+ShowCodeDetailsInExceptionMessages option selected.

The new option in the configuration dialog.
Figure 28: The -XX:+ShowCodeDetailsInExceptionMessages option is selected.

The JVM is now capable of analyzing which variable was null at the point of NullPointerException and describing the variable with a null-detail message in the exception.

Actual type in the Variables view

The option Show Type Names in the Variables and Expressions views now displays the value’s actual type instead of its declared type. This simplifies debugging, especially when the variable detail (toString()) is shown as the label for all variables:

Object s = "some string";
	Collection<?> c = Arrays.asList(s, 1);
	// breakpoint

To enable Show Type Names in the Variables view, you must disable the column mode. Navigate to View Menu > Layout > Show Columns.

Figure 29 shows the new view as compared to the old one.

Old and new views.
Figure 29: Compare views.

Conclusion

JBoss Tools 4.17.0 and Red Hat CodeReady Studio 12.17 for Eclipse 4.17 (2020-09) offer a range of updates and improvements, with a bit of something for everyone. You can find more information in the official JBoss Tools 4.17.0 update.

Last updated: February 5, 2024