]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for 152589: adviceDidNotMatch incorrectly appearing
authoraclement <aclement>
Thu, 3 Aug 2006 07:23:55 +0000 (07:23 +0000)
committeraclement <aclement>
Thu, 3 Aug 2006 07:23:55 +0000 (07:23 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java
tests/multiIncremental/PR152589/base/A.aj [new file with mode: 0644]
tests/multiIncremental/PR152589/inc1/A.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

index dbc0a12a28375c10f4a781f74995834e30888415..d2cf77b3bf83d164c53ee442dd9610bbbb830260 100644 (file)
@@ -145,7 +145,9 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter {
        private boolean pipelineStalled   = true; 
        private boolean weaverInitialized = false;
        private int toWaitFor;
-
+       //       If we determine we are going to drop back to a full build - don't need to tell the weaver to report adviceDidNotMatch
+       private boolean droppingBackToFullBuild; 
+       
        /**
         * Create an adapter, and tell it everything it needs to now to drive the AspectJ
         * parts of a compile cycle.
@@ -270,6 +272,7 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter {
        public void beforeCompiling(ICompilationUnit[] sourceUnits) {
                resultsPendingWeave = new ArrayList();
                reportedErrors = false;         
+               droppingBackToFullBuild=false;
        }
 
        
@@ -323,7 +326,7 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter {
 //                             acceptResult(unit.compilationResult);
 //                     } else {
                                try {
-                                       weaveQueuedEntries();
+                                       if (weaveQueuedEntries()) droppingBackToFullBuild=true;
                                } catch (IOException ex) {
                                        AbortCompilation ac = new AbortCompilation(null,ex);
                                        throw ac;
@@ -386,7 +389,7 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter {
        }
        if (pipelineStalled) return;
        try {
-               weaveQueuedEntries();
+               if (weaveQueuedEntries()) droppingBackToFullBuild=true;
        } catch (IOException ex) {
                        AbortCompilation ac = new AbortCompilation(null,ex);
                        throw ac;
@@ -438,7 +441,8 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter {
                }
        }
        
-       private void weaveQueuedEntries() throws IOException {
+       /** Return true if we've decided to drop back to a full build (too much has changed) */
+       private boolean weaveQueuedEntries() throws IOException {
                if (debugPipeline)System.err.println(">.weaveQueuedEntries()");
                for (Iterator iter = resultsPendingWeave.iterator(); iter.hasNext();) {
                        InterimCompilationResult iresult = (InterimCompilationResult) iter.next();
@@ -447,11 +451,12 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter {
                        }                       
                }
                ensureWeaverInitialized(); // by doing this only once, are we saying needToReweaveWorld can't change once the aspects have been stuffed into the weaver?
-               if (weaver.needToReweaveWorld() && !isBatchCompile) return;
+               if (weaver.needToReweaveWorld() && !isBatchCompile) return true;
                weaver.weave(new WeaverAdapter(this,weaverMessageHandler,progressListener));
                resultsPendingWeave.clear(); // dont need to do those again
                this.eWorld.minicleanup();
                if (debugPipeline)System.err.println("<.weaveQueuedEntries()");
+               return false;
        }
        
        private void ensureWeaverInitialized() {
@@ -514,7 +519,7 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter {
                CflowPointcut.clearCaches();
                if (imh instanceof WeaverMessageHandler)
                          ((WeaverMessageHandler)imh).setCurrentResult(null);
-               weaver.allWeavingComplete();
+               if (!droppingBackToFullBuild) weaver.allWeavingComplete();
                weaver.tidyUp();
                if (imh instanceof WeaverMessageHandler)
                  ((WeaverMessageHandler)imh).resetCompiler(null);
diff --git a/tests/multiIncremental/PR152589/base/A.aj b/tests/multiIncremental/PR152589/base/A.aj
new file mode 100644 (file)
index 0000000..fd2f786
--- /dev/null
@@ -0,0 +1,13 @@
+
+
+public aspect A {
+    after () throwing (Throwable th) :  execution(* *(..)) {
+               System.err.println(thisEnclosingJoinPointStaticPart);
+       }
+}
+
+class C1 {
+       public void anotherMethod() {
+               
+       }
+}
diff --git a/tests/multiIncremental/PR152589/inc1/A.aj b/tests/multiIncremental/PR152589/inc1/A.aj
new file mode 100644 (file)
index 0000000..a2ebf78
--- /dev/null
@@ -0,0 +1,13 @@
+
+public aspect A {
+    after () throwing (Throwable th) :  execution(* *(..)) {
+               System.err.println(thisEnclosingJoinPointStaticPart);
+       }
+}
+
+class C1 {
+       public void anotherMethod() {
+               
+       }
+}
index 511aa4e2268ae666862e463a4e4e7c5b49c59dee..c136644793632d0d92ea3474dd72f262ff381faa 100644 (file)
@@ -1423,6 +1423,20 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                configureBuildStructureModel(false);
        }
        
+       public void testAdviceDidNotMatch_pr152589() {
+               initialiseProject("PR152589");
+               build("PR152589");
+               List warnings = MyTaskListManager.getWarningMessages();
+               assertTrue("There should be no warnings:\n"+warnings,
+                               warnings.isEmpty());
+               alter("PR152589","inc1");
+               build("PR152589");
+               checkWasFullBuild();
+               warnings = MyTaskListManager.getWarningMessages();
+               assertTrue("There should be no warnings after adding a whitespace:\n"
+                               +warnings,warnings.isEmpty());  
+       }
+       
        // --- helper code ---
        
        /**