From: acolyer Date: Fri, 4 Nov 2005 13:15:09 +0000 (+0000) Subject: with the change in LTW to default to the same version as the runtime VM (ie java... X-Git-Tag: V1_5_0RC1~248 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b943da4e1ea1e67a684ec23d50668fe28f8abe9c;p=aspectj.git with the change in LTW to default to the same version as the runtime VM (ie java 5 in this case), many LTW tests were failing with Xlint:adviceDidNotMatch messages that previously were not issued. These commits sprinkle @SuppressAjWarnings annotations liberally around to stop that from happening. --- diff --git a/tests/java5/ataspectj/ataspectj/AroundInlineMungerTestAspects.java b/tests/java5/ataspectj/ataspectj/AroundInlineMungerTestAspects.java index 109f29666..5a93d37c3 100644 --- a/tests/java5/ataspectj/ataspectj/AroundInlineMungerTestAspects.java +++ b/tests/java5/ataspectj/ataspectj/AroundInlineMungerTestAspects.java @@ -14,6 +14,7 @@ package ataspectj; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.SuppressAjWarnings; import org.aspectj.lang.ProceedingJoinPoint; /** @@ -38,6 +39,7 @@ public class AroundInlineMungerTestAspects { private static int I; @Around("execution(* ataspectj.AroundInlineMungerTest.target())") + @SuppressAjWarnings public Object around1(ProceedingJoinPoint jp) throws Throwable { aroundCount++; priv(1, 2L, 3); @@ -53,11 +55,13 @@ public class AroundInlineMungerTestAspects { " || get(int ataspectj.AroundInlineMungerTestAspects.Open.I)" + " || set(int ataspectj.AroundInlineMungerTestAspects.Open.I)" + " )&& this(ataspectj.AroundInlineMungerTestAspects.Open)") + @SuppressAjWarnings public void before1() { beforeCount++; } @Around("execution(* ataspectj.AroundInlineMungerTest.target())") + @SuppressAjWarnings public Object around2(ProceedingJoinPoint jp) throws Throwable { aroundCount++; super.superMethod(); @@ -67,6 +71,7 @@ public class AroundInlineMungerTestAspects { } @Around("execution(* ataspectj.AroundInlineMungerTest.target())") + @SuppressAjWarnings public Object around3(ProceedingJoinPoint jp) throws Throwable { aroundCount++; // all those field access will be wrapped diff --git a/tests/java5/ataspectj/ataspectj/AroundInlineMungerTestAspects2.aj b/tests/java5/ataspectj/ataspectj/AroundInlineMungerTestAspects2.aj index 28d7f05af..59c2b96df 100644 --- a/tests/java5/ataspectj/ataspectj/AroundInlineMungerTestAspects2.aj +++ b/tests/java5/ataspectj/ataspectj/AroundInlineMungerTestAspects2.aj @@ -14,6 +14,7 @@ package ataspectj; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.SuppressAjWarnings; import org.aspectj.lang.ProceedingJoinPoint; /** @@ -36,6 +37,7 @@ public class AroundInlineMungerTestAspects2 { private int i; private static int I; + @SuppressAjWarnings Object around() : execution(* ataspectj.AroundInlineMungerTest2.target()) { aroundCount++; priv(1, 2L, 3); @@ -45,6 +47,7 @@ public class AroundInlineMungerTestAspects2 { } // this advice to test around advice body call/get/set advising + @SuppressAjWarnings before() : (call(* ataspectj.AroundInlineMungerTestAspects2.Open.priv(..)) || get(int ataspectj.AroundInlineMungerTestAspects2.Open.i) || set(int ataspectj.AroundInlineMungerTestAspects2.Open.i) @@ -54,6 +57,7 @@ public class AroundInlineMungerTestAspects2 { beforeCount++; } + @SuppressAjWarnings Object around() : execution(* ataspectj.AroundInlineMungerTest2.target()) { aroundCount++; super.superMethod(); @@ -62,6 +66,7 @@ public class AroundInlineMungerTestAspects2 { return proceed(); } + @SuppressAjWarnings Object around() : execution(* ataspectj.AroundInlineMungerTest2.target()) { aroundCount++; // all those field access will be wrapped diff --git a/tests/java5/ataspectj/ataspectj/BindingTest.java b/tests/java5/ataspectj/ataspectj/BindingTest.java index 62e1dfe13..3c30ff101 100644 --- a/tests/java5/ataspectj/ataspectj/BindingTest.java +++ b/tests/java5/ataspectj/ataspectj/BindingTest.java @@ -21,6 +21,7 @@ import org.aspectj.lang.Aspects; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.annotation.SuppressAjWarnings; import java.security.PrivilegedAction; @@ -108,6 +109,7 @@ public class BindingTest extends TestCase { void pc(int arg2, int arg1) {}// see rather fancy ordering here.. // see return int here. + @SuppressAjWarnings @Around("pc(argAdvice2, argAdvice1) && target(t)")//see here ordering remade consistent public int aaround(ProceedingJoinPoint jp, BindingTest t, int argAdvice1, int argAdvice2) throws Throwable { int res = ((Integer)jp.proceed()).intValue(); @@ -117,12 +119,14 @@ public class BindingTest extends TestCase { @Pointcut("call(int dup(int)) && within(ataspectj.BindingTest) && args(arg1)") void pc2(int arg1) {} + @SuppressAjWarnings @Around("pc2(argAdvice1)") public Object aaround2(int argAdvice1, ProceedingJoinPoint jp) throws Throwable { int res = ((Integer)jp.proceed(new Object[]{new Integer(argAdvice1-1)})).intValue(); return new Integer(res/3*2); } + @SuppressAjWarnings @Around("call(int echo(int)) && withincode(void ataspectj.BindingTest.testProceedInInner()) && args(i)") public int aaround3(int i, final ProceedingJoinPoint jp) throws Throwable { final StringBuffer sb = new StringBuffer(); @@ -143,12 +147,14 @@ public class BindingTest extends TestCase { return Integer.parseInt(sb.toString())*2; } - @Around("call(int echo(int)) && withincode(void ataspectj.BindingTest.testNoProceed()) && args(i)") + @SuppressAjWarnings + @Around("call(int echo(int)) && withincode(void ataspectj.BindingTest.testNoProceed()) && args(i)") public int aaround4(int i, final ProceedingJoinPoint jp) throws Throwable { // since no proceed() is call, this advice won't be inlined return 0; } + @SuppressAjWarnings @Around("call(int echo(int)) && withincode(void ataspectj.BindingTest.testDoubleProceed()) && args(i)") public int aaround5(int i, final ProceedingJoinPoint jp) throws Throwable { int i1 = ((Integer)jp.proceed()).intValue(); @@ -156,7 +162,8 @@ public class BindingTest extends TestCase { return i1 + i2; } - @Around("call(int echo(int)) && withincode(void ataspectj.BindingTest.testDoubleProceedOneInner()) && args(i)") + @SuppressAjWarnings + @Around("call(int echo(int)) && withincode(void ataspectj.BindingTest.testDoubleProceedOneInner()) && args(i)") public int aaround6(int i, final ProceedingJoinPoint jp) throws Throwable { int i1 = ((Integer)jp.proceed()).intValue(); Object io2 = new PrivilegedAction() { @@ -179,13 +186,15 @@ public class BindingTest extends TestCase { } } + @SuppressAjWarnings @Around("call(int echo(int)) && withincode(void ataspectj.BindingTest.testAccessAspectState()) && args(i)") public Object aaround7(int i, final ProceedingJoinPoint jp) throws Throwable { m_count++;// will be wrapped for inlining support return jp.proceed(); } - @Around("call(int echo(int)) && withincode(void ataspectj.BindingTest.testTryCatch()) && args(i)") + @SuppressAjWarnings + @Around("call(int echo(int)) && withincode(void ataspectj.BindingTest.testTryCatch()) && args(i)") public Object aaround8(int i, final ProceedingJoinPoint jp) throws Throwable { try { return 2*((Integer)jp.proceed()).intValue(); diff --git a/tests/java5/ataspectj/ataspectj/CflowTest.java b/tests/java5/ataspectj/ataspectj/CflowTest.java index 781e3acad..1dc243b2a 100644 --- a/tests/java5/ataspectj/ataspectj/CflowTest.java +++ b/tests/java5/ataspectj/ataspectj/CflowTest.java @@ -14,6 +14,7 @@ package ataspectj; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.SuppressAjWarnings; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.runtime.internal.CFlowCounter; @@ -63,7 +64,7 @@ public class CflowTest extends TestCase { //LTW will add: //public static final CFlowCounter ajc$cflowCounter$0 = new CFlowCounter(); - + @SuppressAjWarnings @Before("execution(* ataspectj.CflowTest.hello(..)) && this(t) && cflow(execution(* ataspectj.CflowTest.startCflow(..)))") public void before(Object t, JoinPoint jp) { assertEquals(CflowTest.class.getName(), t.getClass().getName()); diff --git a/tests/java5/ataspectj/ataspectj/PerClauseInheritanceTest.java b/tests/java5/ataspectj/ataspectj/PerClauseInheritanceTest.java index 7438dc409..fe1d6456b 100644 --- a/tests/java5/ataspectj/ataspectj/PerClauseInheritanceTest.java +++ b/tests/java5/ataspectj/ataspectj/PerClauseInheritanceTest.java @@ -14,6 +14,7 @@ package ataspectj; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.SuppressAjWarnings; import junit.framework.TestCase; /** @@ -69,6 +70,7 @@ public class PerClauseInheritanceTest extends TestCase { COUNT++; } + @SuppressAjWarnings @Before("pc()") public void abefore() { log("aop"); diff --git a/tests/java5/ataspectj/ataspectj/PerClauseTestAspects.java b/tests/java5/ataspectj/ataspectj/PerClauseTestAspects.java index 414e52573..5c0f27cde 100644 --- a/tests/java5/ataspectj/ataspectj/PerClauseTestAspects.java +++ b/tests/java5/ataspectj/ataspectj/PerClauseTestAspects.java @@ -13,6 +13,7 @@ package ataspectj; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.SuppressAjWarnings; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.Aspects; import junit.framework.Assert; @@ -29,6 +30,7 @@ public class PerClauseTestAspects { s_count++; } + @SuppressAjWarnings @Before("execution(* ataspectj.PerClauseTest.perSingleton()) && target(t)") public void before(JoinPoint jp, Object t) { PerClauseTest.log("AOP."+jp.getSignature().getName()); @@ -44,6 +46,7 @@ public class PerClauseTestAspects { s_count++; } + @SuppressAjWarnings @Before("execution(* ataspectj.PerClauseTest.perTarget()) && target(t)") public void before(JoinPoint jp, Object t) { PerClauseTest.log("AOP."+jp.getSignature().getName()); @@ -59,6 +62,7 @@ public class PerClauseTestAspects { s_count++; } + @SuppressAjWarnings @Before("execution(* ataspectj.PerClauseTest.perCflow())") public void before(JoinPoint jp) { PerClauseTest.log("AOP."+jp.getSignature().getName()); @@ -74,6 +78,7 @@ public class PerClauseTestAspects { s_count++; } + @SuppressAjWarnings @Before("execution(* ataspectj.PerClauseTest.PTW*.foo())") public void before(JoinPoint jp) { ; @@ -89,6 +94,7 @@ public class PerClauseTestAspects { s_count++; } + @SuppressAjWarnings @Before("execution(* ataspectj.PerClauseTest.PerThis.foo())") public void before(JoinPoint jp) { a_count++; diff --git a/tests/java5/ataspectj/ataspectj/PointcutReferenceTest.java b/tests/java5/ataspectj/ataspectj/PointcutReferenceTest.java index 10eb24c2e..895765cd2 100644 --- a/tests/java5/ataspectj/ataspectj/PointcutReferenceTest.java +++ b/tests/java5/ataspectj/ataspectj/PointcutReferenceTest.java @@ -18,6 +18,7 @@ import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.annotation.SuppressAjWarnings; import org.aspectj.lang.JoinPoint; import org.aspectj.runtime.internal.CFlowCounter; import junit.framework.TestCase; @@ -75,6 +76,7 @@ public class PointcutReferenceTest extends TestCase { @Pointcut("pcRef()") void pcRef2() {} + @SuppressAjWarnings @Before("pcRef2()") public void before(JoinPoint jp) { log("before"); @@ -86,6 +88,7 @@ public class PointcutReferenceTest extends TestCase { " && ataspectj.PointcutReferenceTest.RefAspect.pcRefObjectBinding(t)") void pcRefBinding(Object t) {} + @SuppressAjWarnings @Before("pcRefBinding(ttt)") public void before(Object ttt, JoinPoint jp) { log("beforeWithRef"); diff --git a/tests/java5/ataspectj/ataspectj/PrecedenceTest.java b/tests/java5/ataspectj/ataspectj/PrecedenceTest.java index fe96161f8..0a2b2cd37 100644 --- a/tests/java5/ataspectj/ataspectj/PrecedenceTest.java +++ b/tests/java5/ataspectj/ataspectj/PrecedenceTest.java @@ -17,6 +17,7 @@ import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.DeclarePrecedence; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.SuppressAjWarnings; import java.lang.annotation.Annotation; @@ -56,6 +57,7 @@ public class PrecedenceTest extends TestCase { @Aspect() public static class TestAspect_1 { + @SuppressAjWarnings @Before("execution(* ataspectj.PrecedenceTest.hello())") public void before() { log("TestAspect_1"); @@ -65,6 +67,7 @@ public class PrecedenceTest extends TestCase { @Aspect() @DeclarePrecedence("ataspectj.PrecedenceTest.TestAspect_3, ataspectj.PrecedenceTest.TestAspect_1") public static class TestAspect_2 { + @SuppressAjWarnings @Before("execution(* ataspectj.PrecedenceTest.hello())") public void before() { log("TestAspect_2"); @@ -73,6 +76,7 @@ public class PrecedenceTest extends TestCase { @Aspect() public static class TestAspect_3 { + @SuppressAjWarnings @Before("execution(* ataspectj.PrecedenceTest.hello())") public void before() { log("TestAspect_3"); diff --git a/tests/java5/ataspectj/ataspectj/SingletonInheritanceTest.java b/tests/java5/ataspectj/ataspectj/SingletonInheritanceTest.java index 9393afaae..660d9d5ea 100644 --- a/tests/java5/ataspectj/ataspectj/SingletonInheritanceTest.java +++ b/tests/java5/ataspectj/ataspectj/SingletonInheritanceTest.java @@ -14,6 +14,7 @@ package ataspectj; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.SuppressAjWarnings; import junit.framework.TestCase; /** @@ -69,11 +70,13 @@ public class SingletonInheritanceTest extends TestCase { @Aspect static class ChildAspect extends ParentAspect { + @SuppressAjWarnings @Before("pc()") public void abefore() { log("aop"); } + @SuppressAjWarnings @Before("ataspectj.SingletonInheritanceTest.AbstractAspect.pc2()") public void abefore2() { log("aop2"); diff --git a/tests/java5/ataspectj/ataspectj/XXJoinPointTest.java b/tests/java5/ataspectj/ataspectj/XXJoinPointTest.java index d14eb8a03..1bbd4e87f 100644 --- a/tests/java5/ataspectj/ataspectj/XXJoinPointTest.java +++ b/tests/java5/ataspectj/ataspectj/XXJoinPointTest.java @@ -18,6 +18,7 @@ import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.SuppressAjWarnings; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.JoinPoint; @@ -56,18 +57,21 @@ public class XXJoinPointTest extends TestCase { @Pointcut("call(* ataspectj.XXJoinPointTest.hello()) && within(ataspectj.XXJoinPointTest)") void pc() {} + @SuppressAjWarnings @Before("pc()") public void before(JoinPoint jp) { assertEquals("hello", jp.getSignature().getName()); log("jp"); } + @SuppressAjWarnings @Before("pc()") public void before(JoinPoint.StaticPart sjp) { assertEquals("hello", sjp.getSignature().getName()); log("sjp"); } + @SuppressAjWarnings @Before("pc()") public void beforeEnclosing(JoinPoint.EnclosingStaticPart esjp) { assertEquals("testJoinPointsInAdviceSignature", esjp.getSignature().getName()); @@ -75,6 +79,7 @@ public class XXJoinPointTest extends TestCase { } //weird order + @SuppressAjWarnings @Before("pc()") public void beforeWEIRD1(JoinPoint jp, JoinPoint.StaticPart sjp) { assertEquals("hello", jp.getSignature().getName()); @@ -82,6 +87,7 @@ public class XXJoinPointTest extends TestCase { log("jp-sjp"); } + @SuppressAjWarnings @Before("pc()") public void before(JoinPoint.StaticPart sjp, JoinPoint.EnclosingStaticPart esjp) { assertEquals("hello", sjp.getSignature().getName()); @@ -90,6 +96,7 @@ public class XXJoinPointTest extends TestCase { } // conventional order + @SuppressAjWarnings @Before("pc()") public void before(JoinPoint.StaticPart sjp, JoinPoint jp, JoinPoint.EnclosingStaticPart esjp) { assertEquals("hello", sjp.getSignature().getName()); @@ -99,6 +106,7 @@ public class XXJoinPointTest extends TestCase { } // weird order + @SuppressAjWarnings @Before("pc()") public void beforeWEIRD2(JoinPoint.EnclosingStaticPart esjp, JoinPoint jp, JoinPoint.StaticPart sjp) { assertEquals("testJoinPointsInAdviceSignature", esjp.getSignature().getName());