Open woj-tek opened 1 month ago
Thanks for logging an issue! Indeed hard to say what to do when there's no clear best way to go about it.
We could prevent the IndexOutOfBoundsException
with a quick check, and if there's no argument insert a literal {i}
just to keep the effect the same. What are your thoughts on that?
Then we can still defer and write a recipe later that cleans that up either before or after conversion, but at least don't blow up on larger migrations where the odds increase of such problems existing in the project.
We could prevent the
IndexOutOfBoundsException
with a quick check, and if there's no argument insert a literal{i}
just to keep the effect the same. What are your thoughts on that?
Make sense.
Though I'd log error just as well to inform user that the statement is wrong.
On the other hand converting it as is and leaving exact number of parameters, which would yield warning in any IDE, would also be convenient to get them squash.
The more I ponder it the more I'm leaning towards the latter :-) The former would mostly just keep hiding the issue.
Let's opt for the IDE warnings first then; should be doable. Logging isn't really an option given how many different ways there are to run recipes.
Followup to: https://github.com/openrewrite/rewrite-logging-frameworks/issues/155#issuecomment-2216788376
What version of OpenRewrite are you using?
I am using
What is the smallest, simplest way to reproduce the problem?
What did you expect to see?
Not sure to be honest - this looks like invalid call but it's not sanitised at any point...
Usually with JUL, if parameter is missing then the formatter simply doesn't do anything with positional argument, i.e. above would result in String:
What did you see instead?
Not sure :-)
What is the full stack trace of any errors you encountered?
Are you interested in contributing a fix to OpenRewrite?