It looks like the current PR #489 replacing wrapper types with primitives in instanceof
Test to reproduce (should be added to InstanceOfPatternMatchTest:
@Test
void matchingPrimitiveVariableInBody() {
rewriteRun(
version(
//language=java
java(
"""
public class A {
void test(Object o, Integer integer) {
if (o instanceof Integer) {
for (int j = 0; j < (int) o; j++) {
}
}
}
}
""",
"""
public class A {
void test(Object o, Integer integer) {
if (o instanceof Integer integer1) {
for (int j = 0; j < integer1; j++) {
}
}
}
}
"""
), 17)
);
}
The produced code is non-compilable:
public class A {
void test(Object o, Integer integer) {
if (o instanceof int integer1) {
for (int j = 0; j < integer1; j++) {
}
}
}
}
It looks like the current PR #489 replacing wrapper types with primitives in
instanceofTest to reproduce (should be added to
InstanceOfPatternMatchTest:The produced code is non-compilable: