# Remove Unused Parameters in Private Methods
# Description
This rule finds and removes unused parameters in private method declarations. Consequently, all the invocations of the affected methods are updated accordingly.
# Benefits
Removes the clutter and simplifies the method declarations.
# Tags
# Code Changes
Pre
/**
* Java doc for the affected method
*
* @param first discarded parameter
* @param second used parameter
* @param third discarded parameter
*/
private void discardedParameters(String first, String second, String third) {
consume(second);
}
void invocationSample() {
discardedParameters("first", "second", "third");
}
Post
/**
* Java doc for the affected method
*
* @param second used parameter
*/
private void discardedParameters(String second) {
consume(second);
}
void invocationSample() {
discardedParameters("second");
}
# Limitations
The non-private methods are not modified by this rule because they could be invoked or overridden in locations that are not reachable by jSparrow.
🛠️ Auto-refactor Available
You can auto-refactor this with jSparrow.
Drop this button to your Eclipse IDE workspace to install jSparrow for free:
Need help? Check out our installation guide.