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

Improve CatchClauseOnlyRethrows to support MultiCatch completely #455

Merged

Conversation

jevanlingen
Copy link
Contributor

@jevanlingen jevanlingen commented Jan 29, 2025

What's changed?

The recipe CatchClauseOnlyRethrows supports multiple exception types now completely.

What's your motivation?

Code like

try {
  // something
} catch (SomeException | SomeOtherException e) {
  throw e;
} catch (Exception e) {
  throw new WhateverException(e);
}

will currently be altered by the recipe, which is incorrect.

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@jevanlingen jevanlingen changed the title Add new tests Improve CatchClauseOnlyRethrows to support MultiCatch completely Jan 29, 2025
@jevanlingen jevanlingen added bug Something isn't working recipe labels Jan 29, 2025
@jevanlingen jevanlingen self-assigned this Jan 29, 2025
@MBoegers
Copy link
Contributor

on it

Copy link
Contributor

@MBoegers MBoegers left a comment

Choose a reason for hiding this comment

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

small fixes for null and

@jevanlingen jevanlingen merged commit 7912c39 into main Jan 29, 2025
2 checks passed
@jevanlingen jevanlingen deleted the CatchClauseOnlyRethrows-multiple-exception-types-fixes branch January 29, 2025 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working recipe
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants