aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/features164/joinpointid/Driver.java26
-rw-r--r--tests/src/org/aspectj/systemtest/ajc164/AllTestsAspectJ164.java1
-rw-r--r--tests/src/org/aspectj/systemtest/ajc164/JointpointIdTests.java39
-rw-r--r--tests/src/org/aspectj/systemtest/ajc164/joinpointid.xml19
4 files changed, 85 insertions, 0 deletions
diff --git a/tests/features164/joinpointid/Driver.java b/tests/features164/joinpointid/Driver.java
new file mode 100644
index 000000000..998087ac4
--- /dev/null
+++ b/tests/features164/joinpointid/Driver.java
@@ -0,0 +1,26 @@
+public class Driver {
+ public static void main(String[]argv) {
+ new A().mone();
+ new A().mtwo();
+ new A().mone();
+ new A().mtwo();
+ new A().mone();
+ new A().mtwo();
+ }
+}
+
+class A {
+ public void mone() {}
+ public void mtwo() {}
+}
+
+aspect X pertypewithin(*) {
+
+ int[] state = new int[5];
+
+ before(): execution(* A.*(..)) {
+ int id = thisJoinPointStaticPart.getId();
+ System.out.println("At "+thisJoinPoint.getSignature()+" id="+id+" state="+state[id]);
+ state[id]++;
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc164/AllTestsAspectJ164.java b/tests/src/org/aspectj/systemtest/ajc164/AllTestsAspectJ164.java
index 51f0a5c46..1cd45e428 100644
--- a/tests/src/org/aspectj/systemtest/ajc164/AllTestsAspectJ164.java
+++ b/tests/src/org/aspectj/systemtest/ajc164/AllTestsAspectJ164.java
@@ -20,6 +20,7 @@ public class AllTestsAspectJ164 {
// $JUnit-BEGIN$
suite.addTest(Ajc164Tests.suite());
suite.addTest(DeclareMixinTests.suite());
+ suite.addTest(JointpointIdTests.suite());
// $JUnit-END$
return suite;
}
diff --git a/tests/src/org/aspectj/systemtest/ajc164/JointpointIdTests.java b/tests/src/org/aspectj/systemtest/ajc164/JointpointIdTests.java
new file mode 100644
index 000000000..32716e66c
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc164/JointpointIdTests.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc164;
+
+import java.io.File;
+
+import junit.framework.Test;
+
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+/**
+ *
+ * @author Andy Clement
+ */
+public class JointpointIdTests extends org.aspectj.testing.XMLBasedAjcTestCase {
+
+ public void testCaseA() {
+ runTest("casea");
+ }
+
+ // --
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(JointpointIdTests.class);
+ }
+
+ protected File getSpecFile() {
+ return new File("../tests/src/org/aspectj/systemtest/ajc164/joinpointid.xml");
+ }
+
+} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc164/joinpointid.xml b/tests/src/org/aspectj/systemtest/ajc164/joinpointid.xml
new file mode 100644
index 000000000..6f2bdc79b
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc164/joinpointid.xml
@@ -0,0 +1,19 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<suite>
+
+ <ajc-test dir="features164/joinpointid" title="casea">
+ <compile files="Driver.java" options="-1.5"/>
+ <run class="Driver">
+ <stdout>
+ <line text="At void A.mone() id=0 state=0"/>
+ <line text="At void A.mtwo() id=1 state=0"/>
+ <line text="At void A.mone() id=0 state=1"/>
+ <line text="At void A.mtwo() id=1 state=1"/>
+ <line text="At void A.mone() id=0 state=2"/>
+ <line text="At void A.mtwo() id=1 state=2"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+</suite> \ No newline at end of file