Bug 25229

Summary: Compiler should not reject innerclass scenario
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.1 M3   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Philipe Mulet CLA 2002-10-23 05:02:26 EDT
Build 2.1M2

The following code is rejected by the compiler complaining against the 
enclosing instance of anonymous subclass of X1. Javac accepts this code as 
expected.

=======
public class X {

	public static void main(String[] arguments) {
		new X().new X2().foo();
	}
	class X1 {
		void baz1() {
			System.out.println("X1.baz1()");
		}
	}
	class X2 {
		void foo(){
			X.this.new X1(){
				void bar(){
					baz();
					baz1();
					baz2();
				}
			}.bar();
		}	
		void baz2() {
			System.out.println("X2.baz2()");
		}
	}
	void baz() {
		System.out.println("X.baz()");
	}
}
Comment 1 Philipe Mulet CLA 2002-10-23 05:54:45 EDT
Problem was that enclosing instance was only allowed as first synthetic 
argument, where it could be anywhere amongst synthetic arguments.

Fixed
Comment 2 David Audel CLA 2002-11-13 08:43:22 EST
Verified.