Bug 83161 - Can't access public field from private subclass
Summary: Can't access public field from private subclass
Status: VERIFIED FIXED
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.1 M5   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-19 04:03 EST by Martin Aeschlimann CLA
Modified: 2005-02-16 06:11 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2005-01-19 04:03:50 EST
Since I20050118 this code does not compile anymore. The access to 'publicField'
is marked as 'not visible'

public class A {
	private static class PrivateInner {
		public int publicField;
	}	
	public static class PublicInner extends PrivateInner {	
	}
}
class B {
	void foo(Object o) {
		A.PublicInner x;

		int i= ((A.PublicInner)o).publicField;
		int j= x.publicField;
	}
}

Also note the strange error range marked on the assignment to 'i'
Comment 1 Olivier Thomann CLA 2005-01-19 16:08:28 EST
This is fixed in HEAD where we report:
----------
1. ERROR in c:\tests_sources\A.java
 (at line 13)
	int j= x.publicField;
	       ^^^^^^^^^^^^^
The local variable x may not have been initialized
----------
1 problem
Comment 2 Kent Johnson CLA 2005-01-19 16:12:56 EST
Was fixed & released yesterday... just after the integration build :(.
Comment 3 David Audel CLA 2005-02-16 06:11:43 EST
Verified in I20050215-2300