Bug 318171 - fieldHiding-Warning does not appear if classes are in different packages
Summary: fieldHiding-Warning does not appear if classes are in different packages
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M1   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-28 08:35 EDT by Henning Pautsch CLA
Modified: 2010-08-03 08:26 EDT (History)
5 users (show)

See Also:


Attachments
Patch under consideration (2.83 KB, patch)
2010-06-29 04:32 EDT, Srikanth Sankaran CLA
no flags Details | Diff
Revised patch (7.88 KB, patch)
2010-06-29 05:32 EDT, Srikanth Sankaran CLA
no flags Details | Diff
Revised patch with remastered tests. (12.90 KB, patch)
2010-06-29 07:15 EDT, Srikanth Sankaran CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Henning Pautsch CLA 2010-06-28 08:35:46 EDT
Build Identifier: 20100218-1602

The warning "Field declaration hides another field or variable" does not warn if the affected classes are in different packages (example see below).

If the affected classes are in the same package, it works fine!

Reproducible: Always

Steps to Reproduce:
1. Create classes

package package1;
public abstract class A {
	protected int field;
}
------------------------
package package2;
import package1.A;
public abstract class B extends A {
	protected int field;
}

2. Enable warning "Field declaration hides another field or variable"
3. It won't warn!
Comment 1 Markus Keller CLA 2010-06-28 12:01:54 EDT
Reproduced in HEAD. Also works fine when I make A#field public.
Comment 2 Srikanth Sankaran CLA 2010-06-28 22:48:02 EDT
I'll take a look.
Comment 3 Srikanth Sankaran CLA 2010-06-29 04:32:05 EDT
Created attachment 172987 [details]
Patch under consideration
Comment 4 Srikanth Sankaran CLA 2010-06-29 05:32:09 EDT
Created attachment 172990 [details]
Revised patch

Earlier patch did not handle hiding a field
from more than one level higher superclass.
Comment 5 Srikanth Sankaran CLA 2010-06-29 07:15:27 EDT
Created attachment 172992 [details]
Revised patch with remastered tests.
Comment 6 Srikanth Sankaran CLA 2010-06-29 07:17:23 EDT
Satyam, please review -- Thanks.
Comment 7 Satyam Kandula CLA 2010-06-30 23:45:54 EDT
(In reply to comment #6)
Srikanth, the changes look good to me.
+1
Comment 8 Srikanth Sankaran CLA 2010-07-01 00:41:15 EDT
Released in HEAD for 3.7 M1.
Comment 9 Ayushman Jain CLA 2010-08-03 08:26:22 EDT
Verified for 3.7M1 using build I20100802-1800.