The rules UnusedLocalVariable, UnusedPrivateField, UnusedFormalParameter, and UnusedPrivateMethod could be merged together in pmd 7, eg in a new rule UnusedDeclaration. This would make them easier to include, and centralize their doc and configuration.
Also removing the "private" from the name of UnusedPrivateMethod and UnusedPrivateField would make it possible to also check members with other visibilities. Eg a package-private field of a private class is effectively private and could be checked as well.
In later improvements to that rule, we could also flag
- unused constructors
- unused type parameters
- unused type declarations
Category: I think design is more appropriate than bestpractices
Additional context
#2957
The rules UnusedLocalVariable, UnusedPrivateField, UnusedFormalParameter, and UnusedPrivateMethod could be merged together in pmd 7, eg in a new rule UnusedDeclaration. This would make them easier to include, and centralize their doc and configuration.
Also removing the "private" from the name of UnusedPrivateMethod and UnusedPrivateField would make it possible to also check members with other visibilities. Eg a package-private field of a private class is effectively private and could be checked as well.
In later improvements to that rule, we could also flag
Category: I think design is more appropriate than bestpractices
Additional context
#2957