diff options
author | wisberg <wisberg> | 2003-08-23 04:22:23 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2003-08-23 04:22:23 +0000 |
commit | 9df9062f3ee68735888de6fc92f5aafa5f2b366e (patch) | |
tree | 5491306a42059f546934b2e480a3d69a07afb31c | |
parent | d90acdcedd63f04b906b0efc5e249e93245f5618 (diff) | |
download | aspectj-9df9062f3ee68735888de6fc92f5aafa5f2b366e.tar.gz aspectj-9df9062f3ee68735888de6fc92f5aafa5f2b366e.zip |
@testcase PR#41888 call PCD fails when given subtype of defining type
-rw-r--r-- | tests/ajcTestsFailing.xml | 7 | ||||
-rw-r--r-- | tests/bugs/CallReference.java | 76 |
2 files changed, 83 insertions, 0 deletions
diff --git a/tests/ajcTestsFailing.xml b/tests/ajcTestsFailing.xml index 5439341a1..35fbdb6a1 100644 --- a/tests/ajcTestsFailing.xml +++ b/tests/ajcTestsFailing.xml @@ -5,6 +5,13 @@ <suite> + <ajc-test dir="bugs" + pr="41888" + title="call PCD fails when given subtype of defining type"> + <compile files="CallReference.java"/> + <run class="CallReference"/> + </ajc-test> + <ajc-test dir="bugs/options/classpath" pr="41170" title="combine classpath on command line and in .lst file"> diff --git a/tests/bugs/CallReference.java b/tests/bugs/CallReference.java new file mode 100644 index 000000000..007bdc612 --- /dev/null +++ b/tests/bugs/CallReference.java @@ -0,0 +1,76 @@ + +import org.aspectj.testing.Tester; +import org.aspectj.lang.JoinPoint; + + +/** @testcase PR#41888 call PCD fails when given subtype of defining type */ +public class CallReference { + public static void main (String[] args) { + // don't move these lines without changing expectEvents below + new Sub().run(); + new SubSub().run(); + new SubSubSub().run(); + ((Super) new Sub()).run(); + ((Super) new SubSub()).run(); + ((Super) new SubSubSub()).run(); + ((Sub) new SubSub()).run(); + ((Sub) new SubSubSub()).run(); + ((SubSub) new SubSubSub()).run(); + } +} + +class Super { void run() {} } +class Sub extends Super { void run() {} } +class SubSub extends Sub { } +class SubSubSub extends SubSub { } + +aspect A { + static { + // generated from System.out call below + Tester.expectEvent("Super 1 10"); + Tester.expectEvent("Sub 2 10"); + Tester.expectEvent("Super 3 11"); + Tester.expectEvent("Sub 4 11"); + Tester.expectEvent("SubSub 5 11"); + Tester.expectEvent("Super 6 12"); + Tester.expectEvent("Sub 7 12"); + Tester.expectEvent("SubSub 8 12"); + Tester.expectEvent("SubSubSub 9 12"); + Tester.expectEvent("Super 10 13"); + Tester.expectEvent("Super 11 14"); + Tester.expectEvent("Super 12 15"); + Tester.expectEvent("Super 13 16"); + Tester.expectEvent("Sub 14 16"); + Tester.expectEvent("Super 15 17"); + Tester.expectEvent("Sub 16 17"); + Tester.expectEvent("Super 17 18"); + Tester.expectEvent("Sub 18 18"); + Tester.expectEvent("SubSub 19 18"); + } + int count; + void advice(String s, JoinPoint.StaticPart jp) { + s = s + + " " + + ++count + + " " + + jp.getSourceLocation().getLine(); + Tester.event(s); + // use after moving code lines above + //System.out.println("Tester.expectEvent(\"" + s + "\");"); + } + before() : call (void Super.run()) { + advice("Super ", thisJoinPointStaticPart); + } + before() : call (void Sub.run()) { + advice("Sub ", thisJoinPointStaticPart); + } + before() : call (void SubSub.run()) { + advice("SubSub", thisJoinPointStaticPart); + } + before() : call (void SubSubSub.run()) { + advice("SubSubSub", thisJoinPointStaticPart); + } + after() returning : execution(void CallReference.main(String[])) { + Tester.checkAllEvents(); + } +} |