diff options
3 files changed, 32 insertions, 2 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java index 5e872d7fa8..647a92758d 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java @@ -2687,6 +2687,32 @@ public void testReconcileParticipant10() throws CoreException { ); } +/* + * Ensures that the delta is still correct if a participant resets the ast during reconcile + * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=210310) + */ +public void testReconcileParticipant11() throws CoreException { + new ReconcileParticipant() { + public void reconcile(ReconcileContext context) { + context.resetAST(); + } + }; + setWorkingCopyContents( + "package p1;\n" + + "import p2.*;\n" + + "public class X {\n" + + " private void foo() {\n" + + " }\n" + + "}" + ); + this.workingCopy.reconcile(AST.JLS3, true/*force problem detection*/, null, null); + assertDeltas( + "Unexpected delta", + "X[*]: {CHILDREN | FINE GRAINED}\n" + + " foo()[*]: {MODIFIERS CHANGED}" + ); +} + /** * Ensures that the reconciler reconciles the new contents with the current * contents, updating the structure of this reconciler's compilation diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html index dce239571f..7ede8bcf69 100644 --- a/org.eclipse.jdt.core/buildnotes_jdt-core.html +++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html @@ -54,7 +54,9 @@ in your code, until you will have enabled these back, and the compiler will have </ul> <h3>Problem Reports Fixed</h3> -<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=210213">210213</a> +<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=210310">210310</a> +IJavaElementDelta contains wrong data after APT processor is enabled +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=210213">210213</a> [1.5][compiler] Unused SuppressWarnings shouldn't complain if warnings are not even enabled <br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=210070">210070</a> Type hierarchy unpredictable diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java index 82756ac3d6..e04e2242b6 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java @@ -214,7 +214,9 @@ public class ReconcileWorkingCopyOperation extends JavaModelOperation { reconcileFlags, this.progressMonitor); if (this.ast != null) { - this.deltaBuilder.delta = new JavaElementDelta(workingCopy); + if (this.deltaBuilder.delta == null) { + this.deltaBuilder.delta = new JavaElementDelta(workingCopy); + } this.deltaBuilder.delta.changedAST(this.ast); } if (this.progressMonitor != null) this.progressMonitor.worked(1); |