rewrite-static-analysis
rewrite-static-analysis copied to clipboard
ExplicitLambdaArgumentTypes imports the wrong class and collides on name importing.
What version of OpenRewrite are you using?
I am using
- LAtest
What is the smallest, simplest way to reproduce the problem?
package bar;
import foo.A;
class Foo {
void foo(List<List<buzz.A> asouter) {
asouter.forEach((asouter) -> {
asouter.forEach(a) {}
}
}
}
What did you expect to see?
import foo.A;
class Foo {
void foo(List<List<buzz.A> asouter) {
asouter.forEach((buzz.A asouter) -> {
asouter.forEach(buzz.A a) {}
}
}
}
What did you see instead?
import foo.A;
import buzz.A;
class Foo {
void foo(List<List<buzz.A> asouter) {
asouter.forEach((A asouter) -> {
asouter.forEach(A a) {}
}
}
}
}
Somehow the symbols are getting confused and picking form a different package. This also could be due to nested labmdas where the symbol has a fully qualifed name for a generic in the outer scope and a non-qualified name derived in the inner nested.
What is the full stack trace of any errors you encountered?
error: a type with the same simple name is already defined by the single-type-import of A
import buzz.A;
^