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 1722-1725 Link Here
1722
		"}\n"
1722
		"}\n"
1723
	);
1723
	);
1724
}
1724
}
1725
}
1725
1726
/**
1727
 * @bug 239941: [formatter] Unclosed html tags make the formatter to produce incorrect outputs
1728
 * @test Ensure that unclosed html tags do not screw up the formatter in following javadoc comments
1729
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=239941"
1730
 */
1731
public void testBug239941() throws JavaModelException {
1732
	String source = 
1733
		"public class X01 {\n" + 
1734
		"\n" + 
1735
		"	/**\n" + 
1736
		"	 * <pre>\n" + 
1737
		"	 * Unclosed pre tag\n" + 
1738
		"	 */\n" + 
1739
		"	int foo;\n" + 
1740
		"\n" + 
1741
		"    /**\n" + 
1742
		"     * Gets the signers of this class.\n" + 
1743
		"     *\n" + 
1744
		"     * @return  the signers of this class, or null if there are no signers.  In\n" + 
1745
		"     * 		particular, this method returns null if this object represents\n" + 
1746
		"     * 		a primitive type or void.\n" + 
1747
		"     * @since 	JDK1.1\n" + 
1748
		"     */\n" + 
1749
		"    public native Object[] getSigners();\n" + 
1750
		"}\n";
1751
	formatSource(source,
1752
		"public class X01 {\n" + 
1753
		"\n" + 
1754
		"	/**\n" + 
1755
		"	 * <pre>\n" + 
1756
		"	 * Unclosed pre tag\n" + 
1757
		"	 */\n" + 
1758
		"	int foo;\n" + 
1759
		"\n" + 
1760
		"	/**\n" + 
1761
		"	 * Gets the signers of this class.\n" + 
1762
		"	 * \n" + 
1763
		"	 * @return the signers of this class, or null if there are no signers. In\n" + 
1764
		"	 *         particular, this method returns null if this object represents a\n" + 
1765
		"	 *         primitive type or void.\n" + 
1766
		"	 * @since JDK1.1\n" + 
1767
		"	 */\n" + 
1768
		"	public native Object[] getSigners();\n" + 
1769
		"}\n"
1770
	);
1771
}}
(-)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