summaryrefslogtreecommitdiffstats
path: root/ajde
diff options
context:
space:
mode:
authormkersten <mkersten>2004-10-14 21:45:07 +0000
committermkersten <mkersten>2004-10-14 21:45:07 +0000
commit4a4d4b2612ab6bbd9c82dc03b08b13f696725bf3 (patch)
tree1655439b851c7caad506cf53b8500a1a929696fd /ajde
parent0a77939b3286d5ac033797234741436c57ad202f (diff)
downloadaspectj-4a4d4b2612ab6bbd9c82dc03b08b13f696725bf3.tar.gz
aspectj-4a4d4b2612ab6bbd9c82dc03b08b13f696725bf3.zip
Added "uses pointcut" relation to the ASM.
Diffstat (limited to 'ajde')
-rw-r--r--ajde/testdata/examples/coverage/ModelCoverage.java13
-rw-r--r--ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java29
2 files changed, 39 insertions, 3 deletions
diff --git a/ajde/testdata/examples/coverage/ModelCoverage.java b/ajde/testdata/examples/coverage/ModelCoverage.java
index bbab87a2f..a853ec83d 100644
--- a/ajde/testdata/examples/coverage/ModelCoverage.java
+++ b/ajde/testdata/examples/coverage/ModelCoverage.java
@@ -142,6 +142,19 @@ abstract class ModifiersCoverage {
abstract void abstractM();
}
+aspect Pointcuts {
+ pointcut a(): call(Point.new(..));
+}
+
+aspect PointcutUsage {
+
+ pointcut usesA(): Pointcuts.a() && within(Point);
+
+ pointcut usesUsesA(): usesA();
+
+ after(): usesUsesA() { }
+}
+
diff --git a/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java b/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java
index 64b365276..f693571a5 100644
--- a/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java
+++ b/ajde/testsrc/org/aspectj/ajde/AsmRelationshipsTest.java
@@ -18,7 +18,9 @@ import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IProgramElement;
import org.aspectj.asm.IRelationship;
-// TODO: check for return types
+/**
+ * @author Mik Kersten
+ */
public class AsmRelationshipsTest extends AjdeTestCase {
private AsmManager manager = null;
@@ -28,10 +30,31 @@ public class AsmRelationshipsTest extends AjdeTestCase {
super(name);
}
+ public void testUsesPointcut() {
+ IProgramElement ptUsage = AsmManager.getDefault().getHierarchy().findElementForType(null, "PointcutUsage");
+ assertNotNull(ptUsage);
+ IProgramElement pts = AsmManager.getDefault().getHierarchy().findElementForType(null, "Pointcuts");
+ assertNotNull(pts);
+
+ IProgramElement pUsesA = manager.getHierarchy().findElementForLabel(
+ ptUsage,
+ IProgramElement.Kind.POINTCUT,
+ "usesA()"/*Point"*/);
+ assertNotNull(pUsesA);
+
+ IProgramElement ptsA = manager.getHierarchy().findElementForLabel(
+ pts,
+ IProgramElement.Kind.POINTCUT,
+ "a()"/*Point"*/);
+ assertNotNull(ptsA);
+
+ assertTrue(AsmManager.getDefault().getRelationshipMap().get(pUsesA).size()>0);
+ assertTrue(AsmManager.getDefault().getRelationshipMap().get(ptsA).size()>0);
+ }
+
public void testDeclareParents() {
IProgramElement aspect = AsmManager.getDefault().getHierarchy().findElementForType(null, "DeclareCoverage");
-// System.err.println(aspect.getChildren());
-
+
IProgramElement dp = manager.getHierarchy().findElementForLabel(
aspect,
IProgramElement.Kind.DECLARE_PARENTS,