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

Fix Error Prone warnings in log4j-api #1961

Merged
merged 10 commits into from
Nov 15, 2023
Merged

Conversation

ppkarwasz
Copy link
Contributor

This suppresses or fixes most Error Prone warning in log4j-api.

Only two dozens warnings are left, mainly in the
TypeParameterUnusedInFormals, which can not be removed for source compatibility reasons.

Closes #1850.

@vy vy mentioned this pull request Nov 10, 2023
11 tasks
Copy link
Member

@jvz jvz left a comment

Choose a reason for hiding this comment

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

LGTM!

@ppkarwasz
Copy link
Contributor Author

I have refactored all Class#newInstance() calls to use LoaderUtil#newInstanceOf and some clazz.getDeclaredConstructor().newInstance() calls.

Since Class#newInstance is caller sensitive, this might break the instantiation of private/package-access classes. However I believe that the callers always use public and exported classes.

ppkarwasz added a commit to ppkarwasz/logging-log4j2 that referenced this pull request Nov 14, 2023
ppkarwasz added a commit to ppkarwasz/logging-log4j2 that referenced this pull request Nov 14, 2023
@ppkarwasz
Copy link
Contributor Author

Besides refactoring some bugs indicated by Error Prone, this PR also replaces BND Baseline package exclusions with more limited @BaselineIgnore annotations.

@ppkarwasz ppkarwasz merged commit a19639e into apache:2.x Nov 15, 2023
9 checks passed
ppkarwasz added a commit that referenced this pull request Nov 16, 2023
@ppkarwasz ppkarwasz deleted the error-prone branch November 21, 2023 17:45
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 this pull request may close these issues.

Fix main ErrorProne issues
3 participants