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

(-)formatter/org/eclipse/jdt/internal/formatter/Scribe.java (-1 / +1 lines)
Lines 3784-3790 Link Here
3784
						newLineString = this.tempBuffer.toString();
3784
						newLineString = this.tempBuffer.toString();
3785
					}
3785
					}
3786
					addReplaceEdit(end+1, this.scanner.getCurrentTokenEndPosition(), newLineString);
3786
					addReplaceEdit(end+1, this.scanner.getCurrentTokenEndPosition(), newLineString);
3787
					textLineStart++;
3787
					textLineStart = Util.getLineNumber(this.scanner.currentPosition-1, this.lineEnds, textLineStart, this.maxLines);
3788
				}
3788
				}
3789
			}
3789
			}
3790
		}
3790
		}
(-)src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java (+52 lines)
Lines 7552-7555 Link Here
7552
	);
7552
	);
7553
}
7553
}
7554
7554
7555
/**
7556
 * @bug 328240: org.eclipse.text.edits.MalformedTreeException: Overlapping text edits
7557
 * @test Ensure that no exception occurs while formatting the given sample
7558
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=328240"
7559
 */
7560
public void testBug328240() {
7561
	String source =
7562
		"package com.example;\n" +
7563
		"\n" +
7564
		"public class FormatterError {\n" +
7565
		"\n" +
7566
		"	/**\n" +
7567
		"	 * Create a paragraph element suited to be a header of the report. Headers\n" +
7568
		"	 * are the elements such as \"created by\" on \"created on\" that appear\n" +
7569
		"	 * underneath the title.\n" +
7570
		"	 * \n" +
7571
		"	 * @param reportHeader\n" +
7572
		"	 *            a <code>String</coe> value that will be the text of\n" +
7573
		"\n" +
7574
		"* the paragraph.\n" +
7575
		"	 * @return a <code>Paragraph</code> containing the the text passed as the\n" +
7576
		"	 *         reportHeader parameter.\n" +
7577
		"	 */\n" +
7578
		"\n" +
7579
		"	public static String createReportHeader(String reportHeader) {\n" +
7580
		"		return reportHeader;\n" +
7581
		"	}\n" +
7582
		"}\n";
7583
	formatSource(source,
7584
		"package com.example;\n" +
7585
		"\n" +
7586
		"public class FormatterError {\n" +
7587
		"\n" +
7588
		"	/**\n" +
7589
		"	 * Create a paragraph element suited to be a header of the report. Headers\n" +
7590
		"	 * are the elements such as \"created by\" on \"created on\" that appear\n" +
7591
		"	 * underneath the title.\n" +
7592
		"	 * \n" +
7593
		"	 * @param reportHeader\n" +
7594
		"	 *            a <code>String</coe> value that will be the text of\n" +
7595
		"	 * the paragraph.\n" +
7596
		"	 * @return a <code>Paragraph</code> containing the the text passed as the\n" +
7597
		"	 *         reportHeader parameter.\n" +
7598
		"	 */\n" +
7599
		"\n" +
7600
		"	public static String createReportHeader(String reportHeader) {\n" +
7601
		"		return reportHeader;\n" +
7602
		"	}\n" +
7603
		"}\n"
7604
	);
7605
}
7606
7555
}
7607
}

Return to bug 328240