Use Switch Expression and more

jSparrow Eclipse 4.3.0 & jSparrow Maven 3.10.0

We are excited to announce that this autumn release brings three additional jSparrow rules! The new rules embrace some recent Java features like Switch Expressions and Text Blocks.

Use Switch Expression

This rule replaces the traditional switch statements with switch expressions which turned into a standard feature in Java 14.

For instance, the following code:

is transformed to:

Use Text Block

Java 15 introduced Text Blocks to express String literals spanning several lines. This rule replaces multiline String concatenation expressions with Text Block String literals.

For instance, the following string concatenation:

is transformed to:

Replace String Format with Formatted

This rule replaces the static invocations of String.format by invocations of the new instance method String::formatted​from Java 15.

For instance, the following text block:

Is transformed to:

These three new rules bring jSparrow to a total of 103 automatic refactoring rules.

Find out more information in the Release Notes for jSparrow Eclipse and jSparrow Maven!

“The art of programming is the art of organizing complexity.” ― Edsger Dijkstra