if (isPrivate()) {
// answer true if the receiverType is the declaringClass
// AND the invocationType and the declaringClass have a common enclosingType
- if (receiverType != declaringType) return false;
+
+ // Is the receiverType an innertype of the declaring type?
+ boolean receiverTypeIsSameOrInsideDeclaringType = receiverType == declaringType;
+ ReferenceBinding typeToCheckNext = receiverType.enclosingType();
+ while (!receiverTypeIsSameOrInsideDeclaringType && typeToCheckNext!=null) {
+ if (typeToCheckNext==declaringType) receiverTypeIsSameOrInsideDeclaringType=true;
+ }
+ if (!receiverTypeIsSameOrInsideDeclaringType) return false;
+ // the code above replaces this line: (pr118698)
+// if (receiverType != declaringType) return false;
if (invocationType != declaringType) {
ReferenceBinding outerInvocationType = invocationType;
--- /dev/null
+public aspect pr118698 {
+ private static interface Marker {}
+
+ private class Foo implements Marker {
+ public Foo() {
+ bar = null; // allowed
+ listener = null; // should also be allowed
+ this.listener = null; // so should this
+ ((Marker)this).listener = null; // and this
+ }
+ }
+
+ public static void main(String []argv) {
+ pr118698.aspectOf().x();
+ }
+
+ public void x() {
+ new Foo();
+ }
+
+ private Object Marker.listener;
+ private Object bar;
+}
public void testVarargsITD_pr110906() { runTest("ITD varargs problem");}
public void testBadRenderer_pr86903() { runTest("bcelrenderer bad");}
-// public void testIllegalInitialization_pr118326_1() { runTest("illegal initialization - 1");}
-// public void testIllegalInitialization_pr118326_2() { runTest("illegal initialization - 2");}
+ //public void testIllegalInitialization_pr118326_1() { runTest("illegal initialization - 1");}
+ //public void testIllegalInitialization_pr118326_2() { runTest("illegal initialization - 2");}
public void testLintForAdviceSorting_pr111667() { runTest("lint for advice sorting");}
public void testIncompatibleClassChangeError_pr113630_1() {runTest("IncompatibleClassChangeError - errorscenario");}
public void testIncompatibleClassChangeError_pr113630_2() {runTest("IncompatibleClassChangeError - workingscenario");}
public void testFieldGetProblemWithGenericField_pr113861() {runTest("field-get problems with generic field");}
+ public void testAccesstoPrivateITDInNested_pr118698() { runTest("access to private ITD from nested type");}
public void testDeclareAnnotationOnNonExistentType_pr99191_1() { runTest("declare annotation on non existent type - 1");}
public void testDeclareAnnotationOnNonExistentType_pr99191_2() { runTest("declare annotation on non existent type - 2");}
<!-- AspectJ v1.5.0 Tests -->
<suite>
+ <ajc-test dir="bugs150" title="access to private ITD from nested type">
+ <compile files="pr118698.aj"/>
+ <run class="pr118698"/>
+ </ajc-test>
<ajc-test dir="bugs150/pr112476/case1" title="binary weaving decp broken">
<compile files="lib/A.java,lib/B.java,lib/C.java" outjar="library.jar" options="-1.5"/>