From: aclement Date: Thu, 3 Aug 2006 07:23:55 +0000 (+0000) Subject: test and fix for 152589: adviceDidNotMatch incorrectly appearing X-Git-Tag: pre_pr_153572~23 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9664058bcdaeb4934a01969f4e5f651bc6e8cd71;p=aspectj.git test and fix for 152589: adviceDidNotMatch incorrectly appearing --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java index dbc0a12a2..d2cf77b3b 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/AjPipeliningCompilerAdapter.java @@ -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 index 000000000..fd2f78695 --- /dev/null +++ b/tests/multiIncremental/PR152589/base/A.aj @@ -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 index 000000000..a2ebf78c5 --- /dev/null +++ b/tests/multiIncremental/PR152589/inc1/A.aj @@ -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/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index 511aa4e22..c13664479 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -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 --- /**