]> source.dussan.org Git - aspectj.git/commitdiff
Bug 475152 - infinite loop during build time weaving when more than 2 aspects in...
authorAndy Clement <aclement@pivotal.io>
Wed, 2 Sep 2015 16:49:22 +0000 (09:49 -0700)
committerAndy Clement <aclement@pivotal.io>
Wed, 2 Sep 2015 16:49:22 +0000 (09:49 -0700)
tests/bugs187/475152/AbstractAspect.aj [new file with mode: 0644]
tests/bugs187/475152/AjTarget.java [new file with mode: 0644]
tests/bugs187/475152/BaseAspect.aj [new file with mode: 0644]
tests/bugs187/475152/TestAspect.aj [new file with mode: 0644]
tests/bugs187/475152/TestClass.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc187/Ajc187Tests.java
tests/src/org/aspectj/systemtest/ajc187/ajc187.xml
weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java

diff --git a/tests/bugs187/475152/AbstractAspect.aj b/tests/bugs187/475152/AbstractAspect.aj
new file mode 100644 (file)
index 0000000..7003b8b
--- /dev/null
@@ -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 (file)
index 0000000..c025185
--- /dev/null
@@ -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 (file)
index 0000000..ddfaa31
--- /dev/null
@@ -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 (file)
index 0000000..be1adea
--- /dev/null
@@ -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 (file)
index 0000000..1b13a90
--- /dev/null
@@ -0,0 +1,11 @@
+package ajtest;
+
+public class TestClass {
+       @AjTarget
+       private Long test;
+       
+       public void testMethod() {
+               Object o = test;
+               System.out.println(o);
+       }
+}
index 4907eeafe9b6c1dc2a9284a50f84ce857fd4b7e3..ece3240e0718d0412304a82075c35673694e5a0b 100644 (file)
@@ -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");
        }
index ccf87e34fbc8378e7c5098dfd9b94dac7f997472..e6db6d5e51ea5483db1070d065c08d6b68d6de38 100644 (file)
@@ -2,6 +2,10 @@
 
 <suite>
 
+<ajc-test dir="bugs187/475152" title="infinite loop">
+<compile files="AbstractAspect.aj, BaseAspect.aj, TestClass.java, AjTarget.java, TestAspect.aj" options="-1.8"/>
+</ajc-test>
+
 <ajc-test dir="bugs187/469889" title="broken java">
 <!-- 
 <compile files="A.java B.java AbstractA.java BImpl.java Main.java" options="-1.8"/>
index 64d6a1054a59af1164679320d0f984b294ce0279..a9f214723627d2deec90e008e96bbb12d0f3bcab 100644 (file)
@@ -243,10 +243,11 @@ class BcelAdvice extends Advice {
                                containsInvokedynamic = 1;
                                LazyMethodGen lmg = boType.getLazyClassGen().getLazyMethodGen(this.signature.getName(), this.signature.getSignature(), true);
                                // Check Java8 supertypes
+                               ResolvedType searchType = concreteAspect;
                                while (lmg == null) {
-                                       ResolvedType superType = boType.getSuperclass();
-                                       if (superType == null) break;
-                                       ReferenceTypeDelegate rtd = ((ReferenceType)superType).getDelegate();
+                                       searchType = searchType.getSuperclass();
+                                       if (searchType == null) break;
+                                       ReferenceTypeDelegate rtd = ((ReferenceType)searchType).getDelegate();
                                        if (rtd instanceof BcelObjectType) {
                                                BcelObjectType bot = (BcelObjectType)rtd;
                                                if (bot.javaClass.getMajor() < Constants.MAJOR_1_8) {