Bug 9838

Summary: Wrong diagnosis compiling inner classes
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.1 M5   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Olivier Thomann CLA 2002-02-14 12:57:10 EST
v228,

[public class Outer {
	class Inner extends Outer {
	}
	public static void main(String[] args) {
		class Local extends Inner {
		}
	}
}]

Compiling this class with javac 1.3.1 or 1.4 reports:
Outer.java:5: no enclosing instance of type Outer is in scope
                class Local extends Inner {
                ^
1 error

We compile it fine and generate three .class files.
Need to investigate which one is the correct behavior.
See also 
http://www-124.ibm.com/developerworks/bugs/?func=detailbug&bug_id=372&group_id=1
0
Comment 1 Philipe Mulet CLA 2002-02-15 06:09:40 EST
Our behavior seems appropriate given the local class doesn't need any enclosing 
information (until it uses anything from the enclosing scopes).

Inner-emulation is supposed to be lazily requesting access to enclosing 
elements, and Javac is simply asking too much by default, I had already noticed 
it was always requesting the enclosing instance by default.

Will not change unless this is escaladated due to a JCK compliance issue.
Comment 2 Philipe Mulet CLA 2003-02-04 10:24:47 EST
Closing, got fixed along with various innerclass adjustments.

-> No enclosing instance of type Outer is accessible to invoke the super 
constructor. Must define a constructor and explicitly qualify its super 
constructor invocation with an instance of Outer (e.g. x.super() where x is an 
instance of Outer).
Comment 3 Philipe Mulet CLA 2003-02-11 06:35:16 EST
Should remove later resolution
Comment 4 Philipe Mulet CLA 2003-02-11 06:36:11 EST
Closing