Bug 318171

Summary: fieldHiding-Warning does not appear if classes are in different packages
Product: [Eclipse Project] JDT Reporter: Henning Pautsch <hp-bugs.eclipse>
Component: CoreAssignee: Srikanth Sankaran <srikanth_sankaran>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, hp-bugs.eclipse, markus.kell.r, satyam.kandula, srikanth_sankaran
Version: 3.5.2   
Target Milestone: 3.7 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch under consideration
none
Revised patch
none
Revised patch with remastered tests. none

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.