### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java,v retrieving revision 1.11 diff -u -r1.11 FormatJavadocBlock.java --- formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java 12 Feb 2010 18:33:45 -0000 1.11 +++ formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java 14 Feb 2010 15:53:26 -0000 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.jdt.internal.formatter; +import org.eclipse.jdt.internal.compiler.parser.Scanner; import org.eclipse.jdt.internal.formatter.comment.IJavaDocTagConstants; /** @@ -279,6 +280,19 @@ } /** + * Returns whether the block is immutable or not. + *

+ * Currently, only {@code} and {@literal} inline tags block are considered as + * immutable. + *

+ * @return true if the block is immutable, + * false otherwise. + */ +public boolean isImmutable() { + return (this.flags & IMMUTABLE) == IMMUTABLE; +} + +/** * Returns whether the block is a description or inlined in a description. * @see #isParamTag() * @@ -311,9 +325,9 @@ } /** - * Returns whether the text is on the same line of the tag. + * Returns whether the the tag is on one line only. * - * @return true if the text is on the same line than the tag, + * @return true if the tag is on one line only, * false otherwise. */ public boolean isOneLineTag() { @@ -331,19 +345,6 @@ return (this.flags & PARAM_TAG) == PARAM_TAG; } -/** - * Returns whether the block is immutable or not. - *

- * Currently, only {@code} and {@literal} inline tags block are considered as - * immutable. - *

- * @return true if the block is immutable, - * false otherwise. - */ -public boolean isImmutable() { - return (this.flags & IMMUTABLE) == IMMUTABLE; -} - void setHeaderLine(int javadocLineStart) { if (javadocLineStart == this.lineStart) { this.flags |= ON_HEADER_LINE; @@ -366,6 +367,49 @@ this.reference.toString(buffer); buffer.append(")\n"); //$NON-NLS-1$ } + StringBuffer flagsBuffer = new StringBuffer(); + if (isDescription()) { + if (flagsBuffer.length() > 0) flagsBuffer.append(','); + flagsBuffer.append("description"); //$NON-NLS-1$ + } + if (isFirst()) { + if (flagsBuffer.length() > 0) flagsBuffer.append(','); + flagsBuffer.append("first"); //$NON-NLS-1$ + } + if (isHeaderLine()) { + if (flagsBuffer.length() > 0) flagsBuffer.append(','); + flagsBuffer.append("header line"); //$NON-NLS-1$ + } + if (isImmutable()) { + if (flagsBuffer.length() > 0) flagsBuffer.append(','); + flagsBuffer.append("immutable"); //$NON-NLS-1$ + } + if (isInDescription()) { + if (flagsBuffer.length() > 0) flagsBuffer.append(','); + flagsBuffer.append("in description"); //$NON-NLS-1$ + } + if (isInlined()) { + if (flagsBuffer.length() > 0) flagsBuffer.append(','); + flagsBuffer.append("inlined"); //$NON-NLS-1$ + } + if (isInParamTag()) { + if (flagsBuffer.length() > 0) flagsBuffer.append(','); + flagsBuffer.append("in param tag"); //$NON-NLS-1$ + } + if (isOneLineTag()) { + if (flagsBuffer.length() > 0) flagsBuffer.append(','); + flagsBuffer.append("one line tag"); //$NON-NLS-1$ + } + if (isParamTag()) { + if (flagsBuffer.length() > 0) flagsBuffer.append(','); + flagsBuffer.append("param tag"); //$NON-NLS-1$ + } + if (flagsBuffer.length() > 0) { + if (inlined) buffer.append('\t'); + buffer.append(" flags: "); //$NON-NLS-1$ + buffer.append(flagsBuffer); + buffer.append('\n'); + } if (this.nodesPtr > -1) { for (int i = 0; i <= this.nodesPtr; i++) { if (inlined) buffer.append('\t'); @@ -392,4 +436,16 @@ this.nodes[i].toStringDebug(buffer, source); } } + +void update(Scanner scanner) { + int blockEnd = scanner.getLineNumber(this.sourceEnd); + if (blockEnd == this.lineStart) { + this.flags |= FormatJavadocBlock.ONE_LINE_TAG; + } + for (int i=0; i<=this.nodesPtr; i++) { + if (!this.nodes[i].isText()) { + ((FormatJavadocBlock)this.nodes[i]).update(scanner); + } + } +} } Index: formatter/org/eclipse/jdt/internal/formatter/FormatJavadocText.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/FormatJavadocText.java,v retrieving revision 1.10 diff -u -r1.10 FormatJavadocText.java --- formatter/org/eclipse/jdt/internal/formatter/FormatJavadocText.java 12 Feb 2010 18:33:46 -0000 1.10 +++ formatter/org/eclipse/jdt/internal/formatter/FormatJavadocText.java 14 Feb 2010 15:53:26 -0000 @@ -50,7 +50,7 @@ * child node. */ void appendText(FormatJavadocText text) { - this.immutable = text.immutable; + text.immutable = this.immutable; if (this.depth == text.depth) { addSeparator(text); this.sourceEnd = text.sourceEnd; @@ -169,7 +169,6 @@ * * @return true if the node is an immutable tag, * false otherwise. - *@deprecated Use {@link #isImmutable()} instead */ public boolean isImmutableHtmlTag() { return this.htmlTagIndex != -1 && (this.htmlTagIndex & JAVADOC_TAGS_ID_MASK) == JAVADOC_IMMUTABLE_TAGS_ID; @@ -230,6 +229,9 @@ StringBuffer indentation = new StringBuffer(); for (int t=0; t<=this.depth; t++) indentation.append('\t'); buffer.append(indentation); + if (isImmutable()) { + buffer.append("immutable "); //$NON-NLS-1$ + } buffer.append("text"); //$NON-NLS-1$ super.toString(buffer); buffer.append(" ("); //$NON-NLS-1$ Index: formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java,v retrieving revision 1.32 diff -u -r1.32 FormatterCommentParser.java --- formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java 11 Feb 2010 12:18:52 -0000 1.32 +++ formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java 14 Feb 2010 15:53:27 -0000 @@ -796,10 +796,7 @@ for (int i=0; i 0) { if ((currentCommentIndentation % this.tabLength) == 0) { @@ -2410,7 +2410,7 @@ // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=293300 if (this.lastLineComment.contiguous) { // The leading spaces have been set while looping in the printComment(int) method - int currentCommentIndentation = getCurrentIndentation(this.lastLineComment.leadingSpaces); + int currentCommentIndentation = getCurrentIndentation(this.lastLineComment.leadingSpaces, 0); // Keep the current comment indentation when over the previous contiguous line comment // and the previous comment has not been reindented int lastCommentIndentation = this.lastLineComment.currentIndentation; @@ -2869,7 +2869,11 @@ if (newLines == 0 && (!node.isImmutable() || block.reference != null)) { newLines = printJavadocBlockNodesNewLines(block, node, previousEnd); } - printJavadocGapLines(previousEnd+1, nodeStart-1, newLines, clearBlankLines, false, null); + if (block.isImmutable()) { + printJavadocGapLinesForImmutableBlock(block); + } else { + printJavadocGapLines(previousEnd+1, nodeStart-1, newLines, clearBlankLines, false, null); + } } else { StringBuffer buffer = new StringBuffer(); if (newLines > 0) { @@ -2900,7 +2904,7 @@ FormatJavadocText text = (FormatJavadocText) node; if (text.isImmutable()) { // Indent if new line was added - if (newLines > 0 && this.commentIndentation != null) { + if (text.isImmutableHtmlTag() && newLines > 0 && this.commentIndentation != null) { addInsertEdit(node.sourceStart, this.commentIndentation); this.column += this.commentIndentation.length(); } @@ -2964,30 +2968,27 @@ int token = this.scanner.getNextToken(); switch (token) { case TerminalTokens.TokenNameWHITESPACE: - if (nodeIsText) { - if (CharOperation.indexOf('\n', this.scanner.source, this.scanner.startPosition, this.scanner.currentPosition) >= 0) { - return 0; - } + if (CharOperation.indexOf('\n', this.scanner.source, this.scanner.startPosition, this.scanner.currentPosition) >= 0) { + return 0; } - length = 1; + lastColumn = getCurrentIndentation(this.scanner.getCurrentTokenSource(), lastColumn); break; case TerminalTokens.TokenNameMULTIPLY: if (newLine) { newLine = false; continue; } - length = 1; + lastColumn++; break; default: - length = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition; + lastColumn += (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition; break; } } catch (InvalidInputException iie) { // maybe an unterminated string or comment - length = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition; + lastColumn += (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition; } - lastColumn += length; if (lastColumn > maxColumn) { return 1; } @@ -3347,7 +3348,7 @@ if (linesGap > 0) { StringBuffer buffer = new StringBuffer(); if (lineCount > 0) { - // TODO (eric) https://bugs.eclipse.org/bugs/show_bug.cgi?id=49619 + // TODO https://bugs.eclipse.org/bugs/show_bug.cgi?id=49619 buffer.append( ' '); } for (int i = 0; i < linesGap ; i++) { @@ -3409,7 +3410,7 @@ // Insert new lines as not enough was encountered while scanning the whitespaces StringBuffer buffer = new StringBuffer(); if (lineCount > 0) { - // TODO (eric) https://bugs.eclipse.org/bugs/show_bug.cgi?id=49619 + // TODO https://bugs.eclipse.org/bugs/show_bug.cgi?id=49619 buffer.append( ' '); } for (int i = lineCount; i < newLines-1; i++) { @@ -3440,7 +3441,7 @@ StringBuffer buffer = new StringBuffer(); if (this.scanner.linePtr > linePtr) { if (lineCount > 0) { - // TODO (eric) https://bugs.eclipse.org/bugs/show_bug.cgi?id=49619 + // TODO https://bugs.eclipse.org/bugs/show_bug.cgi?id=49619 buffer.append( ' '); } buffer.append(this.lineSeparator); @@ -3481,14 +3482,14 @@ try { // Iterate on text line separators - int lineNumber = text.lineStart; + int textLineStart = text.lineStart; this.scanner.tokenizeWhiteSpace = false; StringBuffer buffer = null; for (int idx=0, max=text.separatorsPtr; idx<=max ; idx++) { int start = (int) text.separators[idx]; - int lineStart = Util.getLineNumber(start, this.lineEnds, lineNumber-1, this.maxLines); - while (lineNumber < lineStart) { - int end = this.lineEnds[lineNumber-1]; + int lineStart = Util.getLineNumber(start, this.lineEnds, textLineStart-1, this.maxLines); + while (textLineStart < lineStart) { + int end = this.lineEnds[textLineStart-1]; this.scanner.resetTo(end, start); int token = this.scanner.getNextToken(); switch (token) { @@ -3509,7 +3510,7 @@ this.column += BLOCK_LINE_PREFIX_LENGTH; } addReplaceEdit(end+1, this.scanner.getCurrentTokenEndPosition(), buffer.toString()); - lineNumber++; + textLineStart++; } } } @@ -3524,6 +3525,170 @@ } } + /* + * Print the gap lines for an immutable block. + * That's needed to be specific as the formatter needs to keep white spaces + * if possible except those which are indentation ones. + * Note that in the peculiar case of a two lines immutable tag (multi lines block), + * the formatter will join the two lines. + */ + private void printJavadocGapLinesForImmutableBlock(FormatJavadocBlock block) { + + // Init + int firstLineEnd = -1; // not initialized + int newLineStart = -1; // not initialized + int secondLineStart = -1; // not initialized + int starPosition = -1; // not initialized + int offset = 0; + int start = block.tagEnd + 1; + int end = block.nodes[0].sourceStart-1; + this.scanner.resetTo(start, end); + int lineStart = block.lineStart; + int lineEnd = Util.getLineNumber(block.nodes[0].sourceEnd, this.lineEnds, lineStart-1, this.maxLines); + boolean multiLinesBlock = lineEnd > (lineStart+1); + int previousPosition = this.scanner.currentPosition; + StringBuffer buffer = null; + int indentationColumn = 0; + int leadingSpaces = -1; + + // Scan the existing gap + while (!this.scanner.atEnd()) { + char ch = (char) this.scanner.getNextChar(); + switch (ch) { + case '\t' : + // increase the corresponding counter from the appropriate tab value + if (secondLineStart > 0 || firstLineEnd < 0) { + int reminder = this.tabLength == 0 ? 0 : offset % this.tabLength; + if (reminder == 0) { + offset += this.tabLength; + } else { + offset = ((offset / this.tabLength) + 1) * this.tabLength; + } + } else if (leadingSpaces >= 0) { + int reminder = this.tabLength == 0 ? 0 : offset % this.tabLength; + if (reminder == 0) { + leadingSpaces += this.tabLength; + } else { + leadingSpaces = ((offset / this.tabLength) + 1) * this.tabLength; + } + } + break; + case '\r' : + case '\n' : + // new line, store the end of the first one + if (firstLineEnd < 0) { + firstLineEnd = previousPosition; + } + // print indentation if there were spaces without any star on the line + if (leadingSpaces > 0 && multiLinesBlock) { + if (buffer == null) { + buffer = new StringBuffer(); + this.column = 1; + printIndentationIfNecessary(buffer); + buffer.append(BLOCK_LINE_PREFIX); + this.column += BLOCK_LINE_PREFIX_LENGTH; + indentationColumn = this.column; + } else { + this.column = indentationColumn; + } + addReplaceEdit(newLineStart, newLineStart+indentationColumn-2, buffer.toString()); + } + // store line start and reset positions + newLineStart = this.scanner.currentPosition; + leadingSpaces = 0; + starPosition = -1; + if (multiLinesBlock) { + offset = 0; + secondLineStart = -1; + } + break; + case '*' : + // store line start position if this is the first star of the line + if (starPosition < 0 && firstLineEnd > 0) { + secondLineStart = this.scanner.currentPosition; + starPosition = this.scanner.currentPosition; + leadingSpaces = -1; + } + break; + default : + // increment offset if line has started + if (secondLineStart > 0) { + // skip first white space after the first '*' + if (secondLineStart == starPosition) { + secondLineStart = this.scanner.currentPosition; + } else { + // print indentation before the following characters + if (offset == 0 && multiLinesBlock) { + if (buffer == null) { + buffer = new StringBuffer(); + this.column = 1; + printIndentationIfNecessary(buffer); + buffer.append(BLOCK_LINE_PREFIX); + this.column += BLOCK_LINE_PREFIX_LENGTH; + indentationColumn = this.column; + } else { + this.column = indentationColumn; + } + addReplaceEdit(newLineStart, secondLineStart-1, buffer.toString()); + } + offset++; + } + } else if (firstLineEnd < 0) { + // no new line yet, increment the offset + offset++; + } else if (leadingSpaces >= 0) { + // no star yet, increment the leading spaces + leadingSpaces++; + } + break; + } + previousPosition = this.scanner.currentPosition; + } + + // Increment the columns from the numbers of characters counted on the line + if (multiLinesBlock) { + this.column += offset; + } else { + this.column++; + } + + // Replace the new line with a single space when there's only one separator + // or, if necessary, print the indentation on the last line + if (!multiLinesBlock) { + addReplaceEdit(firstLineEnd, end, " "); //$NON-NLS-1$ + } + else if (secondLineStart > 0) { + if (buffer == null) { + buffer = new StringBuffer(); + this.column = 1; + printIndentationIfNecessary(buffer); + buffer.append(BLOCK_LINE_PREFIX); + this.column += BLOCK_LINE_PREFIX_LENGTH; + indentationColumn = this.column; + } else { + this.column = indentationColumn; + } + addReplaceEdit(newLineStart, secondLineStart-1, buffer.toString()); + } + else if (leadingSpaces > 0) { + if (buffer == null) { + buffer = new StringBuffer(); + this.column = 1; + printIndentationIfNecessary(buffer); + buffer.append(BLOCK_LINE_PREFIX); + this.column += BLOCK_LINE_PREFIX_LENGTH; + indentationColumn = this.column; + } else { + this.column = indentationColumn; + } + addReplaceEdit(newLineStart, newLineStart+indentationColumn-2, buffer.toString()); + } + + // Reset + this.needSpace = false; + this.scanner.resetTo(end+1, this.scannerEndPosition - 1); + } + private int printJavadocHtmlTag(FormatJavadocText text, FormatJavadocBlock block, boolean textOnNewLine) { // Compute indentation if necessary #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java,v retrieving revision 1.51 diff -u -r1.51 FormatterCommentsBugsTest.java --- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 12 Feb 2010 18:33:47 -0000 1.51 +++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 14 Feb 2010 15:53:33 -0000 @@ -4407,23 +4407,46 @@ " * Comments that can be formated in several lines...\n" + " * \n" + " * @author Myself\n" + - " * @version {@code $Revision: 1.51 $ $Date: 2010/02/12 18:33:47 $ $Author: oliviert $ $Source: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java,v $}\n" + + " * @version {@code The text here should not be formatted.... }\n" + " */\n" + "public class X01 {\n" + "}\n"; formatSource(source); } +public void testBug260381a() throws JavaModelException { + String source = + "/**\n" + + " * Comments that can be formated in several lines...\n" + + " * \n" + + " * @author Myself\n" + + " * @version {@code " + + " * The text here should not be formatted.... }\n" + + " */\n" + + "public class X01a {\n" + + "}\n"; + formatSource(source); +} public void testBug260381b() throws JavaModelException { String source = "/**\n" + " * Comments that can be formated in several lines...\n" + " * \n" + " * @author Myself\n" + - " * @version $Revision: 1.51 $ $Date: 2010/02/12 18:33:47 $ $Author: oliviert $ $Source: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java,v $\n" + + " * @version {@code\n" + + " * The text here should not be formatted.... }\n" + " */\n" + "public class X01b {\n" + "}\n"; - formatSource(source); + formatSource(source, + "/**\n" + + " * Comments that can be formated in several lines...\n" + + " * \n" + + " * @author Myself\n" + + " * @version {@code The text here should not be formatted.... }\n" + + " */\n" + + "public class X01b {\n" + + "}\n" + ); } public void testBug260381c() throws JavaModelException { String source = @@ -4431,8 +4454,10 @@ " * Comments that can be formated in several lines...\n" + " * \n" + " * @author Myself\n" + - " * @version\n" + - " * 3.0 xxxxxxxxxxxxxx xwxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n" + + " * @version {@code \n" + + " * \n" + + " \n" + + " * The text here should not be formatted.... }\n" + " */\n" + "public class X01c {\n" + "}\n"; @@ -4441,7 +4466,10 @@ " * Comments that can be formated in several lines...\n" + " * \n" + " * @author Myself\n" + - " * @version 3.0 xxxxxxxxxxxxxx xwxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n" + + " * @version {@code \n" + + " * \n" + + " * \n" + + " * The text here should not be formatted.... }\n" + " */\n" + "public class X01c {\n" + "}\n" @@ -4453,41 +4481,131 @@ " * Comments that can be formated in several lines...\n" + " * \n" + " * @author Myself\n" + - " * @see Object $Revision: 1.51 $ $Date: 2010/02/12 18:33:47 $ $Author: oliviert $ $Source: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java,v $\n" + + " * @version The text here should not be formatted.... \n" + " */\n" + "public class X02 {\n" + "}\n"; + formatSource(source); +} +public void testBug260381e() throws JavaModelException { + String source = + "/**\n" + + " * Comments that can be formated in several lines...\n" + + " * \n" + + " * @author Myself\n" + + " * @version\n" + + " * The text here should not be formatted.... \n" + + " */\n" + + "public class X02b {\n" + + "}\n"; + formatSource(source, + "/**\n" + + " * Comments that can be formated in several lines...\n" + + " * \n" + + " * @author Myself\n" + + " * @version The text here should not be formatted.... \n" + + " */\n" + + "public class X02b {\n" + + "}\n" + ); +} +public void testBug260381f() throws JavaModelException { + String source = + "/**\n" + + " * Comments that can be formated in several lines...\n" + + " * \n" + + " * @author Myself\n" + + " * @see Object The text here should not be formatted.... \n" + + " */\n" + + "public class X02c {\n" + + "}\n"; formatSource(source, "/**\n" + " * Comments that can be formated in several lines...\n" + " * \n" + " * @author Myself\n" + " * @see Object\n" + - " * $Revision: 1.51 $ $Date: 2010/02/12 18:33:47 $ $Author: oliviert $ $Source: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java,v $\n" + + " * The text here should not be formatted.... \n" + " */\n" + - "public class X02 {\n" + + "public class X02c {\n" + "}\n" ); } -// TODO (frederic) Disabled as it fails with HEAD... -public void _testBug260381e() throws JavaModelException { +public void testBug260381g() throws JavaModelException { String source = "/**\n" + " * Comments that can be formated in several lines...\n" + " * \n" + - " * {@code $Revision: 1.51 $ $Date: 2010/02/12 18:33:47 $ $Author: oliviert $\n" + - " * $Source: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java,v $}\n" + + " * {@code The text here should not be formatted.... }\n" + " */\n" + "public class X03 {\n" + "}\n"; formatSource(source); } -public void testBug260381f() throws JavaModelException { +public void testBug260381h() throws JavaModelException { + String source = + "/**\n" + + " * Comments that can be formated in several lines...\n" + + " * \n" + + " * The text here should \n" + + " * not be formatted.... \n" + + " */\n" + + "public class X03b {\n" + + "}\n"; + formatSource(source); +} +public void testBug260381i() throws JavaModelException { + String source = + "/**\n" + + " * Comments that can be formated in several lines...\n" + + " * \n" + + " * {@code The text here should\n" + + " * not be formatted.... }\n" + + " */\n" + + "public class X03c {\n" + + "}\n"; + formatSource(source, + "/**\n" + + " * Comments that can be formated in several lines...\n" + + " * \n" + + " * {@code The text here should\n" + + " * not be formatted.... }\n" + + " */\n" + + "public class X03c {\n" + + "}\n" + ); +} +public void testBug260381j() throws JavaModelException { + String source = + "/**\n" + + " * Comments that can be formated in several lines...\n" + + " * \n" + + " * {@code \n" + + " * The text here should\n" + + " * not \n" + + " * be formatted.... }\n" + + " */\n" + + "public class X03d {\n" + + "}\n"; + formatSource(source, + "/**\n" + + " * Comments that can be formated in several lines...\n" + + " * \n" + + " * {@code \n" + + " * The text here should\n" + + " * not \n" + + " * be formatted.... }\n" + + " */\n" + + "public class X03d {\n" + + "}\n" + ); +} +public void testBug260381k() throws JavaModelException { String source = "/**\n" + " * Literal inline tag should also be untouched by the formatter\n" + " * \n" + - " * @version {@literal $Revision: 1.51 $ $Date: 2010/02/12 18:33:47 $ $Author: oliviert $ $Source: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java,v $}\n" + + " * @version {@literal The text here should not be formatted.... }\n" + " */\n" + "public class X04 {\n" + "\n" + @@ -4730,7 +4848,8 @@ "public interface I03 {\n" + " /**\n" + " * A builder for creating immutable bimap instances, especially\n" + - " * {@code public static final} bimaps (\"constant bimaps\"). Example:\n" + + " * {@code public\n" + + " * static final} bimaps (\"constant bimaps\"). Example:\n" + " * \n" + " *
\n" + 
 		"	 * {\n" + 
@@ -4752,6 +4871,29 @@
 		"}\n"
 	);
 }
+public void testBug260381_wksp2_03b() throws JavaModelException {
+	String source = 
+		"package wksp2;\n" + 
+		"\n" + 
+		"public interface I03b {\n" + 
+		"	/**\n" + 
+		"	 * A builder for creating immutable bimap instances, xxxxxxxx {@code public\n" + 
+		"	 * static final} bimaps (\"constant bimaps\").\n" + 
+		"	 */\n" + 
+		"	void foo();\n" + 
+		"}\n";
+	formatSource(source,
+		"package wksp2;\n" + 
+		"\n" + 
+		"public interface I03b {\n" + 
+		"	/**\n" + 
+		"	 * A builder for creating immutable bimap instances, xxxxxxxx {@code public\n" + 
+		"	 * static final} bimaps (\"constant bimaps\").\n" + 
+		"	 */\n" + 
+		"	void foo();\n" + 
+		"}\n"
+	);
+}
 public void testBug260381_wksp2_04() throws JavaModelException {
 	String source = 
 		"package wksp2;\n" + 
@@ -4769,8 +4911,8 @@
 		"   * ImmutableMultiset.copyOf(c)} returns an {@code ImmutableMultiset}\n" + 
 		"   * containing each of the strings in {@code c}, while\n" + 
 		"   * {@code ImmutableMultiset.of(c)} returns an\n" + 
-		"   * {@code ImmutableMultiset>} containing one element (the\n" + 
-		"   * given collection itself).\n" + 
+		"   * {@code ImmutableMultiset>} containing one element\n" + 
+		"   * (the given collection itself).\n" + 
 		"   *\n" + 
 		"   * 

Note: Despite what the method name suggests, if {@code elements}\n" + " * is an {@code ImmutableMultiset}, no copy will actually be performed, and\n" + @@ -4934,8 +5076,8 @@ " * {@code occurrences == 1}, this method has the identical effect to\n" + " * {@link #add(Object)}. This method is functionally equivalent (except in\n" + " * the case of overflow) to the call\n" + - " * {@code addAll(Collections.nCopies(element, occurrences))}, which would\n" + - " * presumably perform much more poorly.\n" + + " * {@code addAll(Collections.nCopies(element,\n" + + " * occurrences))}, which would presumably perform much more poorly.\n" + " * \n" + " * @param element\n" + " * the element to add occurrences of; may be {@code null} only if\n" + @@ -4987,12 +5129,11 @@ " /**\n" + " * Constructs a new, empty multiset, sorted according to the specified\n" + " * comparator. All elements inserted into the multiset must be mutually\n" + - " * comparable by the specified comparator:\n" + - " * {@code comparator.compare(e1, e2)} must not throw a\n" + - " * {@code ClassCastException} for any elements {@code e1} and {@code e2} in\n" + - " * the multiset. If the user attempts to add an element to the multiset that\n" + - " * violates this constraint, the {@code add(Object)} call will throw a\n" + - " * {@code ClassCastException}.\n" + + " * comparable by the specified comparator: {@code comparator.compare(e1,\n" + + " * e2)} must not throw a {@code ClassCastException} for any elements\n" + + " * {@code e1} and {@code e2} in the multiset. If the user attempts to add an\n" + + " * element to the multiset that violates this constraint, the\n" + + " * {@code add(Object)} call will throw a {@code ClassCastException}.\n" + " * \n" + " * @param comparator\n" + " * the comparator that will be used to sort this multiset. A null\n" +