]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for 149071
authoraclement <aclement>
Tue, 3 Oct 2006 13:04:18 +0000 (13:04 +0000)
committeraclement <aclement>
Tue, 3 Oct 2006 13:04:18 +0000 (13:04 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeFieldBinding.java
tests/bugs153/pr149071/AspectItd.java
tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
tests/src/org/aspectj/systemtest/ajc153/ajc153.xml

index 19e04461ed276a86ef23b1607b9c292e5e7b4ed8..fbcde4c71f1878d7dc877c36557c744ab4f1395b 100644 (file)
@@ -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;
        
index 30e7491694ccc65e48f971ca30d2b46c90c42e56..54a633ab55487b79847b9ed4f58b9f9d3ababb30 100644 (file)
@@ -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 {}
index e32630e4c1df5a88e5260e703b35dffde0e85fd3..ee11353fb87a99bb1555e0eea017c7122edab0cd 100644 (file)
@@ -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");}
index 9ebb3fca3bd1fa8f457f1b586e6ac586c12929d4..ea791e8d06887f489ed20b1915f2fb39668501d5 100644 (file)
     
     <ajc-test dir="bugs153/pr149071" title="visibility problem">
       <compile files="AspectItd.java"/>
+      <run class="AspectItd"/>
     </ajc-test>    
     
     <ajc-test dir="bugs153/pr147841" title="advice not woven on aspectpath">