View | Details | Raw Unified | Return to bug 177319
Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java (-2 / +36 lines)
Lines 2357-2363 Link Here
2357
	);
2357
	);
2358
	this.workingCopy.reconcile(ICompilationUnit.NO_AST, false, null, null);
2358
	this.workingCopy.reconcile(ICompilationUnit.NO_AST, false, null, null);
2359
	assertASTNodeEquals(
2359
	assertASTNodeEquals(
2360
		"Unexpected participant delta",
2360
		"Unexpected participant ast",
2361
		"package p1;\n" +
2361
		"package p1;\n" +
2362
		"import p2.*;\n" +
2362
		"import p2.*;\n" +
2363
		"public class X {\n" +
2363
		"public class X {\n" +
Lines 2383-2389 Link Here
2383
	);
2383
	);
2384
	org.eclipse.jdt.core.dom.CompilationUnit ast = this.workingCopy.reconcile(AST.JLS3, false, null, null);
2384
	org.eclipse.jdt.core.dom.CompilationUnit ast = this.workingCopy.reconcile(AST.JLS3, false, null, null);
2385
	assertSame(
2385
	assertSame(
2386
		"Unexpected participant delta",
2386
		"Unexpected participant ast",
2387
		participant.ast,
2387
		participant.ast,
2388
		ast
2388
		ast
2389
	);
2389
	);
Lines 2521-2526 Link Here
2521
		""
2521
		""
2522
	);
2522
	);
2523
}
2523
}
2524
/*
2525
 * Ensures that a reconcile participant is not notified when a working copy is reconciled 
2526
 * and it was consistent and forcing problem detection is off
2527
 * (regression test for 177319 Annotation Processing (APT) affects eclipse speed)
2528
 */
2529
public void testReconcileParticipant09() throws CoreException {
2530
	this.workingCopy.makeConsistent(null);
2531
	new ReconcileParticipant() {
2532
		public void reconcile(ReconcileContext context) {
2533
			assertTrue("Participant should not be notified of a reconcile", false);
2534
		}
2535
	};
2536
	this.workingCopy.reconcile(ICompilationUnit.NO_AST, false/*don't force problem detection*/, null, null);
2537
}
2538
2539
/*
2540
 * Ensures that a reconcile participant is notified when a working copy is reconciled 
2541
 * and it was consistent and forcing problem detection is on
2542
 */
2543
public void testReconcileParticipant10() throws CoreException {
2544
	this.workingCopy.makeConsistent(null);
2545
	final boolean[] participantReconciled = new boolean[1];
2546
	new ReconcileParticipant() {
2547
		public void reconcile(ReconcileContext context) {
2548
			participantReconciled[0] = true;
2549
		}
2550
	};
2551
	this.workingCopy.reconcile(ICompilationUnit.NO_AST, true/*force problem detection*/, null, null);
2552
	assertTrue(
2553
		"Participant should have been notified",
2554
		participantReconciled[0]
2555
	);
2556
}
2557
2524
/**
2558
/**
2525
 * Ensures that the reconciler reconciles the new contents with the current
2559
 * Ensures that the reconciler reconciles the new contents with the current
2526
 * contents, updating the structure of this reconciler's compilation
2560
 * contents, updating the structure of this reconciler's compilation
(-)model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java (-2 / +4 lines)
Lines 86-93 Link Here
86
			// make working copy consistent if needed and compute AST if needed
86
			// make working copy consistent if needed and compute AST if needed
87
			makeConsistent(workingCopy, problemRequestor);
87
			makeConsistent(workingCopy, problemRequestor);
88
88
89
			// notify reconcile participants
89
			// notify reconcile participants only if working copy was not consistent or if forcing problem detection
90
			notifyParticipants(workingCopy);
90
			// (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=177319)
91
			if (!wasConsistent || this.forceProblemDetection)
92
				notifyParticipants(workingCopy);
91
93
92
			// recreate ast if needed
94
			// recreate ast if needed
93
			if (this.ast == null && (this.astLevel > ICompilationUnit.NO_AST || this.resolveBindings))
95
			if (this.ast == null && (this.astLevel > ICompilationUnit.NO_AST || this.resolveBindings))

Return to bug 177319