-
Notifications
You must be signed in to change notification settings - Fork 94
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What version of OpenRewrite are you using?
- org.openrewrite:rewrite-core:8.63.4
- org.openrewrite.recipe:rewrite-static-analysis:2.19.0
What is the smallest, simplest way to reproduce the problem?
Another corner case from our code base. We've worked around it, but reporting to improve OpenRewrite.
@Test
void removingFieldWithLombok() {
rewriteRun(
spec -> spec.recipe(new RemoveUnusedPrivateFields()),
// language=java
java(
"""
import lombok.Getter;
public class OnField {
@Getter private String foo;
}
"""),
// language=java
java(
"""
import lombok.Getter;
public class OnField2 {
private @Getter String foo;
}
"""));
}The second case here fails due to the placement of the @Getter annotation.
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 "OnField2.java"]
expected:
"import lombok.Getter;
public class OnField2 {
private @Getter String foo;
}"
but was:
"import lombok.Getter;
public class OnField2 {
}"
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:384)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:130)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done