GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java] Fix #6038: Make AvoidCatchingGenericException configurable by UncleOwen · Pull Request #6051 · pmd/pmd

Conversation

@UncleOwen

@UncleOwen UncleOwen commented Sep 10, 2025 •
edited by adangel
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Describe the PR

This PR merges AvoidCatchingNPE and AvoidCatchingThrowable into AvoidCatchingGenericException

  • Make AvoidCatchingGenericException configurable (property "typesThatShouldNotBeCaught")
  • Deprecate AvoidCatchingNPE
  • Deprecate AvoidCatchingThrowable

Related issues

  • Fix [java] Merge AvoidCatchingNPE and AvoidCatchingThrowable into AvoidCatchingGenericException #6038

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pmd-actions-helper

pmd-actions-helper Bot commented Sep 10, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Documentation Preview

Compared to main:
This changeset changes 1360 violations,
introduces 790 new violations, 0 new errors and 0 new configuration errors,
removes 770 violations, 0 errors and 0 configuration errors.

Regression Tester Report

(comment created at 2025-10-23 15:11:34+00:00 for 9995420)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

adangel
adangel reviewed Sep 25, 2025
View reviewed changes

@adangel adangel left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks!

Code changes look good. Should the rule AvoidCatchingGenericException still be in the design category, or should we move it to error prone? (Can be done in a backwards compatible way - https://docs.pmd-code.org/latest/pmd_devdocs_rule_deprecation_policy.html#moving-rules-between-categories )
See #6038 (comment)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
adangel
adangel reviewed Oct 23, 2025
View reviewed changes
Comment thread pmd-java/src/main/resources/category/java/design.xml Resolved

Uh oh!

There was an error while loading. Please reload this page.

UncleOwen and others added 9 commits October 23, 2025 12:02
@UncleOwen @adangel
Make AvoidCatchingGenericException configurable
70a7be3
Add java.lang.Throwable and java.lang.Error to the default list
@UncleOwen @adangel
Include exception in violation message
cb4f161
@UncleOwen @adangel
Deprecate AvoidCatchingNPE and AvoidCatchingThrowable
69dd92d
@UncleOwen @adangel
update description ofAvoidCatchingGenericException
51863dd
@UncleOwen @adangel
Remove deprecated rules from quickstart.xml
117230c
activate AvoidCatchingGenericException in quickstart.xml, but configure
it so that it is roughly equivalent to the old config.
@UncleOwen @adangel
Don't use shortened language for parameters
d548af0
@UncleOwen @adangel
Change message again
ccbec68
Technically speaking, Error and Throwable aren't Exceptions,
so we shouldn't refer to them as such.
@UncleOwen @adangel
Update deprecation version
c876725
@adangel
[java] Move AvoidCatchingGenericException to category errorprone
251c4c7
@adangel adangel changed the title [java] Fix 6038: make AvoidCatchingGenericException configurable [java] Fix #6038: Make AvoidCatchingGenericException configurable Oct 23, 2025
@adangel
[doc] Update release notes (pmd#6051, pmd#6038)
3f952d0
@adangel
adangel force-pushed the issue-6038-make-AvoidCatchingGenericException-configurable branch from 32e4781 to 3f952d0 Compare October 23, 2025 14:31
@adangel adangel added this to the 7.18.0 milestone Oct 23, 2025
@adangel
Normalize line-endings
9995420
adangel
adangel approved these changes Oct 24, 2025
View reviewed changes

@adangel adangel left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@adangel
adangel merged commit b6d500b into pmd:main Oct 24, 2025
@UncleOwen
UncleOwen deleted the issue-6038-make-AvoidCatchingGenericException-configurable branch October 25, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@adangel adangel adangel approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

7.18.0

Development

Successfully merging this pull request may close these issues.

[java] Merge AvoidCatchingNPE and AvoidCatchingThrowable into AvoidCatchingGenericException

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@UncleOwen @adangel
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.