Add recipe to migrate commons-lang usage to JDK APIs#1594
Add recipe to migrate commons-lang usage to JDK APIs#1594jonesbusy merged 2 commits intojenkins-infra:mainfrom
Conversation
|
Can you add minimal PR title and body template? It's more user friendly. You can get inspired from commons land 2 to 3 recipe. Are all the OpenRewrite Recipes for Commons Lang to JDK added? No need test for them, they can be added to the list. It's just to confirm the recipe is available on the declarative recipe collection. PR looks already in good shape! |
b75f4eb to
8da79f6
Compare
|
Thanks for the review! I’ve made the changes:
I used existing OpenRewrite recipes instead of writing custom code. Let me know if anything else needs to be fixed 🙂 |
plugin-modernizer-core/src/main/resources/META-INF/rewrite/recipes.yml
Outdated
Show resolved
Hide resolved
|
Last change is incorrect, we don't generate extra files. Please use JTE like other recipes and provide test for TemplateUtils. Ideally I would like to see a dry-run change for for a plugin that need to be transformed |
|
Some examples jenkinsci/naginator-plugin#196 Also the skip-verification is needed on the new recipe. We want to ensure that the plugin compile before pushing a PR |
a5ce701 to
8da79f6
Compare
|
Thanks for the feedback. I’m working on the changes as suggested and will update the PR soon. |
|
Sure thanks. I think we can safely include all those recipes: https://docs.openrewrite.org/recipes/apache/commons/lang |
dca9b1d to
e00c3e4
Compare
|
Why closing the PR? |
|
Hi @jonesbusy, Sorry for closing the PR by mistake. I’m still working on the changes currently validating the recipe with dry-run on real plugins and updating tests as suggested. I’ll reopen it once everything is ready. Thanks! |
|
I’m currently looking into the reasons why the checks are failing. I’ll fix the issues and push an update shortly. |
|
Sure. Only I will disable it on main branch |
b93dff2 to
5946d07
Compare
|
I’ve addressed the feedback, fixed the issues, and updated the recipe configuration. The branch has also been rebased on the latest main. Please take another look @jonesbusy |
|
Thanks! LGTM |
Fixes #1542
This PR adds a new recipe to help migrate commons-lang usage to standard JDK APIs using OpenRewrite.
What I did
MigrateCommonsLangToJdkApiin recipes.ymlrewrite-apache) for these recipesThe recipe replaces common StringUtils usages with equivalent JDK methods like Objects.toString and null-safe checks.
Testing
mvn -pl plugin-modernizer-core -Dtest=DeclarativeRecipesTest#migrateCommonsLangToJdkApi test
mvn clean install
All tests passed successfully.
Checklist