Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add InstanceOfPatternMatch recipe to java-version-17.yml #179

Merged
merged 3 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/resources/META-INF/rewrite/java-version-17.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ recipeList:
- org.openrewrite.java.migrate.lang.StringFormatted
- org.openrewrite.java.migrate.lombok.UpdateLombokToJava17
- org.openrewrite.github.SetupJavaUpgradeJavaVersion
- org.openrewrite.java.InstanceOfPatternMatch
timtebeek marked this conversation as resolved.
Show resolved Hide resolved
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.migrate.JavaVersion17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ public void test() {
// This is a comment
Set<String> stringSet = Collections.singleton("aaa");
List<String> stringList = Collections.singletonList("bbb");
Map<String, String> stringMap = Collections.singletonMap("a-key", "a-value");
Map<String, Object> stringMap = Collections.singletonMap("a-key", "a-value");
Object value = stringMap.get("a-key");
if (value instanceof String) {
System.out.println(((String) value).length());
}
}
}
""",
Expand All @@ -110,7 +114,11 @@ public void test() {
// This is a comment
Set<String> stringSet = Set.of("aaa");
List<String> stringList = List.of("bbb");
Map<String, String> stringMap = Map.of("a-key", "a-value");
Map<String, Object> stringMap = Map.of("a-key", "a-value");
Object value = stringMap.get("a-key");
if (value instanceof String s) {
System.out.println(s.length());
}
}
}
"""
Expand Down