### 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.98.4.3 diff -u -r1.98.4.3 ReconcilerTests.java --- src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 3 Aug 2006 17:32:13 -0000 1.98.4.3 +++ src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 30 Aug 2006 13:31:47 -0000 @@ -22,6 +22,7 @@ import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.Path; import org.eclipse.jdt.core.*; +import org.eclipse.jdt.core.compiler.CategorizedProblem; import org.eclipse.jdt.core.compiler.CompilationParticipant; import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.core.compiler.ReconcileContext; @@ -2358,6 +2359,35 @@ project.setOption(JavaCore.COMPILER_SOURCE, originalSourceLevel); } } +/* + * Ensures that a problem reporting session is not started during reconcile if a participant reports an error + * and if the working copy is already consistent and the forceProblemDetection flag is false. + * (regression test for bug 154170 Printing warnings breaks in-editor quick fixes) + */ +public void testReconcileParticipant08() throws CoreException { + // set working copy contents and ensure it is consistent + String contents = + "package p1;\n" + + "public class X {\n" + + " public void bar() {\n" + + " }\n" + + "}"; + setWorkingCopyContents(contents); + this.workingCopy.makeConsistent(null); + this.problemRequestor.initialize(contents.toCharArray()); + + // reconcile with a participant adding a list of problems + new ReconcileParticipant() { + public void reconcile(ReconcileContext context) { + context.putProblems("test.marker", new CategorizedProblem[] {}); + } + }; + this.workingCopy.reconcile(ICompilationUnit.NO_AST, false, null, null); + assertProblems( + "Unexpected problems", + "" + ); +} /** * 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.39 diff -u -r1.39 ReconcileWorkingCopyOperation.java --- model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java 29 Mar 2006 03:08:48 -0000 1.39 +++ model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java 30 Aug 2006 13:31:48 -0000 @@ -61,6 +61,7 @@ } CompilationUnit workingCopy = getWorkingCopy(); + boolean wasConsistent = workingCopy.isConsistent(); IProblemRequestor problemRequestor = workingCopy.getPerWorkingCopyInfo(); this.resolveBindings |= problemRequestor != null && problemRequestor.isActive(); @@ -78,7 +79,7 @@ makeConsistent(workingCopy, problemRequestor); // report problems - if (this.problems != null) { + if (this.problems != null && (this.forceProblemDetection || !wasConsistent)) { try { problemRequestor.beginReporting(); for (Iterator iteraror = this.problems.values().iterator(); iteraror.hasNext();) {