Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#164 Hidden field check warns about static local variable

release_3.2
closed
Rick Giles
Other (70)
5
2012-10-10
2003-10-21
Willian Mitsuda
No

Considering the following code snipet:

public final class Test {

private int i;

public static void main(String[] args) {
    int i = 5;
}

}

When the "hidden field" check is enabled, it warns that
"i" local variable in main method is hidding the
instance field "i", what is impossible to happen.

Discussion

  • Lars Kühne
    Lars Kühne
    2003-10-22

    Logged In: YES
    user_id=401384

    Just to be clear: You mean that the field isn't accessible
    in main(), no matter if there is a local variable or not.

    Hence we should not report any error for
    variables/parameters in static methods that conflict with
    nonstatic members.

     
  • Logged In: YES
    user_id=378738

    Yes, it is

     
  • Rick Giles
    Rick Giles
    2003-10-27

    Logged In: YES
    user_id=539926

    Correction committed to 3.2 CVS