My understanding is that the matcher to pick up the segment to be rewritten failed pick the right method. Instead of picking up ImmutableList.of(1, 2), it picked up ImmutableList.of(1, 2).stream() and then tried to access the arguments of stream() and since stream doesn't have any argument, an IndexOutOfBoundsException was thrown.
Thanks for the detailed report and links to the implementation. Indeed an odd case that we should cover. I'll add this to the backlog for now & we'll see who gets to it first. :)
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a single module project.
What is the smallest, simplest way to reproduce the problem?
What did you expect to see?
What did you see instead?
What is the full stack trace of any errors you encountered?
Additional details
My understanding is that the matcher to pick up the segment to be rewritten failed pick the right method. Instead of picking up
ImmutableList.of(1, 2)
, it picked upImmutableList.of(1, 2).stream()
and then tried to access the arguments ofstream()
and sincestream
doesn't have any argument, anIndexOutOfBoundsException
was thrown.Are you interested in contributing a fix to OpenRewrite?
I can fix it when I have time but I don't know when I will so please feel free to do that.