HON - Hiding Of Names

Declarations of names should not hide other declarations of the same name. The option 'Formally' regulates whether hiding of names should be detected for parameter variable, if the only usage of it is to assign its value to the attribute with the same name.

Wrong

`class HON {
int index;
void func () {
int index;
// do something
}
void setIndex (int index) {
this.index = index;
}
}
`

(Note that the second violation would be raised only if 'Formally' option is switched on.)

Tip: Rename variable which hides attribute or another variable.

Right

`class HON {
int index;
void func () {
int index1;
// do something
}
void setIndex (int anIndex) {
this.index = anIndex;
}
}
`