View | Details | Raw Unified | Return to bug 249107 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java (+40 lines)
Lines 6965-6970 Link Here
6965
	},
6965
	},
6966
	"X.this.method()=[X#method()]X.super.method()=[XInternal#method()]");
6966
	"X.this.method()=[X#method()]X.super.method()=[XInternal#method()]");
6967
}
6967
}
6968
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=249107 - variation
6969
public void test170() throws Exception {
6970
	this.runConformTest(new String[] {
6971
		"X.java",//=======================
6972
		"public class X {\n" + 
6973
		"    class Member {\n" + 
6974
		"        private String field = \"SUCCESS\";\n" + 
6975
		"    }\n" + 
6976
		"    class SubMember extends Member {\n" + 
6977
		"    	void foo() {\n" + 
6978
		"    		System.out.println(super.field);\n" + 
6979
		"    	}\n" + 
6980
		"    }	\n" + 
6981
		"    public static void main(String argv[]) {\n" + 
6982
		"		new X().new SubMember().foo();    	\n" + 
6983
		"    }\n" + 
6984
		"}\n",
6985
	},
6986
	"SUCCESS");
6987
}
6988
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=249107 - variation
6989
public void test171() throws Exception {
6990
	this.runConformTest(new String[] {
6991
		"X.java",//=======================
6992
		"public class X {\n" + 
6993
		"    class Member {\n" + 
6994
		"        private String method() { return \"SUCCESS\"; }\n" + 
6995
		"    }\n" + 
6996
		"    class SubMember extends Member {\n" + 
6997
		"    	void foo() {\n" + 
6998
		"    		System.out.println(super.method());\n" + 
6999
		"    	}\n" + 
7000
		"    }	\n" + 
7001
		"    public static void main(String argv[]) {\n" + 
7002
		"		new X().new SubMember().foo();    	\n" + 
7003
		"    }\n" + 
7004
		"}\n",
7005
	},
7006
	"SUCCESS");
7007
}
6968
public static Class testClass() {
7008
public static Class testClass() {
6969
	return InnerEmulationTest.class;
7009
	return InnerEmulationTest.class;
6970
}
7010
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java (-4 / +2 lines)
Lines 419-433 Link Here
419
			if (this.syntheticAccessors == null)
419
			if (this.syntheticAccessors == null)
420
				this.syntheticAccessors = new MethodBinding[2];
420
				this.syntheticAccessors = new MethodBinding[2];
421
			this.syntheticAccessors[isReadAccess ? FieldReference.READ : FieldReference.WRITE] =
421
			this.syntheticAccessors[isReadAccess ? FieldReference.READ : FieldReference.WRITE] =
422
				((SourceTypeBinding) codegenBinding.declaringClass).addSyntheticMethod(codegenBinding, isReadAccess, isSuperAccess());
422
				((SourceTypeBinding) codegenBinding.declaringClass).addSyntheticMethod(codegenBinding, isReadAccess, false /* not super ref in remote type*/);
423
			currentScope.problemReporter().needToEmulateFieldAccess(codegenBinding, this, isReadAccess);
423
			currentScope.problemReporter().needToEmulateFieldAccess(codegenBinding, this, isReadAccess);
424
			return;
424
			return;
425
		}
425
		}
426
	} else if (this.receiver instanceof QualifiedSuperReference) { // qualified super
426
	} else if (this.receiver instanceof QualifiedSuperReference) { // qualified super
427
		// qualified super need emulation always
427
		// qualified super need emulation always
428
		SourceTypeBinding destinationType =
428
		SourceTypeBinding destinationType = (SourceTypeBinding) (((QualifiedSuperReference) this.receiver).currentCompatibleType);
429
			(SourceTypeBinding) (((QualifiedSuperReference) this.receiver)
430
				.currentCompatibleType);
431
		if (this.syntheticAccessors == null)
429
		if (this.syntheticAccessors == null)
432
			this.syntheticAccessors = new MethodBinding[2];
430
			this.syntheticAccessors = new MethodBinding[2];
433
		this.syntheticAccessors[isReadAccess ? FieldReference.READ : FieldReference.WRITE] = destinationType.addSyntheticMethod(codegenBinding, isReadAccess, isSuperAccess());
431
		this.syntheticAccessors[isReadAccess ? FieldReference.READ : FieldReference.WRITE] = destinationType.addSyntheticMethod(codegenBinding, isReadAccess, isSuperAccess());
(-)compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java (-2 / +1 lines)
Lines 207-214 Link Here
207
207
208
		// depth is set for both implicit and explicit access (see MethodBinding#canBeSeenBy)
208
		// depth is set for both implicit and explicit access (see MethodBinding#canBeSeenBy)
209
		if (currentScope.enclosingSourceType() != codegenBinding.declaringClass){
209
		if (currentScope.enclosingSourceType() != codegenBinding.declaringClass){
210
210
			this.syntheticAccessor = ((SourceTypeBinding)codegenBinding.declaringClass).addSyntheticMethod(codegenBinding, false /* not super access there */);
211
			this.syntheticAccessor = ((SourceTypeBinding)codegenBinding.declaringClass).addSyntheticMethod(codegenBinding, isSuperAccess());
212
			currentScope.problemReporter().needToEmulateMethodAccess(codegenBinding, this);
211
			currentScope.problemReporter().needToEmulateMethodAccess(codegenBinding, this);
213
			return;
212
			return;
214
		}
213
		}

Return to bug 249107