</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
--- /dev/null
+/*******************************************************************************
+ * 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() {}
+
+}
--- /dev/null
+/*******************************************************************************
+ * 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() {};
+ }
+ }
+
+}
--- /dev/null
+<?xml version="1.0"?>
+<aspectj>
+ <weaver options="-XmessageHolderClass:ataspectj.TestHelper"/>
+ <aspects>
+ <aspect name="ataspectj.AroundInlineMungerTestAspects2.Open"/>
+ </aspects>
+</aspectj>
runTest("AjcLTW AroundInlineMungerTest -XnoInline -Xreweavable");
}
+ public void testAjcLTWAroundInlineMungerTest2() {
+ runTest("AjcLTW AroundInlineMungerTest2");
+ }
}
runTest("AroundInlineMunger");
}
+ public void testAroundInlineMunger2() {
+ runTest("AroundInlineMunger2");
+ }
}
\ No newline at end of file
<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
<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