-
Notifications
You must be signed in to change notification settings - Fork 90
Open
Labels
bugSomething isn't workingSomething isn't working
Description
I am using
- org.openrewrite:rewrite-core:8.62.4
- org.openrewrite.recipe:rewrite-static-analysis:2.18.0
What is the smallest, simplest way to reproduce the problem?
@Test
void removingCodeWithSideEffects() {
rewriteRun(
spec -> spec.recipe(new RemoveUnusedLocalVariables(null, null, true)),
// language=java
java(
"""
public class Foo {
private String baz() {
String foo;
try {
foo = String.valueOf(1);
} catch (RuntimeException e) {
return "error";
}
return "ok";
}
}
"""));
}
The value of the withSideEffects doesn't matter for the results.
org.opentest4j.AssertionFailedError: [Expected recipe to complete in 0 cycles, but took at least one more cycle. Between the last two executed cycles there were changes to "Foo.java"]
expected:
"public class Foo {
private String baz() {
String foo;
try {
foo = String.valueOf(1);
} catch (RuntimeException e) {
return "error";
}
return "ok";
}
}"
but was:
"public class Foo {
private String baz() {
try {
} catch (RuntimeException e) {
return "error";
}
return "ok";
}
}"
at org.openrewrite.test.LargeSourceSetCheckingExpectedCycles.afterCycle(LargeSourceSetCheckingExpectedCycles.java:97)
at org.openrewrite.RecipeScheduler.runRecipeCycles(RecipeScheduler.java:95)
at org.openrewrite.RecipeScheduler.scheduleRun(RecipeScheduler.java:41)
at org.openrewrite.Recipe.run(Recipe.java:442)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:382)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:130)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
In Progress