Bug 328240 - org.eclipse.text.edits.MalformedTreeException: Overlapping text edits
Summary: org.eclipse.text.edits.MalformedTreeException: Overlapping text edits
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: All Linux
: P3 normal (vote)
Target Milestone: 3.7 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-20 08:15 EDT by Robert Munteanu CLA
Modified: 2010-10-26 05:37 EDT (History)
2 users (show)

See Also:


Attachments
Java class which triggers the reported exception. (553 bytes, text/plain)
2010-10-20 08:16 EDT, Robert Munteanu CLA
no flags Details
Proposed fix + regression test (3.26 KB, patch)
2010-10-24 20:03 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Munteanu CLA 2010-10-20 08:15:53 EDT
What steps will reproduce the problem?
1. Try to format a java class with the following method javadoc:


bc.. 	/**
	 * Create a paragraph element suited to be a header of the report. Headers
	 * are the elements such as "created by" on "created on" that appear
	 * underneath the title.
	 * 
	 * @param reportHeader
	 *            a <code>String</coe> value that will be the text of

* the paragraph.
	 * @return a <code>Paragraph</code> containing the the text passed as the
	 *         reportHeader parameter.
	 */

p. There is no feedback to the user, aside from the Error log entries.

-- Error Details --
Date: Wed Oct 20 15:07:10 EEST 2010
Message: Exception occured while formatting comments
Severity: Error
Product: Eclipse 1.3.1.20100913-1228 (org.eclipse.epp.package.jee.product)
Plugin: org.eclipse.jdt.core
Exception Stack Trace:
org.eclipse.text.edits.MalformedTreeException: Overlapping text edits
at org.eclipse.text.edits.TextEdit$InsertionComparator.compare(TextEdit.java:121)
at java.util.Collections.indexedBinarySearch(Collections.java:319)
at java.util.Collections.binarySearch(Collections.java:307)
at org.eclipse.text.edits.TextEdit.computeInsertionIndex(TextEdit.java:796)
at org.eclipse.text.edits.TextEdit.internalAdd(TextEdit.java:781)
at org.eclipse.text.edits.TextEdit.addChild(TextEdit.java:335)
at org.eclipse.jdt.internal.formatter.Scribe.getRootEdit(Scribe.java:1248)
at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.format(CodeFormatterVisitor.java:818)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.formatCompilationUnit(DefaultCodeFormatter.java:241)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:163)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:146)
at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.reformat(CodeFormatterUtil.java:288)
at org.eclipse.jdt.internal.ui.text.java.JavaFormattingStrategy.format(JavaFormattingStrategy.java:65)
at org.eclipse.jface.text.formatter.MultiPassContentFormatter.formatMaster(MultiPassContentFormatter.java:193)
at org.eclipse.jface.text.formatter.MultiPassContentFormatter.format(MultiPassContentFormatter.java:142)
at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:966)
at org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1534)
at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.doOperation(JavaSourceViewer.java:186)
at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:199)
at org.eclipse.ui.texteditor.TextOperationAction$1.run(TextOperationAction.java:131)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.texteditor.TextOperationAction.run(TextOperationAction.java:129)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.ui.actions.RetargetAction.runWithEvent(RetargetAction.java:230)
at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:234)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3540)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3161)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Comment 1 Robert Munteanu CLA 2010-10-20 08:16:54 EDT
Created attachment 181281 [details]
Java class which triggers the reported exception.
Comment 2 Olivier Thomann CLA 2010-10-20 12:35:41 EDT
I'll take a look.
Comment 3 Olivier Thomann CLA 2010-10-24 20:03:08 EDT
Created attachment 181606 [details]
Proposed fix + regression test
Comment 4 Olivier Thomann CLA 2010-10-24 20:04:37 EDT
Released for 3.7M3.
Regression test added:
org.eclipse.jdt.core.tests.formatter.FormatterBugsTests#testBug328240
Comment 5 Satyam Kandula CLA 2010-10-26 05:37:10 EDT
Verified for 3.7M3 using build I20101025-0901