📄️ Recipe development environment
This getting started guide covers setting up your development environment for creating your own OpenRewrite recipes.
📄️ Types of recipes
Before you jump into coding recipes, it's important to figure out what type of recipe you're going to make.
📄️ Writing a Java refactoring recipe
To help you get started with writing recipes, this guide will walk you through all the steps needed to create a basic refactoring recipe. This SayHelloRecipe will add a hello() method to a user specified class if that class does not already have one.
📄️ Getting started with Refaster template recipes
Refaster is an open source refactoring technology unaffiliated with OpenRewrite, originally presented to the world by Louis Wasserman in his 2013 paper.
📄️ Recipe testing
When developing new recipes, it's very important to test them to ensure that they not only make the expected changes but that they also don't make unnecessary changes.
📄️ Recipe conventions and best practices
To help you create reliable and scalable recipes, this document will describe an assortment of conventions and best practices to keep in mind when making new recipes.
📄️ Modifying methods with JavaTemplate
Previously, we wrote a Java recipe that added a hello() method to a class if it didn't already have one. In that guide, we used a JavaTemplate to create a basic method. However, a JavaTemplate can be used for much more complicated changes, such as refactoring existing methods. Let's explore that.
📄️ Creating multiple visitors in one recipe
As you begin to write increasingly complex recipes, you will find that it is often necessary to have more than one visitor. This is because significant changes often require you to visit many types of Lossless Semantic Trees (LSTs) to figure out whether or not a change should be made.
📄️ Writing recipes over multiple source file types
When creating new recipes, you may find it desirable to examine multiple source files, potentially of different types, to make key decisions in your visitor. For example, you may want to look for a particular condition to be present in a Maven POM file and, if that condition is met, alter an application property in a YAML file.
📄️ Using multiple versions of a library in a project
Recipes are commonly grouped based on their goals. Maven recipes are put in the same project as other Maven recipes, Gradle recipes are put in the same project as other Gradle recipes, and so on. This has a variety of benefits: it's easier to share logic between recipes, fewer dependencies are needed, and it's easier to find recipes you care about.