Skip to content

Commit 3d0ad8f

Browse files
OpenRewrite recipe best practices
Co-authored-by: Moderne <team@moderne.io>
1 parent 76925b9 commit 3d0ad8f

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9193,6 +9193,34 @@ examples:
91939193
language: java
91949194
---
91959195
type: specs.openrewrite.org/v1beta/example
9196+
recipeName: org.openrewrite.java.migrate.nio.file.RedundantUtf8Charset
9197+
examples:
9198+
- description: '`RedundantUtf8CharsetTest#readString`'
9199+
sources:
9200+
- before: |
9201+
import java.io.IOException;
9202+
import java.nio.charset.StandardCharsets;
9203+
import java.nio.file.Files;
9204+
import java.nio.file.Path;
9205+
9206+
class Test {
9207+
String read(Path path) throws IOException {
9208+
return Files.readString(path, StandardCharsets.UTF_8);
9209+
}
9210+
}
9211+
after: |
9212+
import java.io.IOException;
9213+
import java.nio.file.Files;
9214+
import java.nio.file.Path;
9215+
9216+
class Test {
9217+
String read(Path path) throws IOException {
9218+
return Files.readString(path);
9219+
}
9220+
}
9221+
language: java
9222+
---
9223+
type: specs.openrewrite.org/v1beta/example
91969224
recipeName: org.openrewrite.java.migrate.search.AboutJavaVersion
91979225
examples:
91989226
- description: '`AboutJavaVersionTest#aboutJavaVersion`'

0 commit comments

Comments
 (0)