-
Notifications
You must be signed in to change notification settings - Fork 81
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
Convert lambda block to expression after adopting assertThrows
#582
Conversation
Test case for inlining valid single line assertthrows
src/test/java/org/openrewrite/java/testing/junit5/UpdateTestAnnotationTest.java
Show resolved
Hide resolved
Thanks for yet another case to cover; think indeed best here to have a separate recipe, as that then keeps the logic cleaner here, and allows us to pick up cases already converted. |
Should the recipe be in rewrite static analysis? Maybe not just for
assertThrows, but for everything?
I think it’s just the removing parantheses bit … I will exclude throws
statements. Any other single statement cases which could break will be very
rare. I hope that this approach is fine.
Sorry to bother you when you are so busy. No rush on this one.
…On Fri, 16 Aug 2024 at 1:59 AM, Tim te Beek ***@***.***> wrote:
Thanks for yet another case to cover; think indeed best here to have a
separate recipe, as that then keeps the logic cleaner here, and allows us
to pick up cases already converted.
—
Reply to this email directly, view it on GitHub
<#582 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BI27SFQF3RQI2KOUMU4PIU3ZRTF7TAVCNFSM6AAAAABMSK4YS2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJRGU4TSNJQG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I think we already have this one; we just need to tie it in here. Nice to be able to leverage existing logic there! :) |
Did a quick check: we're running up against this safe guard where any overload invalidates the visit of a lambda argument. Not quite sure if we can safely change that here. 🤔 |
Specifically, the methods were seeing overloaded at that particular point are these.
We could try this out in |
This comment was marked as outdated.
This comment was marked as outdated.
assertThrows
Test case for inlining valid single line assertthrows
What's changed?
Inline valid single line assert throws test case
What's your motivation?
This recipe creates intellij suggestion/warning to inline this code and I much prefer it inlined, saves 2 lines of useless code.
Anyone you would like to review specifically?
@timtebeek
Have you considered any alternatives or workarounds?
Yes - maybe a separate recipe which achieves this is better, or maybe both - change this recipe, and have a separate recipe. Can do separate recipe first as it addresses at a global level.
Checklist