View | Details | Raw Unified | Return to bug 239941 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java (-1 / +47 lines)
Lines 1781-1784 Link Here
1781
		"}\n"
1781
		"}\n"
1782
	);
1782
	);
1783
}
1783
}
1784
}
1784
1785
/**
1786
 * @bug 239941: [formatter] Unclosed html tags make the formatter to produce incorrect outputs
1787
 * @test Ensure that unclosed html tags do not screw up the formatter in following javadoc comments
1788
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=239941"
1789
 */
1790
public void testBug239941() throws JavaModelException {
1791
	String source = 
1792
		"public class X01 {\n" + 
1793
		"\n" + 
1794
		"	/**\n" + 
1795
		"	 * <pre>\n" + 
1796
		"	 * Unclosed pre tag\n" + 
1797
		"	 */\n" + 
1798
		"	int foo;\n" + 
1799
		"\n" + 
1800
		"    /**\n" + 
1801
		"     * Gets the signers of this class.\n" + 
1802
		"     *\n" + 
1803
		"     * @return  the signers of this class, or null if there are no signers.  In\n" + 
1804
		"     * 		particular, this method returns null if this object represents\n" + 
1805
		"     * 		a primitive type or void.\n" + 
1806
		"     * @since 	JDK1.1\n" + 
1807
		"     */\n" + 
1808
		"    public native Object[] getSigners();\n" + 
1809
		"}\n";
1810
	formatSource(source,
1811
		"public class X01 {\n" + 
1812
		"\n" + 
1813
		"	/**\n" + 
1814
		"	 * <pre>\n" + 
1815
		"	 * Unclosed pre tag\n" + 
1816
		"	 */\n" + 
1817
		"	int foo;\n" + 
1818
		"\n" + 
1819
		"	/**\n" + 
1820
		"	 * Gets the signers of this class.\n" + 
1821
		"	 * \n" + 
1822
		"	 * @return the signers of this class, or null if there are no signers. In\n" + 
1823
		"	 *         particular, this method returns null if this object represents a\n" + 
1824
		"	 *         primitive type or void.\n" + 
1825
		"	 * @since JDK1.1\n" + 
1826
		"	 */\n" + 
1827
		"	public native Object[] getSigners();\n" + 
1828
		"}\n"
1829
	);
1830
}}
(-)formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java (+3 lines)
Lines 42-47 Link Here
42
	this.javadocStart = start;
42
	this.javadocStart = start;
43
	this.javadocEnd = end;
43
	this.javadocEnd = end;
44
	this.firstTagPosition = this.javadocStart;
44
	this.firstTagPosition = this.javadocStart;
45
	// Need to flush html tags stack in case of unclosed ones in previous javadoc comments
46
	// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=239941
47
	this.htmlTagsPtr = -1;
45
48
46
	// parse comment
49
	// parse comment
47
	boolean valid = commentParse();
50
	boolean valid = commentParse();

Return to bug 239941