Bug 332841 - The field is defined in an inherited type and an enclosing scope compile error in 3.6.1 but not in 3.7
Summary: The field is defined in an inherited type and an enclosing scope compile erro...
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M4   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-17 07:56 EST by Benno Baumgartner CLA
Modified: 2011-01-25 09:33 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benno Baumgartner CLA 2010-12-17 07:56:58 EST
Given:
public class E01 {
	public static class Foo {
		private Object model;
		protected void foo() {
		}
	}
	private static class Outer {
		private Object model;
		private static class Inner {
			private Object model;
			public void bar() {
				new Foo() {
					@Override
					protected void foo() {
						System.out.println(model);
					}
				};
			}
		}
	}
}

This code compiles fine in I20101208-1300 whereas in M20100909-0800 I get a compile error:
"The field model is defined in an inherited type and an enclosing scope"
I've tested with a blank workspace in both version, compiler compliance is 1.6 in both workspaces.

I assume 3.6.1 is wrong and that this is a fix in 3.7. But I could not find the corresponding bug report. So I though I better report it in case it is a regression...
Comment 1 Srikanth Sankaran CLA 2010-12-17 20:46:59 EST
Thanks for reporting this. No, this is not a regression and
the behavior on 3.7 branch is the correct one and is the outcome
of the fix for bug 316956 and also matches javac 5,6.7. 

This fix was released for 3.7 M1 and was not back ported to 3.6
maintenance stream as this was not a regression relative to 3.5.
(Behavior was same going backwards at least until 3.3.2, probably
forever)
Comment 2 Olivier Thomann CLA 2011-01-25 09:33:47 EST
Verified for 3.7M5 using I20110124-1800