-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LambdaBlockToExpression does not work in assertThrows (or generally when no value is returned) #236
Comments
Runnable
s)
Hi @timo-abele Thanks for the offer to help! I think it ought to be easy to covert some of the examples you've given into a minimal unit test as a start, as for example seen here Lines 37 to 58 in 3c3fded
When you then run that new test in a debugger you'll quite quickly find that you're not getting past the second rewrite-static-analysis/src/main/java/org/openrewrite/staticanalysis/LambdaBlockToExpression.java Lines 47 to 57 in e57dac0
That |
Could you please take a look at my draft PR @timtebeek? |
Hi @timtebeek, can you please reopen this issue? I just tried 1.3.0-SNAPSHOT and my original use case with assertThrows is not transformed.
whereas this is not:
|
Sorry to hear it's not yet working as expected ; guess we'd need to refine with another unit test that more closely matches your intended use. Would you want to get that started? |
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?
no change whatsoever.
Notes
The example above is how I encountered this bug. The examplee below are a bit more minimal but less common in my opinion.
All three examples have in common that they don't return a value, so the description in the docs:
would render this issue a feature request. However, if I were to write a separate recipe I wouldn't know what else to call it but "LambdaBlockToExpression", so I declare the description part of the bug 😃.
In addition, IntelliJ suggests for all three examples to "Replace with expression lambda", just like for lambdas that return a value.
What is the full stack trace of any errors you encountered?
No errors, works as (IMO incompletely) designed
Are you interested in contributing a fix to OpenRewrite?
I'm somewhat interested in contributing, but not sure if I have the time. It would help me to know if the the functionality described does indeed belong in this recipe, or what to call such a separate recipe.
The text was updated successfully, but these errors were encountered: