Skip to content
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

Refine implementation and usage of throwAsUncheckedException(..) #3620

Closed
wants to merge 2 commits into from

Conversation

bjmi
Copy link
Contributor

@bjmi bjmi commented Dec 30, 2023

Use throw with throwAsUncheckedException(..).

Reason:

ExceptionUtils.throwAsUncheckedException(t) emits the following warning in IntelliJ:

Result of 'throwAsUncheckedException()' not thrown

and throw ExceptionUtils.throwAsUncheckedException(t) also emits a warning:

Dereference of 'ExceptionUtils.throwAsUncheckedException(t)' may produce 'NullPointerException'

Therefore following recommendation: throwAsUncheckedException shouldn't return a null value.


I hereby agree to the terms of the JUnit Contributor License Agreement.

@sbrannen sbrannen changed the title Refine usages of throwAsUncheckedException(..) Refine usage of throwAsUncheckedException(..) Dec 30, 2023
Copy link
Member

@sbrannen sbrannen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

I've requested that unrelated changes be moved to a separate PR.

@sbrannen sbrannen changed the title Refine usage of throwAsUncheckedException(..) Refine implementation and usage of throwAsUncheckedException(..) Dec 30, 2023
@sbrannen sbrannen self-assigned this Dec 30, 2023
@sbrannen sbrannen added this to the 5.11 M1 milestone Dec 30, 2023
Signed-off-by: Björn Michael <[email protected]>
@sbrannen sbrannen closed this in e6e9e4a Dec 30, 2023
sbrannen added a commit that referenced this pull request Dec 30, 2023
@sbrannen
Copy link
Member

This has been merged into main.

Thanks

@bjmi bjmi deleted the throwAsUncheckedException branch May 6, 2024 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants