From 0b39aa5dd0218561f11258ac272112ada447065e Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 13 Feb 2006 10:51:11 +0000 Subject: [PATCH] fix for 119882 (from Helen) - similar to fix for 113531 --- .../PR119882/base/src/pack/A1.aj | 6 ++++ .../PR119882/base/src/pack/A2.aj | 11 +++++++ .../PR119882/base/src/pack/C1.java | 12 ++++++++ .../PR119882/base/src/pack/C2.java | 9 ++++++ .../PR119882/inc1/src/pack/C1.java | 11 +++++++ .../PR119882/inc2/src/pack/A1.aj | 6 ++++ .../tools/MultiProjectIncrementalTests.java | 29 +++++++++++++++++++ .../org/aspectj/weaver/bcel/BcelWeaver.java | 5 ++++ 8 files changed, 89 insertions(+) create mode 100644 tests/multiIncremental/PR119882/base/src/pack/A1.aj create mode 100644 tests/multiIncremental/PR119882/base/src/pack/A2.aj create mode 100644 tests/multiIncremental/PR119882/base/src/pack/C1.java create mode 100644 tests/multiIncremental/PR119882/base/src/pack/C2.java create mode 100644 tests/multiIncremental/PR119882/inc1/src/pack/C1.java create mode 100644 tests/multiIncremental/PR119882/inc2/src/pack/A1.aj diff --git a/tests/multiIncremental/PR119882/base/src/pack/A1.aj b/tests/multiIncremental/PR119882/base/src/pack/A1.aj new file mode 100644 index 000000000..5587c2a50 --- /dev/null +++ b/tests/multiIncremental/PR119882/base/src/pack/A1.aj @@ -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 index 000000000..2d9a3e4fb --- /dev/null +++ b/tests/multiIncremental/PR119882/base/src/pack/A2.aj @@ -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 index 000000000..241e2a8e8 --- /dev/null +++ b/tests/multiIncremental/PR119882/base/src/pack/C1.java @@ -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 index 000000000..55475687f --- /dev/null +++ b/tests/multiIncremental/PR119882/base/src/pack/C2.java @@ -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 index 000000000..b50eae1a4 --- /dev/null +++ b/tests/multiIncremental/PR119882/inc1/src/pack/C1.java @@ -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 index 000000000..5c003a7d0 --- /dev/null +++ b/tests/multiIncremental/PR119882/inc2/src/pack/A1.aj @@ -0,0 +1,6 @@ +package pack; + +public abstract aspect A1 { + + private int i = 1; +} diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index 03ab2daef..0623ee58a 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -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"); diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java index 7b62788a9..64692bf40 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java @@ -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); -- 2.39.5