Bug 222534 - [compiler] wrong field hides field warning for private fields
Summary: [compiler] wrong field hides field warning for private fields
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M6   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-13 05:50 EDT by Benno Baumgartner CLA
Modified: 2008-03-27 05:37 EDT (History)
2 users (show)

See Also:


Attachments
Proposed patch (6.01 KB, patch)
2008-03-26 09:43 EDT, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benno Baumgartner CLA 2008-03-13 05:50:15 EDT
I20080311-0924

Given:
package test;
public class Other {
	private static class Inner1 {
		private int field;
	}
	private static class Inner2 extends Inner1 {
		private int field;
		public void bar() {System.out.println(field);}
	}
}
Is:
Other.Inner2.field is hiding a field from type Other.Inner1
Should:
No warning? Can a private field hide another private field? Both types are static.

Extract Inner1 and the warning is gone...
Comment 1 Philipe Mulet CLA 2008-03-26 09:41:18 EDT
Agreed, we should not complain in this case. A visibility check is missing in this one scenario.

Comment 2 Philipe Mulet CLA 2008-03-26 09:43:39 EDT
Created attachment 93584 [details]
Proposed patch
Comment 3 Philipe Mulet CLA 2008-03-26 09:44:20 EDT
Added FieldAccessTest#test017-020
Comment 4 Philipe Mulet CLA 2008-03-26 13:26:49 EDT
Released for 3.4M6.
Fixed
Comment 5 Eric Jodet CLA 2008-03-27 05:37:34 EDT
verified for 3.4 M6 using build I20080326-1950