OOP.AHF
Avoid hiding inherited instance fields
Description
This rule flags any inherited instance variable that is hidden by a member declared in a child class.
Example
package OOP;
public class AHV {
protected long a = 4;
}
public class AHV_ extends AHV {
protected int a = 5;
}
Repair
The solution will depend on the design of the program, but may be as simple as using the inherited member and removing the member declared in the child class.
|