]> source.dussan.org Git - aspectj.git/commitdiff
Fix 443477: remove pre-init from cflow to avoid verify error on jdk 1.7 later updates
authorAndy Clement <aclement@gopivotal.com>
Tue, 7 Oct 2014 22:07:00 +0000 (15:07 -0700)
committerAndy Clement <aclement@gopivotal.com>
Tue, 7 Oct 2014 22:07:00 +0000 (15:07 -0700)
tests/bugs183/443477/Coo.java
tests/src/org/aspectj/systemtest/ajc183/Ajc183Tests.java
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java

index 7b514f3baede90a927c93bd4391907e2ea388044..3362f502477c5dea269ab878290dfa3a40d84c79 100644 (file)
@@ -1,12 +1,15 @@
 public class Coo {
        Coo() { 
        }
+
+  int i = 4;
+  
        
        public static void main(String[] args) {
        }
 }
 
 aspect Azpect {
-    before(): !cflow(preinitialization(Coo.new(..))) && execution(* main(..)) {  }
+  before(): !cflow(preinitialization(Coo.new(..))) && execution(* main(..)) {  }
 }
 
index 412fc00eb0f73a25d04a61c4f188333d3cd98700..8f1a6ccaca1051d7f1eb3ab89bb1df7e4312954b 100644 (file)
@@ -65,9 +65,9 @@ public class Ajc183Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
                runTest("abstract aspect npe");
        }
        
-//     public void testVerifyError_443447() {
-//             runTest("verifyerror");
-//     }
+       public void testVerifyError_443447() {
+               runTest("verifyerror");
+       }
 //     
 //     public void testAnnoStyleDecp_442425() {
 //             runTest("anno style decp");
index 8c51e0f4909b10a3b863c0ded298841d7d266146..e6676900fd062dceced30976fecd1dbd3c3d3daf 100644 (file)
@@ -2021,7 +2021,9 @@ public class BcelShadow extends Shadow {
 
        public void weaveCflowEntry(final BcelAdvice munger, final Member cflowField) {
                final boolean isPer = munger.getKind() == AdviceKind.PerCflowBelowEntry || munger.getKind() == AdviceKind.PerCflowEntry;
-
+               if (!isPer && getKind() == PreInitialization) {
+                       return;
+               }
                final Type objectArrayType = new ArrayType(Type.OBJECT, 1);
                final InstructionFactory fact = getFactory();
 
@@ -2080,8 +2082,7 @@ public class BcelShadow extends Shadow {
                        entryInstructions.append(entrySuccessInstructions);
                }
 
-               // this is the same for both per and non-per
-               weaveAfter(new BcelAdvice(null, null, null, 0, 0, 0, null, munger.getConcreteAspect()) {
+               BcelAdvice exitAdvice = new BcelAdvice(null, null, null, 0, 0, 0, null, munger.getConcreteAspect()) {
                        @Override
                        public InstructionList getAdviceInstructions(BcelShadow s, BcelVar extraArgVar, InstructionHandle ifNoAdvice) {
                                InstructionList exitInstructions = new InstructionList();
@@ -2100,7 +2101,13 @@ public class BcelShadow extends Shadow {
                                }
                                return exitInstructions;
                        }
-               });
+               };
+//             if (getKind() == PreInitialization) {
+//                     weaveAfterReturning(exitAdvice);
+//             }
+//             else {
+                       weaveAfter(exitAdvice);
+//             }
 
                range.insert(entryInstructions, Range.InsideBefore);
        }