From a9ea7010ab7075d934aeb49d48dec33d48b722c4 Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Wed, 2 Sep 2015 09:49:22 -0700 Subject: [PATCH] Bug 475152 - infinite loop during build time weaving when more than 2 aspects in hierarchy at org.aspectj.weaver.bcel.BcelAdvice.canInline --- tests/bugs187/475152/AbstractAspect.aj | 5 +++++ tests/bugs187/475152/AjTarget.java | 9 +++++++++ tests/bugs187/475152/BaseAspect.aj | 15 +++++++++++++++ tests/bugs187/475152/TestAspect.aj | 5 +++++ tests/bugs187/475152/TestClass.java | 11 +++++++++++ .../aspectj/systemtest/ajc187/Ajc187Tests.java | 4 ++++ .../src/org/aspectj/systemtest/ajc187/ajc187.xml | 4 ++++ .../src/org/aspectj/weaver/bcel/BcelAdvice.java | 7 ++++--- 8 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 tests/bugs187/475152/AbstractAspect.aj create mode 100644 tests/bugs187/475152/AjTarget.java create mode 100644 tests/bugs187/475152/BaseAspect.aj create mode 100644 tests/bugs187/475152/TestAspect.aj create mode 100644 tests/bugs187/475152/TestClass.java diff --git a/tests/bugs187/475152/AbstractAspect.aj b/tests/bugs187/475152/AbstractAspect.aj new file mode 100644 index 000000000..7003b8bf5 --- /dev/null +++ b/tests/bugs187/475152/AbstractAspect.aj @@ -0,0 +1,5 @@ +package ajtest; + +public abstract aspect AbstractAspect extends BaseAspect { + +} diff --git a/tests/bugs187/475152/AjTarget.java b/tests/bugs187/475152/AjTarget.java new file mode 100644 index 000000000..c025185ba --- /dev/null +++ b/tests/bugs187/475152/AjTarget.java @@ -0,0 +1,9 @@ +package ajtest; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +public @interface AjTarget { + +} diff --git a/tests/bugs187/475152/BaseAspect.aj b/tests/bugs187/475152/BaseAspect.aj new file mode 100644 index 000000000..ddfaa3183 --- /dev/null +++ b/tests/bugs187/475152/BaseAspect.aj @@ -0,0 +1,15 @@ +package ajtest; + +import java.lang.reflect.Field; + +import ajtest.AjTarget; + +public abstract aspect BaseAspect { + + protected pointcut mapped(Object obj) : get(@(AjTarget) Long *) && target(obj); + + Object around(Object obj) : mapped(obj) { + Object value = proceed(obj); + return value; + } +} diff --git a/tests/bugs187/475152/TestAspect.aj b/tests/bugs187/475152/TestAspect.aj new file mode 100644 index 000000000..be1adeaf0 --- /dev/null +++ b/tests/bugs187/475152/TestAspect.aj @@ -0,0 +1,5 @@ +package ajtest; + +public aspect TestAspect extends AbstractAspect { + +} diff --git a/tests/bugs187/475152/TestClass.java b/tests/bugs187/475152/TestClass.java new file mode 100644 index 000000000..1b13a90e1 --- /dev/null +++ b/tests/bugs187/475152/TestClass.java @@ -0,0 +1,11 @@ +package ajtest; + +public class TestClass { + @AjTarget + private Long test; + + public void testMethod() { + Object o = test; + System.out.println(o); + } +} diff --git a/tests/src/org/aspectj/systemtest/ajc187/Ajc187Tests.java b/tests/src/org/aspectj/systemtest/ajc187/Ajc187Tests.java index 4907eeafe..ece3240e0 100644 --- a/tests/src/org/aspectj/systemtest/ajc187/Ajc187Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc187/Ajc187Tests.java @@ -24,6 +24,10 @@ import org.aspectj.testing.XMLBasedAjcTestCase; */ public class Ajc187Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testInfiniteLoop_475152() throws Exception { + runTest("infinite loop"); + } + public void testAnnoConversion_474165() throws Exception { runTest("anno conversion"); } diff --git a/tests/src/org/aspectj/systemtest/ajc187/ajc187.xml b/tests/src/org/aspectj/systemtest/ajc187/ajc187.xml index ccf87e34f..e6db6d5e5 100644 --- a/tests/src/org/aspectj/systemtest/ajc187/ajc187.xml +++ b/tests/src/org/aspectj/systemtest/ajc187/ajc187.xml @@ -2,6 +2,10 @@ + + + +