This project implements a Rewrite module that bundles OpenRewrite recipes maintained by third parties. These recipes are not maintained by the OpenRewrite team, but are still useful for migrating codebases.
InlineMethodCallsRecipeGenerator turns the @InlineMe annotations found in the type tables into an InlineMethodCalls recipe list.
The generated YAML is not shipped from here, but copied into the module that owns those recipes: rewrite-migrate-java for Guava, and rewrite-logging-frameworks for Log4j API.
Claude Code runs the steps below, through to the PRs, with the update-inline-recipes skill.
- Refresh the type tables, such that the
+versions inrecipeDependenciesresolve to the latest releases.Commit both./gradlew createTypeTable createTestTypeTable --refresh-dependencies
src/main/resources/META-INF/rewrite/classpath.tsv.gzandsrc/test/resources/META-INF/rewrite/classpath.tsv.gz;parserClasspathartifacts land in the first,testParserClasspathartifacts in the second. - Generate the recipes, which prints how many were found for each artifact.
Each task writes the file under
./gradlew generateInlineGuavaMethods generateInlineLog4jMethods
build/generated/META-INF/rewrite/with the name it has in its target repository, and a header naming the exact version the method patterns were generated from. The next regeneration overwrites the whole file, so put what only one target needs, like a precondition, in a hand-written recipe there that lists the generated one. - Copy the generated file into the target repository.
cp build/generated/META-INF/rewrite/inline-guava-33-methods.yml \ ../rewrite-migrate-java/src/main/resources/META-INF/rewrite/
- There, pin
parserClasspathto the version named in the header of the generated file, and run./gradlew createTypeTable --refresh-dependencies, such that theclasspathFromResourcesentries resolve against the version the method patterns were generated from. - Finish with
./gradlew licenseFormatto add the license header the generated file lacks, and./gradlew recipeCsvGenerateto update the recipe count inrecipes.csv.
We appreciate all types of contributions. See the contributing guide for detailed instructions on how to get started.