Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 201487

Summary: [compiler] Inner Inner Class cannot see outer class member var
Product: [Eclipse Project] JDT Reporter: Ivaylo <ivaylo.kovatchev>
Component: CoreAssignee: Srikanth Sankaran <srikanth_sankaran>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: Brian.Miller, jerome_lanneluc, Olivier_Thomann
Version: 3.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Ivaylo CLA 2007-08-28 17:46:43 EDT
Build ID:  I20070625-1500

Steps To Reproduce:
public class Test {
	public class Test3 {
		protected void load() {
		}
	}

	public class Test2 {
		public Test2(String string, Test3 test3) {
		}
	}

	private String var1;

	private class Test5 {

		private class Test4 extends Test2 {
			public Test4() {
				super("available", new Test3() {
					@Override
					protected void load() {
						System.out.println(var1.trim());
					}
				});
			}
		}
	}
}

More information:
The above code generates a compiler error. However, invoking ctrl-space code complete correctly identifies the variable var1 as accessible.
Comment 1 Jerome Lanneluc CLA 2007-09-04 12:50:45 EDT
Verified that javac accepts this code.
Comment 2 Kent Johnson CLA 2007-09-10 14:48:28 EDT
The reported error is :

'No enclosing instance of the type Test is accessible in scope'

Philippe, please take a look.
Comment 3 Philipe Mulet CLA 2008-02-21 12:02:20 EST
Added (disabled) InnerEmulationTest#test153-154
Comment 4 Brian Miller CLA 2008-08-28 11:07:41 EDT
Happens when accessing either an outer field or an outer method.
Comment 5 Eclipse Genie CLA 2020-03-12 15:32:59 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.