PB.MPC
Avoid using method parameter names that conflict with class member names
Description
This rule flags any method parameter name that conflicts with a class member name.
Example
The following example shows the use of the same names `i' and `j' for parameters, an instance variable, and a method, respectively. This might create confusion when using the variable or calling the function, and eventually lead to a logic error.
package PB;
public class MPC {
void method (int i, int j) {}
void j () {}
private int i = 3;
}
Repair
Use different names for parameters and class members (variables and methods) to avoid confusion.
|