-
Notifications
You must be signed in to change notification settings - Fork 93
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
The InstanceOfPatternMatch declares a pattern variable with a conflicting name if a variable with that name already exists in the if body after the corresponding type cast as in the following example:
void test(Object o) {
if (o instanceof String) {
System.out.println((String) o);
String string = "x";
}
}Currently the recipe will change this to the following illegal code:
void test(Object o) {
if (o instanceof String string) {
System.out.println(string);
String string = "x";
}
}Fixing openrewrite/rewrite#2776 should address this issue and the corresponding test case can be enabled again.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done