Rewrite 7.0.x

Released Monday, March 22nd

These notes are for versions:

  • rewrite core libraries: 7.0.1

  • rewrite-maven-plugin: 3.0.0

  • rewrite-gradle-plugin: 3.0.0

  • rewrite-testing-frameworks: 1.0.2

  • rewrite-spring: 4.0.1

Changes and Enhancements

Renamed Recipes

These are the current names of the major migration recipes. From rewrite-testing-frameworks:

  • - JUnit 4 to 5 migration. This is also included in the spring migrations

  • - Mockito 1 to 3 Migration. This is also included in the spring migrations.

  • - Replace JUnit 5 assertions with AssertJ assertions. New in this release.

From rewrite-spring:

  • - Junit 4 to 5 migration including spring-test specific migrations. Superset of the base JUnit4to5Migration.

  • - Spring boot 1 to 2 migration.We have made some improvements here but there are still gaps. Includes JUnit and Mockito migrations.

Java Templating

With JavaTemplate you can patch snippets of Java code directly into the AST. No need to hand-construct Java ASTs to use in refactoring visitors anymore.

Java Formatting and Styling

Write your refactoring visitors to achieve the desired semantics and let AutoFormat figure out the whitespace.

Search Recipes

It is now possible to create search recipes which don't alter the AST but leave behind Markers that can either be printed out by a search result printer or responded to by other search or refactoring recipes.

Build Tool Plugin Enhancements

Recipe Discovery

See more information about what recipes are available and how to configure them, without having to dig through docs or source code: mvn rewrite:discoverand gradle rewriteDiscover now show recipe descriptions that include an overview of their parameters.

CycloneDx BOM Generation

To generate a CycloneDx bom with the maven plugin run mvn rewrite:cyclonedx. The gradle plugin does not yet generate cyclonedx boms.

Simplified YAML File Format

Here's an example of configuring the new `ChangePackage` recipe in your rewrite.yml move everything in one package into another package:

name: com.yourorg.VetToVeterinary
newFullyQualifiedPackageName: org.springframework.samples.petclinic.veterinary

With that rewrite.yml, adding com.yourorg.VetToVeterinary to the list of activeRecipes in your build plugin configuration will affect the package relocation, including moving the files on disk, when you run mvn rewrite:run or gradlew rewriteRun.