Bug 53827 - "Local variable hides another field or variable" for static inner classes
Summary: "Local variable hides another field or variable" for static inner classes
Status: RESOLVED DUPLICATE of bug 51075
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M8   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-04 19:07 EST by Bogdan Stanescu CLA
Modified: 2004-03-05 05:49 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bogdan Stanescu CLA 2004-03-04 19:07:44 EST
If in the advanced Java compiler options I select to receive warnings 
for "Local variable hides another field or variable", I get warnings when I 
make a static inner class that has a field with the same name as the enclosing 
class. But since the inner class is static, it doesn't make sense to say its 
field "hides" the field from the enclosing class. Example:

public class FieldHideExample
{
    String str;

    public static class Inner
    {
        String str; // compiler warning here

        Inner()
        {
            // but there is no hiding here, since Inner is a static class
            str = "test";
        }
    }
}
Comment 1 Bogdan Stanescu CLA 2004-03-04 19:32:50 EST
In the example, if the field "str" from the class "FieldHideExample" was 
static, then the warning should be issued indeed.
Comment 2 Philipe Mulet CLA 2004-03-05 05:49:21 EST

*** This bug has been marked as a duplicate of 51075 ***