Bug 21140 - Warning/error on shadowing definition of data member?
Summary: Warning/error on shadowing definition of data member?
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.0 M1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 25838 35784 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-06-28 13:50 EDT by Robert M. Fuhrer CLA
Modified: 2003-06-06 09:22 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert M. Fuhrer CLA 2002-06-28 13:50:44 EDT
How about generating a compiler warning/error (severity configurable
through the Java compiler prefs page) when a data member in a
base class is shadowed by a definition in a derived class?
Comment 1 Dani Megert CLA 2002-07-01 04:56:20 EDT
- Should it also warn if temporary variables override a field? I guess so.
- What about the option to show it in the Outline and Members view like we do
for methods?
Comment 2 Philipe Mulet CLA 2002-07-03 10:53:56 EDT
What are you calling a data member ? A field ?
Comment 3 Robert M. Fuhrer CLA 2002-07-08 15:58:38 EDT
Yes, by data member I mean a field.
Comment 4 Robert M. Fuhrer CLA 2002-07-08 16:00:11 EDT
> - What about the option to show it in the Outline and Members
> view like we do for methods?

If by that you mean a decoration on the data member's item in
the outline/members view that identifies it as a data override,
then yes, that would be useful.
Comment 5 Philipe Mulet CLA 2002-11-12 09:03:51 EST
*** Bug 25838 has been marked as a duplicate of this bug. ***
Comment 6 Philipe Mulet CLA 2002-11-12 09:19:13 EST
Nice to have, but post 2.1
Comment 7 Philipe Mulet CLA 2003-03-28 04:37:27 EST
Also local variable/parameter hiding field or locals should also be signaled.
Comment 8 Philipe Mulet CLA 2003-03-28 04:37:36 EST
*** Bug 35784 has been marked as a duplicate of this bug. ***
Comment 9 Philipe Mulet CLA 2003-04-01 04:54:35 EST
Added warning in compiler to diagnose field/local variable/argument hiding each 
other. May want to also do methods hiding an enclosing one ?
Comment 10 Philipe Mulet CLA 2003-04-01 04:55:05 EST
Fixed
Comment 11 David Audel CLA 2003-06-06 09:22:28 EDT
Verified.