diff options
author | wisberg <wisberg> | 2002-12-16 18:51:06 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2002-12-16 18:51:06 +0000 |
commit | 144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch) | |
tree | b12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/new/subaspects | |
parent | fafae443719b26159ab2d7dac1c9b46b5e00b671 (diff) | |
download | aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip |
initial version
Diffstat (limited to 'tests/new/subaspects')
-rw-r--r-- | tests/new/subaspects/AbstractAspectUsedStatically.java | 20 | ||||
-rw-r--r-- | tests/new/subaspects/PrivatePointcutCE.java | 6 | ||||
-rw-r--r-- | tests/new/subaspects/child/ChildCE.java | 31 | ||||
-rw-r--r-- | tests/new/subaspects/child/ChildMethodCE.java | 30 | ||||
-rw-r--r-- | tests/new/subaspects/child/ForeignChildAspect.java | 29 | ||||
-rw-r--r-- | tests/new/subaspects/parent/ForeignChildHelper.java | 16 | ||||
-rw-r--r-- | tests/new/subaspects/parent/ParentCE.java | 15 | ||||
-rw-r--r-- | tests/new/subaspects/parent/ParentMethodCE.java | 10 | ||||
-rw-r--r-- | tests/new/subaspects/parent/PrivatePointcut.java | 26 | ||||
-rw-r--r-- | tests/new/subaspects/parent/PrivatePointcutOuterClass.java | 26 | ||||
-rw-r--r-- | tests/new/subaspects/parent/SubAspectVisibility.java | 95 |
11 files changed, 304 insertions, 0 deletions
diff --git a/tests/new/subaspects/AbstractAspectUsedStatically.java b/tests/new/subaspects/AbstractAspectUsedStatically.java new file mode 100644 index 000000000..272e9279b --- /dev/null +++ b/tests/new/subaspects/AbstractAspectUsedStatically.java @@ -0,0 +1,20 @@ + +import org.aspectj.testing.*; + +/** @testcase PR#647 abstract aspect used statically should not cause instantiation of advice or pointcut */ +public abstract aspect AbstractAspectUsedStatically { + public static void main (String[] args) { + Tester.event("main"); + Tester.checkAllEvents(); + } + static { + Tester.expectEvent("main"); + } + + before() : definePrivate() { + Tester.check(false, "definePrivate"); + } + + /** private must be implemented in defining class */ + private pointcut definePrivate() : execution(void main(..)); +} diff --git a/tests/new/subaspects/PrivatePointcutCE.java b/tests/new/subaspects/PrivatePointcutCE.java new file mode 100644 index 000000000..283dded32 --- /dev/null +++ b/tests/new/subaspects/PrivatePointcutCE.java @@ -0,0 +1,6 @@ + +/** @testcase PR#647 aspect with private abstract pointcut */ +abstract aspect PrivatePointcutCE { + /** @testcase abstract private pointcut */ + abstract private pointcut defined(); // CE expected here +} diff --git a/tests/new/subaspects/child/ChildCE.java b/tests/new/subaspects/child/ChildCE.java new file mode 100644 index 000000000..4a0b8377c --- /dev/null +++ b/tests/new/subaspects/child/ChildCE.java @@ -0,0 +1,31 @@ + + +package child; + +import parent.ParentCE; + +import org.aspectj.testing.*; + +public class ChildCE { + public static void main (String[] args) { + new Target().run(); + Tester.checkAllEvents(); + } + static { + Tester.expectEvent("define"); + Tester.expectEvent("run"); + } +} + +class Target { + public void run(){ + Tester.event("run"); + } +} + +/** @testcase PR#647 concrete aspect unable to access abstract package-private pointcut in parent for overriding */ +aspect ParentChild extends ParentCE {// expect CE here: child does not define "define()" b/c inaccessible + protected pointcut define() + : call(public void Target.run()); +} + diff --git a/tests/new/subaspects/child/ChildMethodCE.java b/tests/new/subaspects/child/ChildMethodCE.java new file mode 100644 index 000000000..61bbb8024 --- /dev/null +++ b/tests/new/subaspects/child/ChildMethodCE.java @@ -0,0 +1,30 @@ + + +package child; + +import parent.ParentMethodCE; + +import org.aspectj.testing.*; + +public class ChildMethodCE { + public static void main (String[] args) { + new Target().run(); + Tester.checkAllEvents(); + } + static { + Tester.expectEvent("define"); + Tester.expectEvent("run"); + } +} + +class Target { + public void run(){ + Tester.event("run"); + } +} + +/** @testcase PR#647 attempt to concretize abstract aspect without access to abstract member method */ +class ParentChild extends ParentMethodCE { // expect CE here: child does not define "defineMethod()" b/c inaccessible + protected void defineMethod() {} +} + diff --git a/tests/new/subaspects/child/ForeignChildAspect.java b/tests/new/subaspects/child/ForeignChildAspect.java new file mode 100644 index 000000000..4c65a01ff --- /dev/null +++ b/tests/new/subaspects/child/ForeignChildAspect.java @@ -0,0 +1,29 @@ + +package child; + +import parent.SubAspectVisibility; +import parent.ForeignChildHelper; + +import org.aspectj.testing.*; + +/** @testcase PR#647 inner, outer, and outside-package subaspects of an aspect with abstract protected-, public-, and default-access pointcuts */ +public aspect ForeignChildAspect extends ForeignChildHelper { + public static void main (String[] args) { + Tester.event("ForeignChildAspect.main"); + } + + before() : defineProtected() { + Tester.event("ForeignChildAspect.defineProtected"); + } + + before() : definePublic() { + Tester.event("ForeignChildAspect.definePublic"); + } + + /** can be implemented */ + public pointcut definePublic() : execution(void ForeignChildAspect.main(..)); + + /** can be implemented */ + protected pointcut defineProtected() : execution(void ForeignChildAspect.main(..)); + +} diff --git a/tests/new/subaspects/parent/ForeignChildHelper.java b/tests/new/subaspects/parent/ForeignChildHelper.java new file mode 100644 index 000000000..31b929eb1 --- /dev/null +++ b/tests/new/subaspects/parent/ForeignChildHelper.java @@ -0,0 +1,16 @@ + +package parent; + +import child.ForeignChildAspect; +import parent.SubAspectVisibility; + +import org.aspectj.testing.*; + +/** @testcase PR#647 inner, outer, and outside-package subaspects of an aspect with abstract protected-, public-, and default-access pointcuts */ +public abstract aspect ForeignChildHelper extends SubAspectVisibility { + /** @testCase override package-private pointcut in outer class */ + pointcut definePackagePrivate() : execution(void ForeignChildAspect.main(..)); + before() : definePackagePrivate() { + Tester.event("ForeignChildHelper.definePackagePrivate"); + } +} diff --git a/tests/new/subaspects/parent/ParentCE.java b/tests/new/subaspects/parent/ParentCE.java new file mode 100644 index 000000000..a28dd83d7 --- /dev/null +++ b/tests/new/subaspects/parent/ParentCE.java @@ -0,0 +1,15 @@ + +package parent; + +import org.aspectj.testing.*; + +/** @testcase PR#647 concrete aspect unable to access abstract package-private pointcut in parent for overriding */ +public abstract aspect ParentCE { + abstract pointcut define(); + before() : define() { + Tester.event("define"); + } +} +aspect Child extends ParentCE { + pointcut define() : call(public void Target.run()); +} diff --git a/tests/new/subaspects/parent/ParentMethodCE.java b/tests/new/subaspects/parent/ParentMethodCE.java new file mode 100644 index 000000000..0f25fe2d5 --- /dev/null +++ b/tests/new/subaspects/parent/ParentMethodCE.java @@ -0,0 +1,10 @@ + +package parent; + +import org.aspectj.testing.*; + +/** @testcase PR#647 concrete aspect unable to access abstract package-private method in parent for overriding */ +public abstract class ParentMethodCE { + /** cannot be implemented outside this class */ + abstract void defineMethod(); +} diff --git a/tests/new/subaspects/parent/PrivatePointcut.java b/tests/new/subaspects/parent/PrivatePointcut.java new file mode 100644 index 000000000..1c09fb040 --- /dev/null +++ b/tests/new/subaspects/parent/PrivatePointcut.java @@ -0,0 +1,26 @@ + +package parent; + +import org.aspectj.testing.*; + +/** @testcase PR#647 inner subaspects of an aspect with private pointcut */ +public abstract aspect PrivatePointcut { + public static void main (String[] args) { + Tester.event("main"); + Tester.checkAllEvents(); + } + static { + Tester.expectEvent("main"); + Tester.expectEvent("definePrivate"); + } + + before() : definePrivate() { + Tester.event("definePrivate"); + } + + /** private must be implemented in defining class */ + private pointcut definePrivate() : execution(void PrivatePointcut.main(..)); +} +aspect InnerChild extends PrivatePointcut { +} + diff --git a/tests/new/subaspects/parent/PrivatePointcutOuterClass.java b/tests/new/subaspects/parent/PrivatePointcutOuterClass.java new file mode 100644 index 000000000..7ae3752c0 --- /dev/null +++ b/tests/new/subaspects/parent/PrivatePointcutOuterClass.java @@ -0,0 +1,26 @@ + +package parent; + +import org.aspectj.testing.*; + +/** PR#647 outer subaspects of an aspect with private pointcut */ +public abstract aspect PrivatePointcutOuterClass { + public static void main (String[] args) { + Tester.event("main"); + Tester.checkAllEvents(); + } + static { + Tester.expectEvent("main"); + Tester.expectEvent("definePrivate"); + } + + before() : definePrivate() { + Tester.event("definePrivate"); + } + + /** private must be implemented in defining class */ + private pointcut definePrivate() + : execution(void PrivatePointcutOuterClass.main(..)); +} +aspect InnerChild extends PrivatePointcutOuterClass { } + diff --git a/tests/new/subaspects/parent/SubAspectVisibility.java b/tests/new/subaspects/parent/SubAspectVisibility.java new file mode 100644 index 000000000..e7af8c345 --- /dev/null +++ b/tests/new/subaspects/parent/SubAspectVisibility.java @@ -0,0 +1,95 @@ + +package parent; + +import child.ForeignChildAspect; + +import org.aspectj.testing.*; + +/** @testcase PR#647 inner, outer, and outside-package subaspects of an aspect with abstract protected-, public-, and default-access pointcuts */ +public abstract aspect SubAspectVisibility { + public static void main (String[] args) { + Tester.event("main"); + OuterChild.main(args); + ForeignChildAspect.main(args); + Tester.checkAllEventsIgnoreDups(); + } + static { + Tester.expectEvent("main"); + Tester.expectEvent("definePrivate"); + Tester.expectEvent("definePackagePrivate"); + Tester.expectEvent("defineProtected"); + Tester.expectEvent("definePublic"); + + Tester.expectEvent("Outer.main"); + Tester.expectEvent("Outer.definePackagePrivate"); + Tester.expectEvent("Outer.defineProtected"); + Tester.expectEvent("Outer.definePublic"); + + Tester.expectEvent("ForeignChildAspect.main"); + Tester.expectEvent("ForeignChildHelper.definePackagePrivate"); + Tester.expectEvent("ForeignChildAspect.defineProtected"); + Tester.expectEvent("ForeignChildAspect.definePublic"); + } + + before() : definePrivate() { + Tester.event("definePrivate"); + } + + before() : definePackagePrivate() { + Tester.event("definePackagePrivate"); + } + + before() : defineProtected() { + Tester.event("defineProtected"); + } + + before() : definePublic() { + Tester.event("definePublic"); + } + + /** public can be implemented in outer or inner child class */ + abstract public pointcut definePublic(); + + /** protected can be can be implemented in outer or inner child class */ + abstract protected pointcut defineProtected(); + + /** package-private can be can be implemented in outer or inner child class */ + abstract pointcut definePackagePrivate(); + + /** private must be implemented in defining class */ + private pointcut definePrivate() : execution(void SubAspectVisibility.main(..)); + + // bug? says definePrivate() is not defined in InnerChild + static aspect InnerChild extends SubAspectVisibility { + /** @testCase override protected pointcut in inner class */ + protected pointcut defineProtected() : execution(void SubAspectVisibility.main(..)); + /** @testCase override package-private pointcut in inner class */ + pointcut definePackagePrivate() : execution(void SubAspectVisibility.main(..)); + /** @testCase override public pointcut in inner class */ + public pointcut definePublic() : execution(void SubAspectVisibility.main(..)); + } +} + +aspect OuterChild extends SubAspectVisibility { + public static void main (String[] args) { + Tester.event("Outer.main"); + } + + /** @testCase override package-private pointcut in outer class */ + pointcut definePackagePrivate() : execution(void OuterChild.main(..)); + /** @testCase override protected pointcut in outer class */ + protected pointcut defineProtected() : execution(void OuterChild.main(..)); + /** @testCase override public pointcut in outer class */ + public pointcut definePublic() : execution(void OuterChild.main(..)); + + before() : definePackagePrivate() { + Tester.event("Outer.definePackagePrivate"); + } + before() : defineProtected() { + Tester.event("Outer.defineProtected"); + } + before() : definePublic() { + Tester.event("Outer.definePublic"); + } +} + |