Community
Participate
Working Groups
Created attachment 105260 [details] screen shot I20080613-2000 1. Enable 'Format edited lines' on save with eclipse built-in profile 2. Given the CU on the left side of the picture (editor not dirty) 3. change the CU as indicated on the right side of the picture 4. Save Is: Error dialog 'Save participant caused an exception': org.eclipse.text.edits.MalformedTreeException: Range of child edit lies outside of parent edit at org.eclipse.text.edits.TextEdit.internalAdd(TextEdit.java:776) at org.eclipse.text.edits.TextEdit.addChild(TextEdit.java:335) at org.eclipse.jdt.internal.formatter.Scribe.getRootEdit(Scribe.java:837) at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.format(CodeFormatterVisitor.java:806) at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.formatCompilationUnit(DefaultCodeFormatter.java:331) at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:203) at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.reformat(CodeFormatterUtil.java:323) at org.eclipse.jdt.internal.corext.fix.CodeFormatFix.createCleanUp(CodeFormatFix.java:71) at org.eclipse.jdt.internal.ui.fix.CodeFormatCleanUp.createFix(CodeFormatCleanUp.java:62) at org.eclipse.jdt.internal.corext.fix.CleanUpRefactoring.calculateChange(CleanUpRefactoring.java:782) at org.eclipse.jdt.internal.corext.fix.CleanUpPostSaveListener.saved(CleanUpPostSaveListener.java:263) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider$5.run(CompilationUnitDocumentProvider.java:1539)
Could you attach the CU? It will be easier for me to reproduce, thx...
(In reply to comment #1) > Could you attach the CU? It will be easier for me to reproduce, thx... > Forget it I created it manually... Note that this is not a regression introduced by the new comment formatter as I was able to reproduce the failure using 3.4M6
Created attachment 105265 [details] snippet class
(In reply to comment #3) > Created an attachment (id=105265) [details] > snippet class > Thanks :-) Just a question why do you consider it as major? The exception just makes the formatting failed, the file changed are well save after the action. IMO, this bug would have a 'normal' severity...
(In reply to comment #4) > Just a question why do you consider it as major? The exception just makes the > formatting failed, the file changed are well save after the action. IMO, this > bug would have a 'normal' severity... Maybe it's not major, but an ugly error dialog pops up on save. I guess the severity does not matter too much because IMHO it's a must fix, maybe even for 3.4.1?
I agree with 3.4.1 target.
I suspect that this issue might be a consequence of bug 234583...
My assumption was correct. There's a bug in the current implemented regions adapting. The first given region is adapted from [64+3] to [57+49] which overlaps the second given region [84+2] and produces the MalformedTreeException... So, we cannot consider it as a duplicate but this bug will be fixed at the same time than bug 234583.
(In reply to comment #8) > My assumption was correct. There's a bug in the current implemented regions > adapting. The first given region is adapted from [64+3] to [57+49] which > overlaps the second given region [84+2] and produces the > MalformedTreeException... > > So, we cannot consider it as a duplicate but this bug will be fixed at the same > time than bug 234583. > => set it as duplicate because fix for bug 234583 will fix this one... *** This bug has been marked as a duplicate of bug 234583 ***
Verified for 3.4.1 using M20080827-2000
I could not reproduce using M20080827-2000. Did I miss something ?
dup of bug 234583 *** This bug has been marked as a duplicate of bug 234583 ***
(In reply to comment #11) > I could not reproduce using M20080827-2000. Did I miss something ? > I was able to reproduce the MalformedTreeException both on 3.4.0 and 3.4.1 (M20080827-2000). You must strictly follow the steps given on comment 0.
As the fix of the original bug will go into HEAD stream only, I'll open another bug against JDT/Text not to report the MalformedTreeException but only log it. As there's no editor crash and the file is well saved, there's no reason to worry the user with a dialog about this exception. If it notice that his changes are not formatted, then we would advice to have a look in the log to see if there's such an exception it...
If bug 245688 was fixed in R3_4_maintenance stream, then this failure wouldn't hurt the user too much while using 3.4.2...
Verified for 3.5M2 using I20080914-2000