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

[java] AvoidCatchingGenericException: Can no longer suppress on the exception itself #4873

Closed
boris-petrov opened this issue Mar 22, 2024 · 0 comments · Fixed by #4875
Closed
Assignees
Labels
a:bug PMD crashes or fails to analyse a file.
Milestone

Comments

@boris-petrov
Copy link
Contributor

boris-petrov commented Mar 22, 2024

Affects PMD Version: 7.0.0

Rule: AvoidCatchingGenericException

Description:

try {
	someMethod();
} catch (@SuppressWarnings("PMD.AvoidCatchingGenericException") Exception exception) {
	...
}

This used to work on PMD 6.55.0. That is, it suppressed the PMD warning. It no longer works on 7.0.0 and I have to either put // NOPMD or put the suppression on the method.

Code Sample demonstrating the issue:

See above.

Steps to reproduce:

Have this code and run PMD on it.

Running PMD through: Gradle

Gradle 8.7, JDK 21.0.1, Linux.

P.S. Congratulations on the release!

@boris-petrov boris-petrov added the a:bug PMD crashes or fails to analyse a file. label Mar 22, 2024
@adangel adangel added this to the 7.0.1 milestone Mar 22, 2024
@adangel adangel self-assigned this Mar 22, 2024
adangel added a commit to adangel/pmd that referenced this issue Mar 22, 2024
@adangel adangel changed the title [java] Can no longer suppress AvoidCatchingGenericException on the exception itself [java] AvoidCatchingGenericException: Can no longer suppress on the exception itself Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug PMD crashes or fails to analyse a file.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants