From: aclement Date: Tue, 3 Oct 2006 13:04:18 +0000 (+0000) Subject: test and fix for 149071 X-Git-Tag: BEFORE_133532~19 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a67ec0d3c573b37b0d1bbc8b2400da430dfb2faa;p=aspectj.git test and fix for 149071 --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeFieldBinding.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeFieldBinding.java index 19e04461e..fbcde4c71 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeFieldBinding.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeFieldBinding.java @@ -83,13 +83,19 @@ public class InterTypeFieldBinding extends FieldBinding { // answer true if the receiverType is the declaringClass // AND the invocationType and the declaringClass have a common enclosingType + // see pr149071 - it has caused me to comment out this block below - what + // is it trying to achieve? Possibly it should be using the scope.parentScope (the class scope of + // where the reference is being made) rather than the receiver type + // 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; +// 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; diff --git a/tests/bugs153/pr149071/AspectItd.java b/tests/bugs153/pr149071/AspectItd.java index 30e749169..54a633ab5 100644 --- a/tests/bugs153/pr149071/AspectItd.java +++ b/tests/bugs153/pr149071/AspectItd.java @@ -1,11 +1,17 @@ public aspect AspectItd { //private interface Holder {} private int Holder.x; - static aspect Inner { + static class Inner { int doIt(Holder h) { return h.x++; } } + + public static void main(String []argv) { + new Inner().doIt(new HolderImpl()); + } } interface Holder{} + +class HolderImpl implements Holder {} diff --git a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java index e32630e4c..ee11353fb 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java @@ -29,6 +29,7 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase { // public void testAmbiguousBinding_pr121805() { runTest("ambiguous binding");} // public void testNoIllegalStateExceptionWithGenericInnerAspect_pr156058() { runTest("no IllegalStateException with generic inner aspect"); } // public void testNegatedAnnotationMatchingProblem_pr153464() { runTest("negated annotation matching problem");} + public void testVisibilityProblem_pr149071() { runTest("visibility problem");} public void testMissingLineNumbersInStacktraceAfter_pr145442() { runTest("missing line numbers in stacktrace after");} public void testMissingLineNumbersInStacktraceAround_pr145442() { runTest("missing line numbers in stacktrace around");} public void testGenericArrays_pr158624() { runTest("generics and arrays"); } @@ -63,7 +64,6 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testVerifyErrNoTypeCflowField_pr145693_1() { runTest("verifyErrNoTypeCflowField"); } public void testVerifyErrInpathNoTypeCflowField_pr145693_2() { runTest("verifyErrInpathNoTypeCflowField"); } public void testCpathNoTypeCflowField_pr145693_3() { runTest("cpathNoTypeCflowField"); } - // public void testVisibilityProblem_pr149071() { runTest("visibility problem");} // public void testAdviceNotWovenAspectPath_pr147841() { runTest("advice not woven on aspectpath");} public void testGenericSignatures_pr148409() { runTest("generic signature problem"); } // public void testBrokenIfArgsCflowAtAj_pr145018() { runTest("ataj crashing with cflow, if and args");} diff --git a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml index 9ebb3fca3..ea791e8d0 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml +++ b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml @@ -190,6 +190,7 @@ +