Bug 29082

Summary: Can't access Inner class static field through an instance
Product: [Eclipse Project] JDT Reporter: Nils Edvardsson <nils.edvardsson>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 M5   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

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