]> source.dussan.org Git - aspectj.git/commitdiff
fix for 119882 (from Helen) - similar to fix for 113531
authoraclement <aclement>
Mon, 13 Feb 2006 10:51:11 +0000 (10:51 +0000)
committeraclement <aclement>
Mon, 13 Feb 2006 10:51:11 +0000 (10:51 +0000)
tests/multiIncremental/PR119882/base/src/pack/A1.aj [new file with mode: 0644]
tests/multiIncremental/PR119882/base/src/pack/A2.aj [new file with mode: 0644]
tests/multiIncremental/PR119882/base/src/pack/C1.java [new file with mode: 0644]
tests/multiIncremental/PR119882/base/src/pack/C2.java [new file with mode: 0644]
tests/multiIncremental/PR119882/inc1/src/pack/C1.java [new file with mode: 0644]
tests/multiIncremental/PR119882/inc2/src/pack/A1.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java

diff --git a/tests/multiIncremental/PR119882/base/src/pack/A1.aj b/tests/multiIncremental/PR119882/base/src/pack/A1.aj
new file mode 100644 (file)
index 0000000..5587c2a
--- /dev/null
@@ -0,0 +1,6 @@
+package pack;
+
+public abstract aspect A1 {
+
+       int i = 1;
+}
diff --git a/tests/multiIncremental/PR119882/base/src/pack/A2.aj b/tests/multiIncremental/PR119882/base/src/pack/A2.aj
new file mode 100644 (file)
index 0000000..2d9a3e4
--- /dev/null
@@ -0,0 +1,11 @@
+package pack;
+
+public aspect A2 extends A1 {
+
+       pointcut p() : execution(* C*.log*(..));
+       
+       before() : p() {
+               i = 2;
+       }
+       
+}
diff --git a/tests/multiIncremental/PR119882/base/src/pack/C1.java b/tests/multiIncremental/PR119882/base/src/pack/C1.java
new file mode 100644 (file)
index 0000000..241e2a8
--- /dev/null
@@ -0,0 +1,12 @@
+package pack;
+
+public class C1 {
+
+       int i = 1;
+       
+       public void logMe(){
+               
+       }
+       
+}
+
diff --git a/tests/multiIncremental/PR119882/base/src/pack/C2.java b/tests/multiIncremental/PR119882/base/src/pack/C2.java
new file mode 100644 (file)
index 0000000..5547568
--- /dev/null
@@ -0,0 +1,9 @@
+package pack;
+
+public class C2 extends C1 {
+
+       public void logMe2() {
+               i = 3;
+       }
+       
+}
diff --git a/tests/multiIncremental/PR119882/inc1/src/pack/C1.java b/tests/multiIncremental/PR119882/inc1/src/pack/C1.java
new file mode 100644 (file)
index 0000000..b50eae1
--- /dev/null
@@ -0,0 +1,11 @@
+package pack;
+
+public class C1 {
+
+       private int i = 1;
+       
+       public void logMe(){
+               
+       }
+       
+}
diff --git a/tests/multiIncremental/PR119882/inc2/src/pack/A1.aj b/tests/multiIncremental/PR119882/inc2/src/pack/A1.aj
new file mode 100644 (file)
index 0000000..5c003a7
--- /dev/null
@@ -0,0 +1,6 @@
+package pack;
+
+public abstract aspect A1 {
+
+       private int i = 1;
+}
index 03ab2daefab37528d35581542c791692ff165a49..0623ee58ac4ff47d0ac17a720c031f7b32717745 100644 (file)
@@ -485,6 +485,35 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
                                        .getMessage());
        }
 
+       // Stage 1: Compile the 4 files, pack.A2 extends pack.A1 (aspects) where
+       //          A2 uses a protected field in A1 and pack.C2 extends pack.C1 (classes)
+       //          where C2 uses a protected field in C1
+       // Stage 2: make the field private in class C1 ==> compile errors in C2
+       // Stage 3: make the field private in aspect A1 whilst there's the compile
+       //          error. 
+       // There shouldn't be a BCExcpetion saying can't find delegate for pack.C2
+       public void testPr119882() {
+               initialiseProject("PR119882");
+               build("PR119882");
+               assertFalse("build should have compiled ok",MyTaskListManager.hasErrorMessages());
+               alter("PR119882","inc1");
+               build("PR119882");
+               //fullBuild("PR119882");
+               assertEquals("error message should be 'i cannot be resolved' ",
+                               "i cannot be resolved",
+                               ((IMessage)MyTaskListManager.getErrorMessages().get(0))
+                                       .getMessage());
+               alter("PR119882","inc2");
+               build("PR119882");
+               assertTrue("There should be no exceptions handled:\n"+MyErrorHandler.getErrorMessages(),
+                               MyErrorHandler.getErrorMessages().isEmpty());   
+               assertEquals("error message should be 'i cannot be resolved' ",
+                               "i cannot be resolved",
+                               ((IMessage)MyTaskListManager.getErrorMessages().get(0))
+                                       .getMessage());
+
+       }
+       
        public void testPr112736() {
                AjdeInteractionTestbed.VERBOSE = true;
                initialiseProject("PR112736");
index 7b62788a9a474b9afc734b5b97e348dd41d5d1b1..64692bf40301fd86e2f57410011b4ea8bfc07060 100644 (file)
@@ -1092,6 +1092,11 @@ public class BcelWeaver implements IWeaver {
                        if (!theType.isAspect()) {
                                BcelObjectType classType = BcelWorld.getBcelObjectType(theType);
                                if (classType==null) {
+                                       
+                                       // bug 119882 - see above comment for bug 113531
+                                       ReferenceTypeDelegate theDelegate = ((ReferenceType)theType).getDelegate();
+                                       if (theDelegate.getClass().getName().endsWith("EclipseSourceType")) continue;
+
                                        throw new BCException("Can't find bcel delegate for "+className+" type="+theType.getClass());
                                }
                        weaveAndNotify(classFile, classType, requestor);