### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java,v retrieving revision 1.114 diff -u -r1.114 ReconcilerTests.java --- src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 14 Mar 2007 08:18:39 -0000 1.114 +++ src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 15 Mar 2007 12:11:35 -0000 @@ -2357,7 +2357,7 @@ ); this.workingCopy.reconcile(ICompilationUnit.NO_AST, false, null, null); assertASTNodeEquals( - "Unexpected participant delta", + "Unexpected participant ast", "package p1;\n" + "import p2.*;\n" + "public class X {\n" + @@ -2383,7 +2383,7 @@ ); org.eclipse.jdt.core.dom.CompilationUnit ast = this.workingCopy.reconcile(AST.JLS3, false, null, null); assertSame( - "Unexpected participant delta", + "Unexpected participant ast", participant.ast, ast ); @@ -2521,6 +2521,40 @@ "" ); } +/* + * Ensures that a reconcile participant is not notified when a working copy is reconciled + * and it was consistent and forcing problem detection is off + * (regression test for 177319 Annotation Processing (APT) affects eclipse speed) + */ +public void testReconcileParticipant09() throws CoreException { + this.workingCopy.makeConsistent(null); + new ReconcileParticipant() { + public void reconcile(ReconcileContext context) { + assertTrue("Participant should not be notified of a reconcile", false); + } + }; + this.workingCopy.reconcile(ICompilationUnit.NO_AST, false/*don't force problem detection*/, null, null); +} + +/* + * Ensures that a reconcile participant is notified when a working copy is reconciled + * and it was consistent and forcing problem detection is on + */ +public void testReconcileParticipant10() throws CoreException { + this.workingCopy.makeConsistent(null); + final boolean[] participantReconciled = new boolean[1]; + new ReconcileParticipant() { + public void reconcile(ReconcileContext context) { + participantReconciled[0] = true; + } + }; + this.workingCopy.reconcile(ICompilationUnit.NO_AST, true/*force problem detection*/, null, null); + assertTrue( + "Participant should have been notified", + participantReconciled[0] + ); +} + /** * Ensures that the reconciler reconciles the new contents with the current * contents, updating the structure of this reconciler's compilation #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java,v retrieving revision 1.43 diff -u -r1.43 ReconcileWorkingCopyOperation.java --- model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java 14 Mar 2007 08:18:47 -0000 1.43 +++ model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java 15 Mar 2007 12:11:36 -0000 @@ -86,8 +86,10 @@ // make working copy consistent if needed and compute AST if needed makeConsistent(workingCopy, problemRequestor); - // notify reconcile participants - notifyParticipants(workingCopy); + // notify reconcile participants only if working copy was not consistent or if forcing problem detection + // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=177319) + if (!wasConsistent || this.forceProblemDetection) + notifyParticipants(workingCopy); // recreate ast if needed if (this.ast == null && (this.astLevel > ICompilationUnit.NO_AST || this.resolveBindings))