Skip to content

Commit 7ad747b

Browse files
refactor: OpenRewrite Recipe best practices
Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.recipes.rewrite.OpenRewriteRecipeBestPractices?organizationId=QUxML09wZW4gU291cmNlL09wZW5SZXdyaXRl Co-authored-by: Moderne <team@moderne.io>
1 parent 75973ab commit 7ad747b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/main/resources/META-INF/rewrite/examples.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,6 +2101,29 @@ examples:
21012101
language: java
21022102
---
21032103
type: specs.openrewrite.org/v1beta/example
2104+
recipeName: org.openrewrite.staticanalysis.RemoveRedundantNullCheckBeforeInstanceof
2105+
examples:
2106+
- description: ''
2107+
sources:
2108+
- before: |
2109+
class A {
2110+
void foo(String s) {
2111+
if (s != null && s instanceof String) {
2112+
System.out.println("String value: " + s);
2113+
}
2114+
}
2115+
}
2116+
after: |
2117+
class A {
2118+
void foo(String s) {
2119+
if (s instanceof String) {
2120+
System.out.println("String value: " + s);
2121+
}
2122+
}
2123+
}
2124+
language: java
2125+
---
2126+
type: specs.openrewrite.org/v1beta/example
21042127
recipeName: org.openrewrite.staticanalysis.RemoveRedundantTypeCast
21052128
examples:
21062129
- description: ''

0 commit comments

Comments
 (0)