You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the smallest, simplest way to reproduce the problem?
@Testvoidfoo() {
rewriteRun(
spec -> spec.recipe(newUseStaticImport("org.hamcrest.Matchers *(..)")),
// language=javajava(
""" package com.helloworld; import static org.hamcrest.core.IsEqual.equalTo; public class Foo { public static void foo() { equalTo("foo"); org.hamcrest.Matchers.equalTo("bar"); } } """));
}
Results in:
1) foo() (com.spotify.bazel.rewrite.recipes.KnownBugsTest)
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 "com/helloworld/Foo.java"]
expected:
"package com.helloworld;
import static org.hamcrest.core.IsEqual.equalTo;
public class Foo {
public static void foo() {
equalTo("foo");
org.hamcrest.Matchers.equalTo("bar");
}
}"
but was:
"package com.helloworld;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.core.IsEqual.equalTo;
public class Foo {
public static void foo() {
equalTo("foo");
equalTo("bar");
}
}"
at org.openrewrite.test.LargeSourceSetCheckingExpectedCycles.afterCycle(LargeSourceSetCheckingExpectedCycles.java:97)
at org.openrewrite.RecipeScheduler.runRecipeCycles(RecipeScheduler.java:98)
at org.openrewrite.RecipeScheduler.scheduleRun(RecipeScheduler.java:41)
at org.openrewrite.Recipe.run(Recipe.java:378)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:376)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:132)
...
This then causes compilation to fail with error: reference to equalTo is ambiguous.
Since there is already an equalTo method imported and used, the recipe should not also try to statically import org.hamcrest.Matchers.equalTo. This is similar to
What version of OpenRewrite are you using?
What is the smallest, simplest way to reproduce the problem?
Results in:
This then causes compilation to fail with
error: reference to equalTo is ambiguous
.Since there is already an
equalTo
method imported and used, the recipe should not also try to statically importorg.hamcrest.Matchers.equalTo
. This is similar toThe text was updated successfully, but these errors were encountered: