aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ltw
diff options
context:
space:
mode:
authoraclement <aclement>2005-11-11 13:51:57 +0000
committeraclement <aclement>2005-11-11 13:51:57 +0000
commit3226d27a82e968da0f04e6b4fb5a29a03fbdb0f5 (patch)
tree4cf014693721667e4d77cfbfb8338b8042273003 /tests/ltw
parent7218c96f13f61055bf2952778fc0b44848e43663 (diff)
downloadaspectj-3226d27a82e968da0f04e6b4fb5a29a03fbdb0f5.tar.gz
aspectj-3226d27a82e968da0f04e6b4fb5a29a03fbdb0f5.zip
Matthews patches from 95529
Diffstat (limited to 'tests/ltw')
-rw-r--r--tests/ltw/AbstractAspect.aj32
-rw-r--r--tests/ltw/AbstractSuperAspect.aj20
-rw-r--r--tests/ltw/Main.java15
-rw-r--r--tests/ltw/TestITDMethod.java28
-rw-r--r--tests/ltw/TestMain.java20
-rw-r--r--tests/ltw/aop-abstractaspect.xml8
-rw-r--r--tests/ltw/aop-defineaspect.xml8
7 files changed, 130 insertions, 1 deletions
diff --git a/tests/ltw/AbstractAspect.aj b/tests/ltw/AbstractAspect.aj
new file mode 100644
index 000000000..6a735f268
--- /dev/null
+++ b/tests/ltw/AbstractAspect.aj
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthew Webster initial implementation
+ *******************************************************************************/
+import java.lang.reflect.*;
+
+public abstract aspect AbstractAspect {
+
+ /*
+ * These should not take effect unless a concrete sub-aspect is defined
+ */
+ declare parents : TestITDMethod implements Runnable;
+
+ declare soft : InvocationTargetException : execution(public void TestITDMethod.*());
+
+ declare warning : execution(public void main(..)) :
+ "AbstractAspect_main";
+
+ /*
+ * This should always take effect
+ */
+ public void TestITDMethod.test () {
+ System.err.println("AbstractAspect_TestITDMethod.test");
+ }
+}
diff --git a/tests/ltw/AbstractSuperAspect.aj b/tests/ltw/AbstractSuperAspect.aj
new file mode 100644
index 000000000..705085848
--- /dev/null
+++ b/tests/ltw/AbstractSuperAspect.aj
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthew Webster initial implementation
+ *******************************************************************************/
+
+public abstract aspect AbstractSuperAspect {
+
+ protected abstract pointcut scope ();
+
+ before () : execution(void test1()) && scope() {
+ System.err.println("AbstractSuperAspect.before_" + thisJoinPoint.getSignature().getName());
+ }
+}
diff --git a/tests/ltw/Main.java b/tests/ltw/Main.java
index fca018ac9..9e53bfb4d 100644
--- a/tests/ltw/Main.java
+++ b/tests/ltw/Main.java
@@ -9,6 +9,8 @@
* Contributors:
* Matthew Webster initial implementation
*******************************************************************************/
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
public class Main {
@@ -20,7 +22,18 @@ public class Main {
System.out.println("Main.test2");
}
- public static void main (String[] args) {
+ public void invokeDeclaredMethods () throws Exception {
+ Method[] methods = getClass().getDeclaredMethods();
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+ int modifiers = method.getModifiers();
+ if (!Modifier.isStatic(modifiers) && !method.getName().equals("invokeDeclaredMethods")) {
+ method.invoke(this,new Object[] {});
+ }
+ }
+ }
+
+ public static void main (String[] args) throws Exception {
System.out.println("Main.main");
new Main().test1();
new Main().test2();
diff --git a/tests/ltw/TestITDMethod.java b/tests/ltw/TestITDMethod.java
new file mode 100644
index 000000000..8f8d62268
--- /dev/null
+++ b/tests/ltw/TestITDMethod.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthew Webster initial implementation
+ *******************************************************************************/
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+public class TestITDMethod {
+
+ public void invokeDeclaredMethods (String[] names) throws Exception {
+ for (int i = 0; i < names.length; i++) {
+ Method method = getClass().getDeclaredMethod(names[i],new Class[] {});
+ method.invoke(this,new Object[] {});
+ }
+ }
+
+ public static void main (String[] args) throws Exception {
+ System.out.println("TestITDMethod.main");
+ new TestITDMethod().invokeDeclaredMethods(args);
+ }
+}
diff --git a/tests/ltw/TestMain.java b/tests/ltw/TestMain.java
new file mode 100644
index 000000000..b55e94332
--- /dev/null
+++ b/tests/ltw/TestMain.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthew Webster initial implementation
+ *******************************************************************************/
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+public class TestMain {
+
+ public static void main (String[] args) throws Exception {
+ Main.main(args);
+ }
+}
diff --git a/tests/ltw/aop-abstractaspect.xml b/tests/ltw/aop-abstractaspect.xml
new file mode 100644
index 000000000..abd54cc96
--- /dev/null
+++ b/tests/ltw/aop-abstractaspect.xml
@@ -0,0 +1,8 @@
+<aspectj>
+ <aspects>
+ <aspect name="AbstractAspect"/>
+ </aspects>
+
+ <weaver options="-showWeaveInfo -verbose"/>
+</aspectj>
+
diff --git a/tests/ltw/aop-defineaspect.xml b/tests/ltw/aop-defineaspect.xml
new file mode 100644
index 000000000..5fdc064b0
--- /dev/null
+++ b/tests/ltw/aop-defineaspect.xml
@@ -0,0 +1,8 @@
+<aspectj>
+ <aspects>
+ <concrete-aspect name="ConcreteAspect" extends="AbstractSuperAspect">
+ <pointcut name="scope" expression="within(Main)"/>
+ </concrete-aspect>
+ </aspects>
+</aspectj>
+