I do not know how to fix it at the moment. But I suspect it is the single statement if structure that is not correctly parsed/transformed. When the second string literal "second" in the log statement, the bar function below is removed, or the then branch of the if structure uses curly braces, the run succeeds.
hi! This looks to be an issue with one particular recipe; would you mind creating a draft PR containing just one additional test based on this example that matches your case?
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?
mvn rewrite:run
while having the following Java source file:
What did you expect to see?
no parse error
What did you see instead?
parse error (see error message/stack trace)
What is the full stack trace of any errors you encountered?
Debugging the parse instruction there,
jp.reset().parse(ctx, stub).findFirst()
yields:Are you interested in contributing a fix to OpenRewrite?
I do not know how to fix it at the moment. But I suspect it is the single statement if structure that is not correctly parsed/transformed. When the second string literal
"second"
in the log statement, thebar
function below is removed, or the then branch of the if structure uses curly braces, the run succeeds.