From: jhugunin Date: Tue, 22 Jul 2003 22:51:34 +0000 (+0000) Subject: fix and expanded tests for Bugzilla Bug 39462 X-Git-Tag: V1_1_1~214 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9894a3d4826ef3480a53aa7cd8d86804af3f1fdd;p=aspectj.git fix and expanded tests for Bugzilla Bug 39462 Compiler crashes in jar and cflow --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java index 4b598afce..e965ea031 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java @@ -228,4 +228,8 @@ public class EclipseSourceType extends ResolvedTypeX.ConcreteName { return typeMungers; } + public boolean doesNotExposeShadowMungers() { + return true; + } + } diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 3f01a7cb6..e133841a2 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -6433,4 +6433,21 @@ + + + + + + + + + + + + + + diff --git a/tests/ajcTestsFailing.xml b/tests/ajcTestsFailing.xml index 4292bacbd..cb741c1e0 100644 --- a/tests/ajcTestsFailing.xml +++ b/tests/ajcTestsFailing.xml @@ -3,11 +3,6 @@ - - - - + diff --git a/tests/bugs/cflowAndJar/AbstractAspect.aj b/tests/bugs/cflowAndJar/AbstractAspect.aj index 529cc08b6..24e786213 100644 --- a/tests/bugs/cflowAndJar/AbstractAspect.aj +++ b/tests/bugs/cflowAndJar/AbstractAspect.aj @@ -1,6 +1,13 @@ public abstract aspect AbstractAspect{ public abstract pointcut directCall(); + before(): directCall(){ - System.out.println("direct"); + noteDirectCall(); } + + abstract void noteDirectCall(); + + public abstract pointcut badCall(); + + declare warning: badCall(): "bad"; } diff --git a/tests/bugs/cflowAndJar/Test.java b/tests/bugs/cflowAndJar/Test.java index 079ac6b22..9349ca4b0 100644 --- a/tests/bugs/cflowAndJar/Test.java +++ b/tests/bugs/cflowAndJar/Test.java @@ -1,8 +1,15 @@ -public class Test{ +import org.aspectj.testing.Tester; + +public class Test { public static void main(String[] arguments){ Test test = new Test(); - test.sayHello(); + Tester.checkEqual(TestAspect.sawDirectCall, false, "no calls"); + test.doSayHello(); + Tester.checkEqual(TestAspect.sawDirectCall, false, "non-cflow"); + + test.sayHello(); + Tester.checkEqual(TestAspect.sawDirectCall, true, "in-cflow"); } public void sayHello(){ diff --git a/tests/bugs/cflowAndJar/TestAspect.aj b/tests/bugs/cflowAndJar/TestAspect.aj index a6ed50ae6..78c93e86a 100644 --- a/tests/bugs/cflowAndJar/TestAspect.aj +++ b/tests/bugs/cflowAndJar/TestAspect.aj @@ -1,6 +1,15 @@ public aspect TestAspect extends AbstractAspect{ public pointcut directCall(): execution(void Test.doSayHello(..)) - && cflow(execution(void Test.direct(..))) + && cflow(execution(void Test.sayHello(..))) ; + + public pointcut badCall(): + call(void Test.doSayHello(..)) && withincode(void Test.sayHello(..)); + + void noteDirectCall() { + sawDirectCall = true; + } + + public static boolean sawDirectCall = false; } diff --git a/tests/bugs/cflowAndJar/lib.jar b/tests/bugs/cflowAndJar/lib.jar index e80bb93b8..46368f2d2 100644 Binary files a/tests/bugs/cflowAndJar/lib.jar and b/tests/bugs/cflowAndJar/lib.jar differ diff --git a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java index 9de2348ea..12bab5521 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java +++ b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java @@ -372,7 +372,7 @@ public abstract class ResolvedTypeX extends TypeX { private final Collection collectShadowMungers() { - if (! this.isAspect() || this.isAbstract()) return Collections.EMPTY_LIST; + if (! this.isAspect() || this.isAbstract() || this.doesNotExposeShadowMungers()) return Collections.EMPTY_LIST; ArrayList acc = new ArrayList(); final Iterators.Filter dupFilter = Iterators.dupFilter(); @@ -393,6 +393,10 @@ public abstract class ResolvedTypeX extends TypeX { return acc; } + protected boolean doesNotExposeShadowMungers() { + return false; + } + public PerClause getPerClause() { return null; } protected Collection getDeclares() { return Collections.EMPTY_LIST; @@ -633,6 +637,10 @@ public abstract class ResolvedTypeX extends TypeX { public void setStartPos(int startPos) { this.startPos = startPos; } + + public boolean doesNotExposeShadowMungers() { + return delegate.doesNotExposeShadowMungers(); + } } @@ -682,6 +690,14 @@ public abstract class ResolvedTypeX extends TypeX { // return sourceContext; // } + /** + * Designed to be overriden by EclipseType to disable collection of shadow mungers + * during pre-weave compilation phase + */ + public boolean doesNotExposeShadowMungers() { + return false; + } + public boolean isExposedToWeaver() { return exposedToWeaver; }