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

MethodReturnCheck should detect not-thrown exceptions returned by factory methods #2547

Closed
fiveOO opened this issue Sep 4, 2023 · 2 comments · Fixed by #2560
Closed

MethodReturnCheck should detect not-thrown exceptions returned by factory methods #2547

fiveOO opened this issue Sep 4, 2023 · 2 comments · Fixed by #2560

Comments

@fiveOO
Copy link

fiveOO commented Sep 4, 2023

MethodReturnCheck(RV_EXCEPTION_NOT_THROWN) detects not-thrown exceptions created by calling a constructor directly.

It would be helpful to detect not-thrown exceptions returned by a factory method in addition.

// is detected
new IllegalArgumentException("x must be nonnegative");
// should be detected
MyException.someLogicWentWrong("value1", "value2");
@welcome
Copy link

welcome bot commented Sep 4, 2023

Thanks for opening your first issue here! 😃
Please check our contributing guideline. Especially when you report a problem, make sure you share a Minimal, Complete, and Verifiable example to reproduce it in this issue.

@gtoison
Copy link
Contributor

gtoison commented Sep 4, 2023

This is the same kind of feature request as #2449 and would be useful indeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants