summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravasseur <avasseur>2005-05-17 08:59:54 +0000
committeravasseur <avasseur>2005-05-17 08:59:54 +0000
commit8804ab51509ace3479735013356edc571de282cf (patch)
tree6cfe6190fbdbd163475311b09cbb317615f6422c
parent33c5c59a9e5ef8378f8695b905ceddf03f685c2b (diff)
downloadaspectj-8804ab51509ace3479735013356edc571de282cf.tar.gz
aspectj-8804ab51509ace3479735013356edc571de282cf.zip
LTW and around inling test for code style
-rw-r--r--tests/java5/ataspectj/ajc-ant.xml8
-rw-r--r--tests/java5/ataspectj/ataspectj/AroundInlineMungerTest2.aj41
-rw-r--r--tests/java5/ataspectj/ataspectj/AroundInlineMungerTestAspects2.aj87
-rw-r--r--tests/java5/ataspectj/ataspectj/aop-aroundinlinemungertest2.xml7
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java3
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java3
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml9
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ataspectj/syntax.xml5
8 files changed, 163 insertions, 0 deletions
diff --git a/tests/java5/ataspectj/ajc-ant.xml b/tests/java5/ataspectj/ajc-ant.xml
index d6034f2a7..ab0e52437 100644
--- a/tests/java5/ataspectj/ajc-ant.xml
+++ b/tests/java5/ataspectj/ajc-ant.xml
@@ -38,5 +38,13 @@
</java>
</target>
+ <target name="ltw.AroundInlineMungerTest2">
+ <java fork="yes" classname="ataspectj.AroundInlineMungerTest2" failonerror="yes">
+ <classpath refid="aj.path"/>
+ <jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
+ <jvmarg value="-Daj5.def=ataspectj/aop-aroundinlinemungertest2.xml"/>
+ </java>
+ </target>
+
<target name="javac.ltw" depends="compile:javac, ltw"/>
</project> \ No newline at end of file
diff --git a/tests/java5/ataspectj/ataspectj/AroundInlineMungerTest2.aj b/tests/java5/ataspectj/ataspectj/AroundInlineMungerTest2.aj
new file mode 100644
index 000000000..eeec49f9f
--- /dev/null
+++ b/tests/java5/ataspectj/ataspectj/AroundInlineMungerTest2.aj
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * 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:
+ * Alexandre Vasseur initial implementation
+ *******************************************************************************/
+package ataspectj;
+
+import junit.framework.TestCase;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.ProceedingJoinPoint;
+
+/**
+ * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
+ */
+public class AroundInlineMungerTest2 extends TestCase {
+
+ public static void main(String[] args) {
+ TestHelper.runAndThrowOnFailure(suite());
+ }
+
+ public static junit.framework.Test suite() {
+ return new junit.framework.TestSuite(AroundInlineMungerTest2.class);
+ }
+
+ public void testAccessNonPublicFromAroundAdvice() {
+ target();
+ assertEquals(3, AroundInlineMungerTestAspects2.Open.aroundCount);
+ assertEquals(6, AroundInlineMungerTestAspects2.Open.beforeCount);
+ }
+
+ public void target() {}
+
+}
diff --git a/tests/java5/ataspectj/ataspectj/AroundInlineMungerTestAspects2.aj b/tests/java5/ataspectj/ataspectj/AroundInlineMungerTestAspects2.aj
new file mode 100644
index 000000000..28d7f05af
--- /dev/null
+++ b/tests/java5/ataspectj/ataspectj/AroundInlineMungerTestAspects2.aj
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * 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:
+ * Alexandre Vasseur initial implementation
+ *******************************************************************************/
+package ataspectj;
+
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.ProceedingJoinPoint;
+
+/**
+ * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
+ */
+public class AroundInlineMungerTestAspects2 {
+
+ public static abstract aspect OpenBase {
+ protected void superMethod() {}
+ }
+
+ public static abstract aspect OpenSubBase extends OpenBase {}
+
+ // aspect will be prepared for inlining
+ public static aspect Open extends OpenSubBase {
+
+ public static int aroundCount = 0;
+ public static int beforeCount = 0;
+
+ private int i;
+ private static int I;
+
+ Object around() : execution(* ataspectj.AroundInlineMungerTest2.target()) {
+ aroundCount++;
+ priv(1, 2L, 3);
+ super.superMethod();
+ new Inner().priv();//fails to be wrapped so this advice will not be inlined but previous call were still prepared
+ return proceed();
+ }
+
+ // this advice to test around advice body call/get/set advising
+ before() : (call(* ataspectj.AroundInlineMungerTestAspects2.Open.priv(..))
+ || get(int ataspectj.AroundInlineMungerTestAspects2.Open.i)
+ || set(int ataspectj.AroundInlineMungerTestAspects2.Open.i)
+ || get(int ataspectj.AroundInlineMungerTestAspects2.Open.I)
+ || set(int ataspectj.AroundInlineMungerTestAspects2.Open.I)
+ )&& this(ataspectj.AroundInlineMungerTestAspects2.Open) {
+ beforeCount++;
+ }
+
+ Object around() : execution(* ataspectj.AroundInlineMungerTest2.target()) {
+ aroundCount++;
+ super.superMethod();
+ new Inner().priv();//fails to be wrapped so next calls won't be prepared but previous was
+ priv(1, 2L, 3);
+ return proceed();
+ }
+
+ Object around() : execution(* ataspectj.AroundInlineMungerTest2.target()) {
+ aroundCount++;
+ // all those field access will be wrapped
+ int li = i;
+ i = li;
+ int lI = I;
+ I = lI;
+ return proceed();
+ }
+
+ // -- some private member for which access will be wrapped so that around advice can be inlined
+
+ private void priv(int i, long j, int k) {
+ long l = i + j + k;
+ }
+
+ private static class Inner {
+ private Inner() {}
+ private void priv() {};
+ }
+ }
+
+}
diff --git a/tests/java5/ataspectj/ataspectj/aop-aroundinlinemungertest2.xml b/tests/java5/ataspectj/ataspectj/aop-aroundinlinemungertest2.xml
new file mode 100644
index 000000000..3f7de3cd3
--- /dev/null
+++ b/tests/java5/ataspectj/ataspectj/aop-aroundinlinemungertest2.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<aspectj>
+ <weaver options="-XmessageHolderClass:ataspectj.TestHelper"/>
+ <aspects>
+ <aspect name="ataspectj.AroundInlineMungerTestAspects2.Open"/>
+ </aspects>
+</aspectj>
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java
index 214d0cb96..d2bc160e0 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java
@@ -63,5 +63,8 @@ public class AtAjLTWTests extends XMLBasedAjcTestCase {
runTest("AjcLTW AroundInlineMungerTest -XnoInline -Xreweavable");
}
+ public void testAjcLTWAroundInlineMungerTest2() {
+ runTest("AjcLTW AroundInlineMungerTest2");
+ }
}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java
index 7e0921f40..264c46930 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java
@@ -84,4 +84,7 @@ public class AtAjSyntaxTests extends XMLBasedAjcTestCase {
runTest("AroundInlineMunger");
}
+ public void testAroundInlineMunger2() {
+ runTest("AroundInlineMunger2");
+ }
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml
index 1f430a861..5a770808a 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml
@@ -69,4 +69,13 @@
<ant file="ajc-ant.xml" target="ltw.AroundInlineMungerTest" verbose="true"/>
</ajc-test>
+ <ajc-test dir="java5/ataspectj" title="AjcLTW AroundInlineMungerTest2">
+ <compile
+ files="ataspectj/AroundInlineMungerTestAspects2.aj"
+ options="-1.5 -Xlint:ignore"/>
+ <compile
+ files="ataspectj/AroundInlineMungerTest2.aj,ataspectj/TestHelper.java"
+ options="-1.5 -Xreweavable"/>
+ <ant file="ajc-ant.xml" target="ltw.AroundInlineMungerTest2" verbose="true"/>
+ </ajc-test>
</suite> \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/syntax.xml b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/syntax.xml
index 594f736de..055567d30 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/syntax.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/syntax.xml
@@ -95,4 +95,9 @@
<compile files="ataspectj/AroundInlineMungerTest.java,ataspectj/AroundInlineMungerTestAspects.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"/>
<run class="ataspectj.AroundInlineMungerTest"/>
</ajc-test>
+
+ <ajc-test dir="java5/ataspectj" title="AroundInlineMunger2">
+ <compile files="ataspectj/AroundInlineMungerTest2.aj,ataspectj/AroundInlineMungerTestAspects2.aj,ataspectj/TestHelper.java" options="-1.5 -Xlint:ignore"/>
+ <run class="ataspectj.AroundInlineMungerTest2"/>
+ </ajc-test>
</suite> \ No newline at end of file