Bug 29082 - Can't access Inner class static field through an instance
Summary: Can't access Inner class static field through an instance
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-07 08:32 EST by Nils Edvardsson CLA
Modified: 2003-01-08 07:08 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nils Edvardsson CLA 2003-01-07 08:32:39 EST
The following class won't compile:

public class Outer {

	public final static Outer cOuter = new Outer();

	public static class Inner {
		public static final String mInnerAttribute = "test";
	}
	
	public static void main(String[] args) {
		System.out.println(Outer.cOuter.Inner.mInnerAttribute);
	}
}
Comment 1 Kent Johnson CLA 2003-01-07 10:27:59 EST
In JDK 1.41, this test fails with:

Outer.java:10: unexpected type
required: class, package
found   : variable
                System.out.println(Outer.cOuter.Inner.mInnerAttribute);
                                        ^
1 error
Comment 2 Kent Johnson CLA 2003-01-07 16:05:19 EST
Question from Nils in email: Do you know if this is a new feature of JDK 1.4? 
The code compiles for JDK 1.3.

No I don't know offhand... but I suspect it was a bug fix put into JDK 1.4.1.

I doubt we'll change our 1.3 behaviour to match JDK 1.3 since JDK 1.4.1 has 
changed.
Comment 3 Philipe Mulet CLA 2003-01-08 05:59:36 EST
JDK1.3 had numerous bugs which got fixed in 1.4.1. Usually we follow 1.4.1 
unless it breaks JCK 1.3 certification.

Comment 4 Philipe Mulet CLA 2003-01-08 05:59:59 EST
Ok to close?
Comment 5 Nils Edvardsson CLA 2003-01-08 06:07:25 EST
Yes close it.
Comment 6 Philipe Mulet CLA 2003-01-08 07:08:46 EST
Closing