### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: buildnotes_jdt-core.html =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/buildnotes_jdt-core.html,v retrieving revision 1.7291 diff -u -r1.7291 buildnotes_jdt-core.html --- buildnotes_jdt-core.html 11 Feb 2010 01:37:17 -0000 1.7291 +++ buildnotes_jdt-core.html 11 Feb 2010 08:55:53 -0000 @@ -48,6 +48,7 @@
Project org.eclipse.jdt.core v_A35 (cvs).

What's new in this drop

+Patch v04 for bug 260381

Problem Reports Fixed

302446 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.9 diff -u -r1.9 FormatJavadocBlock.java --- formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java 10 Nov 2009 21:38:04 -0000 1.9 +++ formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java 11 Feb 2010 08:55:54 -0000 @@ -31,6 +31,7 @@ final static int PARAM_TAG = 0x0020; final static int IN_PARAM_TAG = 0x0040; final static int IN_DESCRIPTION = 0x0080; + final static int IMMUTABLE = 0x0100; // constants final static int MAX_TAG_HIERARCHY = 10; @@ -53,6 +54,11 @@ case TAG_THROWS_VALUE: case TAG_EXCEPTION_VALUE: this.flags |= PARAM_TAG; + break; + case TAG_CODE_VALUE: + case TAG_LITERAL_VALUE: + this.flags |= IMMUTABLE; + break; } } @@ -141,6 +147,9 @@ } } addNode(text); + if (isImmutable()) { + text.immutable = true; + } } void clean() { @@ -322,6 +331,18 @@ return (this.flags & PARAM_TAG) == PARAM_TAG; } +/** + * Returns whether the block is immutable or not. + *

+ * Currently, only @code inline tag 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; @@ -332,9 +353,10 @@ } protected void toString(StringBuffer buffer) { - if ((this.flags & INLINED) != 0) buffer.append('{'); + boolean inlined = (this.flags & INLINED) != 0; + if (inlined) buffer.append(" {"); //$NON-NLS-1$ buffer.append('@'); - buffer.append(this.tagValue); + buffer.append(TAG_NAMES[this.tagValue]); super.toString(buffer); if (this.reference == null) { buffer.append('\n'); @@ -345,6 +367,7 @@ } if (this.nodesPtr > -1) { for (int i = 0; i <= this.nodesPtr; i++) { + if (inlined) buffer.append('\t'); this.nodes[i].toString(buffer); } } Index: formatter/org/eclipse/jdt/internal/formatter/FormatJavadocNode.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/FormatJavadocNode.java,v retrieving revision 1.6 diff -u -r1.6 FormatJavadocNode.java --- formatter/org/eclipse/jdt/internal/formatter/FormatJavadocNode.java 27 Jun 2008 16:04:07 -0000 1.6 +++ formatter/org/eclipse/jdt/internal/formatter/FormatJavadocNode.java 11 Feb 2010 08:55:54 -0000 @@ -56,6 +56,17 @@ return false; } +/** + * Returns whether the node is immutable or not. If true, then + * the formatter will leave it contents unchanged. + * + * @return true if the node is immutable, false + * otherwise. + */ +public boolean isImmutable() { + return false; +} + public String toString() { StringBuffer buffer = new StringBuffer(); toString(buffer); 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.8 diff -u -r1.8 FormatJavadocText.java --- formatter/org/eclipse/jdt/internal/formatter/FormatJavadocText.java 27 Jun 2008 16:04:08 -0000 1.8 +++ formatter/org/eclipse/jdt/internal/formatter/FormatJavadocText.java 11 Feb 2010 08:55:54 -0000 @@ -31,6 +31,7 @@ long[] separators; int separatorsPtr = -1; private int htmlTagIndex = -1; + boolean immutable = false; FormatJavadocNode[] htmlNodes; int[] htmlIndexes; int htmlNodesPtr = -1; @@ -49,6 +50,7 @@ * child node. */ void appendText(FormatJavadocText text) { + this.immutable = text.immutable; if (this.depth == text.depth) { addSeparator(text); this.sourceEnd = text.sourceEnd; @@ -167,6 +169,7 @@ * * @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; @@ -174,6 +177,21 @@ } /** + * Returns whether the text is immutable or not. + *

+ * A text in considered as immutable when it belongs to an immutable block + * or when it's an immutable html tag. + *

+ * + * @return true if the node is an immutable tag, + * false otherwise. + */ +public boolean isImmutable() { + return this.immutable || (this.htmlTagIndex != -1 && (this.htmlTagIndex & JAVADOC_TAGS_ID_MASK) == JAVADOC_IMMUTABLE_TAGS_ID); + +} + +/** * Returns whether the text at the given separator index position is after a * separator tag or not. * 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.31 diff -u -r1.31 FormatterCommentParser.java --- formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java 9 Feb 2010 08:56:38 -0000 1.31 +++ formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java 11 Feb 2010 08:55:55 -0000 @@ -356,6 +356,7 @@ this.scanner.resetTo(this.index, this.javadocEnd); return true; } + this.tagValue = TAG_OTHERS_VALUE; // tag is invalid, do not keep the parsed tag value return false; } @@ -382,6 +383,7 @@ } this.scanner.resetTo(this.tagSourceEnd+1, this.javadocEnd); } + this.tagValue = TAG_OTHERS_VALUE; // tag is invalid, do not keep the parsed tag value } return valid; } @@ -394,6 +396,7 @@ if (!valid) { this.scanner.resetTo(this.tagSourceEnd+1, this.javadocEnd); this.index = this.tagSourceEnd+1; + this.tagValue = TAG_OTHERS_VALUE; // tag is invalid, do not keep the parsed tag value } return valid; } @@ -506,7 +509,7 @@ if (length == TAG_LINK_LENGTH && CharOperation.equals(TAG_LINK, tagName)) { this.tagValue = TAG_LINK_VALUE; if (this.inlineTagStarted || (this.kind & COMPLETION_PARSER) != 0) { - valid= parseReference(); + valid = parseReference(); } else { // bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=53290 // Cannot have @link outside inline comment @@ -605,7 +608,6 @@ } else if (this.invalidTagName) { this.textStart = previousPosition; } else if (this.astPtr == ptr) { - this.tagValue = TAG_OTHERS_VALUE; // tag is invalid, do not keep the parsed tag value createTag(); } return true; @@ -620,6 +622,7 @@ // If invalid, restart from the end tag position this.scanner.resetTo(this.tagSourceEnd+1, this.javadocEnd); this.index = this.tagSourceEnd+1; + this.tagValue = TAG_OTHERS_VALUE; // tag is invalid, do not keep the parsed tag value } return valid; } Index: formatter/org/eclipse/jdt/internal/formatter/Scribe.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java,v retrieving revision 1.190 diff -u -r1.190 Scribe.java --- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 7 Jan 2010 20:18:49 -0000 1.190 +++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 11 Feb 2010 08:55:57 -0000 @@ -2866,7 +2866,7 @@ if (newLines > 0) newLines = 1; } } - if (newLines == 0) { + if (newLines == 0 && (!node.isImmutable() || block.reference != null)) { newLines = printJavadocBlockNodesNewLines(block, node, previousEnd); } printJavadocGapLines(previousEnd+1, nodeStart-1, newLines, clearBlankLines, false, null); @@ -2898,18 +2898,16 @@ // Print node if (node.isText()) { FormatJavadocText text = (FormatJavadocText) node; - if (text.isHtmlTag()) { - if (text.isImmutableHtmlTag()) { - // Indent if new line was added - if (newLines > 0 && this.commentIndentation != null) { - addInsertEdit(node.sourceStart, this.commentIndentation); - this.column += this.commentIndentation.length(); - } - printJavadocHtmlImmutableTag(text, block, newLines > 0); - this.column += getTextLength(block, text); - } else { - printJavadocHtmlTag(text, block, newLines>0); + if (text.isImmutable()) { + // Indent if new line was added + if (newLines > 0 && this.commentIndentation != null) { + addInsertEdit(node.sourceStart, this.commentIndentation); + this.column += this.commentIndentation.length(); } + printJavadocImmutableText(text, block, newLines > 0); + this.column += getTextLength(block, text); + } else if (text.isHtmlTag()) { + printJavadocHtmlTag(text, block, newLines>0); } else { printJavadocText(text, block, newLines>0); } @@ -2934,15 +2932,29 @@ try { this.scanner.resetTo(nodeStart , node.sourceEnd); int length = 0; - int newLines = 0; boolean newLine = false; boolean headerLine = block.isHeaderLine() && this.lastNumberOfNewLines == 0; int firstColumn = 1 + this.indentationLevel + BLOCK_LINE_PREFIX_LENGTH; if (this.commentIndentation != null) firstColumn += this.commentIndentation.length(); if (headerLine) maxColumn++; - if (node.isText()) { - FormatJavadocText text = (FormatJavadocText)node; - if (text.isImmutableHtmlTag()) { + FormatJavadocText text = null; + boolean isImmutableNode = node.isImmutable(); + boolean nodeIsText = node.isText(); + if (nodeIsText) { + text = (FormatJavadocText)node; + } else { + FormatJavadocBlock inlinedBlock = (FormatJavadocBlock)node; + if (isImmutableNode) { + text = (FormatJavadocText) inlinedBlock.getLastNode(); + length += inlinedBlock.tagEnd - inlinedBlock.sourceStart + 1; // tag length + if (nodeStart > (previousEnd+1)) { + length++; // include space between nodes + } + this.scanner.resetTo(text.sourceStart , node.sourceEnd); + } + } + if (text != null) { + if (isImmutableNode) { if (nodeStart > (previousEnd+1)) { length++; // include space between nodes } @@ -2952,8 +2964,10 @@ int token = this.scanner.getNextToken(); switch (token) { case TerminalTokens.TokenNameWHITESPACE: - if (CharOperation.indexOf('\n', this.scanner.source, this.scanner.startPosition, this.scanner.currentPosition) >= 0) { - return newLines; + if (nodeIsText) { + if (CharOperation.indexOf('\n', this.scanner.source, this.scanner.startPosition, this.scanner.currentPosition) >= 0) { + return 0; + } } length = 1; break; @@ -2975,15 +2989,10 @@ } lastColumn += length; if (lastColumn > maxColumn) { - newLines++; - if (headerLine) { - maxColumn--; - headerLine = false; - } - lastColumn = firstColumn; + return 1; } } - return newLines; + return 0; } if (text.isHtmlTag()) { if (text.getHtmlTagID() == JAVADOC_SINGLE_BREAK_TAG_ID) { @@ -3146,7 +3155,7 @@ private int getTextLength(FormatJavadocBlock block, FormatJavadocText text) { // Special case for immutable tags - if (text.isImmutableHtmlTag()) { + if (text.isImmutable()) { this.scanner.resetTo(text.sourceStart , text.sourceEnd); int textLength = 0; while (!this.scanner.atEnd()) { @@ -3468,23 +3477,16 @@ } } - private void printJavadocHtmlImmutableTag(FormatJavadocText text, FormatJavadocBlock block, boolean textOnNewLine) { + private void printJavadocImmutableText(FormatJavadocText text, FormatJavadocBlock block, boolean textOnNewLine) { try { // Iterate on text line separators int lineNumber = text.lineStart; this.scanner.tokenizeWhiteSpace = false; StringBuffer buffer = null; - for (int idx=1, max=text.separatorsPtr; idx\n" + - " * &at;MyAnnotation\n" + - " * \n" + - " */\n" + - "}\n"; - formatSource(source, - "public class X {\n" + - "\n" + - " /**\n" + - " *
\n" + 
-		"	 * &at;MyAnnotation\n" + 
-		"	 * 
\n" + - " */\n" + + String source = + "public class X {\n" + + "\n" + + " /**\n" + + " *
\n" +
+		"	 * &at;MyAnnotation\n" +
+		"	 * 
\n" + + " */\n" + + "}\n"; + formatSource(source, + "public class X {\n" + + "\n" + + " /**\n" + + " *
\n" +
+		"	 * &at;MyAnnotation\n" +
+		"	 * 
\n" + + " */\n" + "}\n" ); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=204257 public void testBug196308b() throws JavaModelException { - String source = - "public class A\n" + - "{\n" + - " /**\n" + - " *
\n" + 
-		"   *   \u\n" + 
-		"   * 
\n" + - " */\n" + - " public void a()\n" + - " {\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class A {\n" + - " /**\n" + - " *
\n" + 
-		"	 *   \u\n" + 
-		"	 * 
\n" + - " */\n" + - " public void a() {\n" + - " }\n" + + String source = + "public class A\n" + + "{\n" + + " /**\n" + + " *
\n" +
+		"   *   \u\n" +
+		"   * 
\n" + + " */\n" + + " public void a()\n" + + " {\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class A {\n" + + " /**\n" + + " *
\n" +
+		"	 *   \u\n" +
+		"	 * 
\n" + + " */\n" + + " public void a() {\n" + + " }\n" + "}\n" ); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=238547 public void testBug196308c() throws JavaModelException { - String source = - "/**\n" + - " *  !@Aé\n" + - " *
 !@Aé
\n" + - " */\n" + + String source = + "/**\n" + + " *  !@Aé\n" + + " *
 !@Aé
\n" + + " */\n" + "public class TestClass {}\n"; formatSource(source, - "/**\n" + - " *  !@Aé\n" + - " * \n" + - " *
\n" + 
-		" *  !@Aé\n" + 
-		" * 
\n" + - " */\n" + - "public class TestClass {\n" + + "/**\n" + + " *  !@Aé\n" + + " * \n" + + " *
\n" +
+		" *  !@Aé\n" +
+		" * 
\n" + + " */\n" + + "public class TestClass {\n" + "}\n" ); } @@ -122,18 +122,18 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB; String source = - "public class Test {\n" + - "\n" + - " int x = 0; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 0; /*\n" + + " * XXXX\n" + + " */\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " int x = 0; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 0; /*\n" + + " * XXXX\n" + + " */\n" + "}" ); } @@ -141,18 +141,18 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB; String source = - "public class Test {\n" + - "\n" + - " int x = 10; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 10; /*\n" + + " * XXXX\n" + + " */\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " int x = 10; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 10; /*\n" + + " * XXXX\n" + + " */\n" + "}" ); } @@ -160,18 +160,18 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB; String source = - "public class Test {\n" + - "\n" + - " int x = 100; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 100; /*\n" + + " * XXXX\n" + + " */\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " int x = 100; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 100; /*\n" + + " * XXXX\n" + + " */\n" + "}" ); } @@ -179,18 +179,18 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB; String source = - "public class Test {\n" + - "\n" + - " int x = 0; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 0; /*\n" + + " * XXXX\n" + + " */\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " int x = 0; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 0; /*\n" + + " * XXXX\n" + + " */\n" + "}" ); } @@ -198,20 +198,20 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB; String source = - "public class Test {\n" + - "\n" + - " /*\n" + - " * XXXX\n" + - " */\n" + - " int x = 0;\n" + + "public class Test {\n" + + "\n" + + " /*\n" + + " * XXXX\n" + + " */\n" + + " int x = 0;\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " /*\n" + - " * XXXX\n" + - " */\n" + - " int x = 0;\n" + + "public class Test {\n" + + "\n" + + " /*\n" + + " * XXXX\n" + + " */\n" + + " int x = 0;\n" + "}" ); } @@ -219,20 +219,20 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB; String source = - "public class Test {\n" + - "\n" + - " /*\n" + - " * XXXX\n" + - " */\n" + - " int x = 0;\n" + + "public class Test {\n" + + "\n" + + " /*\n" + + " * XXXX\n" + + " */\n" + + " int x = 0;\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " /*\n" + - " * XXXX\n" + - " */\n" + - " int x = 0;\n" + + "public class Test {\n" + + "\n" + + " /*\n" + + " * XXXX\n" + + " */\n" + + " int x = 0;\n" + "}" ); } @@ -240,18 +240,18 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE; String source = - "public class Test {\n" + - "\n" + - " int x = 0; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 0; /*\n" + + " * XXXX\n" + + " */\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " int x = 0; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 0; /*\n" + + " * XXXX\n" + + " */\n" + "}" ); } @@ -259,18 +259,18 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE; String source = - "public class Test {\n" + - "\n" + - " int x = 10; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 10; /*\n" + + " * XXXX\n" + + " */\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " int x = 10; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 10; /*\n" + + " * XXXX\n" + + " */\n" + "}" ); } @@ -278,18 +278,18 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE; String source = - "public class Test {\n" + - "\n" + - " int x = 100; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 100; /*\n" + + " * XXXX\n" + + " */\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " int x = 100; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 100; /*\n" + + " * XXXX\n" + + " */\n" + "}" ); } @@ -297,18 +297,18 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE; String source = - "public class Test {\n" + - "\n" + - " int x = 0; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 0; /*\n" + + " * XXXX\n" + + " */\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " int x = 0; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 0; /*\n" + + " * XXXX\n" + + " */\n" + "}" ); } @@ -316,20 +316,20 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE; String source = - "public class Test {\n" + - "\n" + - " /*\n" + - " * XXXX\n" + - " */\n" + - " int x = 0;\n" + + "public class Test {\n" + + "\n" + + " /*\n" + + " * XXXX\n" + + " */\n" + + " int x = 0;\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " /*\n" + - " * XXXX\n" + - " */\n" + - " int x = 0;\n" + + "public class Test {\n" + + "\n" + + " /*\n" + + " * XXXX\n" + + " */\n" + + " int x = 0;\n" + "}" ); } @@ -337,20 +337,20 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE; String source = - "public class Test {\n" + - "\n" + - " /*\n" + - " * XXXX\n" + - " */\n" + - " int x = 0;\n" + + "public class Test {\n" + + "\n" + + " /*\n" + + " * XXXX\n" + + " */\n" + + " int x = 0;\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " /*\n" + - " * XXXX\n" + - " */\n" + - " int x = 0;\n" + + "public class Test {\n" + + "\n" + + " /*\n" + + " * XXXX\n" + + " */\n" + + " int x = 0;\n" + "}" ); } @@ -358,18 +358,18 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED; String source = - "public class Test {\n" + - "\n" + - " int x = 0; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 0; /*\n" + + " * XXXX\n" + + " */\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " int x = 0; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 0; /*\n" + + " * XXXX\n" + + " */\n" + "}" ); } @@ -377,18 +377,18 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED; String source = - "public class Test {\n" + - "\n" + - " int x = 10; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 10; /*\n" + + " * XXXX\n" + + " */\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " int x = 10; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 10; /*\n" + + " * XXXX\n" + + " */\n" + "}" ); } @@ -396,18 +396,18 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED; String source = - "public class Test {\n" + - "\n" + - " int x = 100; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 100; /*\n" + + " * XXXX\n" + + " */\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " int x = 100; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 100; /*\n" + + " * XXXX\n" + + " */\n" + "}" ); } @@ -415,18 +415,18 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED; String source = - "public class Test {\n" + - "\n" + - " int x = 0; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 0; /*\n" + + " * XXXX\n" + + " */\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " int x = 0; /*\n" + - " * XXXX\n" + - " */\n" + + "public class Test {\n" + + "\n" + + " int x = 0; /*\n" + + " * XXXX\n" + + " */\n" + "}" ); } @@ -434,20 +434,20 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED; String source = - "public class Test {\n" + - "\n" + - " /*\n" + - " * XXXX\n" + - " */\n" + - " int x = 0;\n" + + "public class Test {\n" + + "\n" + + " /*\n" + + " * XXXX\n" + + " */\n" + + " int x = 0;\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " /*\n" + - " * XXXX\n" + - " */\n" + - " int x = 0;\n" + + "public class Test {\n" + + "\n" + + " /*\n" + + " * XXXX\n" + + " */\n" + + " int x = 0;\n" + "}" ); } @@ -455,20 +455,20 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED; String source = - "public class Test {\n" + - "\n" + - " /*\n" + - " * XXXX\n" + - " */\n" + - " int x = 0;\n" + + "public class Test {\n" + + "\n" + + " /*\n" + + " * XXXX\n" + + " */\n" + + " int x = 0;\n" + "}"; formatSource(source, - "public class Test {\n" + - "\n" + - " /*\n" + - " * XXXX\n" + - " */\n" + - " int x = 0;\n" + + "public class Test {\n" + + "\n" + + " /*\n" + + " * XXXX\n" + + " */\n" + + " int x = 0;\n" + "}" ); } @@ -482,24 +482,24 @@ public void _testBug204091() { String source = "public class Test {\r\n" + - " /**\r\n" + - " * Don't format this:\r\n" + - " * it has been formatted by the user!\r\n" + - " * \r\n" + - " * [#@param param format this comment #]\r\n" + - " */\r\n" + + " /**\r\n" + + " * Don't format this:\r\n" + + " * it has been formatted by the user!\r\n" + + " * \r\n" + + " * [#@param param format this comment #]\r\n" + + " */\r\n" + " public void foo() {\r\n" + " }\r\n" + "}"; formatSource(source, "public class Test {\r\n" + - " /**\r\n" + - " * Don't format this:\r\n" + - " * it has been formatted by the user!\r\n" + - " * \r\n" + - " * @param param\n" + - " * format this comment\n" + - " */\r\n" + + " /**\r\n" + + " * Don't format this:\r\n" + + " * it has been formatted by the user!\r\n" + + " * \r\n" + + " * @param param\n" + + " * format this comment\n" + + " */\r\n" + " public void foo() {\r\n" + " }\r\n" + "}" @@ -513,177 +513,177 @@ */ public void testBug217108a() { String source = - "public class Test {\n" + - "\n" + - " /* a */\n" + - " // b\n" + - "\n" + - " int i;\n" + - "\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " /* a */\n" + - " // b\n" + - "\n" + - " int i;\n" + - "\n" + + "public class Test {\n" + + "\n" + + " /* a */\n" + + " // b\n" + + "\n" + + " int i;\n" + + "\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " /* a */\n" + + " // b\n" + + "\n" + + " int i;\n" + + "\n" + "}\n" ); } public void testBug217108b() { String source = - "public class Test {\n" + - "\n" + - " /* a */\n" + - "\n" + - " // b\n" + - "\n" + - " int i;\n" + - "\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " /* a */\n" + - "\n" + - " // b\n" + - "\n" + - " int i;\n" + - "\n" + + "public class Test {\n" + + "\n" + + " /* a */\n" + + "\n" + + " // b\n" + + "\n" + + " int i;\n" + + "\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " /* a */\n" + + "\n" + + " // b\n" + + "\n" + + " int i;\n" + + "\n" + "}\n" ); } public void testBug217108c() { String source = - "public class Test {\n" + - "\n" + - " // b\n" + - " /* a */\n" + - "\n" + - " int i;\n" + - "\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " // b\n" + - " /* a */\n" + - "\n" + - " int i;\n" + - "\n" + + "public class Test {\n" + + "\n" + + " // b\n" + + " /* a */\n" + + "\n" + + " int i;\n" + + "\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " // b\n" + + " /* a */\n" + + "\n" + + " int i;\n" + + "\n" + "}\n" ); } public void testBug217108d() { String source = - "public class Test {\n" + - "\n" + - " // b\n" + - "\n" + - " /* a */\n" + - "\n" + - " int i;\n" + - "\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " // b\n" + - "\n" + - " /* a */\n" + - "\n" + - " int i;\n" + - "\n" + + "public class Test {\n" + + "\n" + + " // b\n" + + "\n" + + " /* a */\n" + + "\n" + + " int i;\n" + + "\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " // b\n" + + "\n" + + " /* a */\n" + + "\n" + + " int i;\n" + + "\n" + "}\n" ); } public void testBug217108e() { String source = - "public class Test {\n" + - "\n" + - " // a\n" + - "\n" + - " // b\n" + - "\n" + - " int i;\n" + - "\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " // a\n" + - "\n" + - " // b\n" + - "\n" + - " int i;\n" + - "\n" + + "public class Test {\n" + + "\n" + + " // a\n" + + "\n" + + " // b\n" + + "\n" + + " int i;\n" + + "\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " // a\n" + + "\n" + + " // b\n" + + "\n" + + " int i;\n" + + "\n" + "}\n" ); } public void testBug217108f() { String source = - "public class Test {\n" + - "\n" + - " // a\n" + - " // b\n" + - "\n" + - " int i;\n" + - "\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " // a\n" + - " // b\n" + - "\n" + - " int i;\n" + - "\n" + + "public class Test {\n" + + "\n" + + " // a\n" + + " // b\n" + + "\n" + + " int i;\n" + + "\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " // a\n" + + " // b\n" + + "\n" + + " int i;\n" + + "\n" + "}\n" ); } public void testBug217108g() { String source = - "public class Test {\n" + - "\n" + - " /** a */\n" + - " // b\n" + - "\n" + - " int i;\n" + - "\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " /** a */\n" + - " // b\n" + - "\n" + - " int i;\n" + - "\n" + + "public class Test {\n" + + "\n" + + " /** a */\n" + + " // b\n" + + "\n" + + " int i;\n" + + "\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " /** a */\n" + + " // b\n" + + "\n" + + " int i;\n" + + "\n" + "}\n" ); } public void testBug217108h() { String source = - "public class Test {\n" + - "\n" + - " /** a */\n" + - "\n" + - " // b\n" + - "\n" + - " int i;\n" + - "\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " /** a */\n" + - "\n" + - " // b\n" + - "\n" + - " int i;\n" + - "\n" + + "public class Test {\n" + + "\n" + + " /** a */\n" + + "\n" + + " // b\n" + + "\n" + + " int i;\n" + + "\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " /** a */\n" + + "\n" + + " // b\n" + + "\n" + + " int i;\n" + + "\n" + "}\n" ); } @@ -1808,256 +1808,256 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=234583" */ public void testBug234583a() throws JavaModelException { - String source = - "public class X {\n" + - "[# int i= 1; #]\n" + + String source = + "public class X {\n" + + "[# int i= 1; #]\n" + "}\n"; formatSource(source, - "public class X {\n" + - " int i = 1;\n" + + "public class X {\n" + + " int i = 1;\n" + "}\n" ); } public void testBug234583b() throws JavaModelException { - String source = - "public class X { \n" + - "\n" + - "\n" + - "\n" + - "[# int i= 1; #]\n" + - "\n" + - "\n" + - "\n" + - "\n" + + String source = + "public class X { \n" + + "\n" + + "\n" + + "\n" + + "[# int i= 1; #]\n" + + "\n" + + "\n" + + "\n" + + "\n" + " }\n"; formatSource(source, - "public class X { \n" + - "\n" + - "\n" + - "\n" + - " int i = 1;\n" + - "\n" + - "\n" + - "\n" + - "\n" + + "public class X { \n" + + "\n" + + "\n" + + "\n" + + " int i = 1;\n" + + "\n" + + "\n" + + "\n" + + "\n" + " }\n" ); } public void testBug234583c() throws JavaModelException { - String source = - "public class X { \n" + - "\n" + - "\n" + - "\n" + - "[# int i= 1; \n" + - "#]\n" + - "\n" + - "\n" + - "\n" + + String source = + "public class X { \n" + + "\n" + + "\n" + + "\n" + + "[# int i= 1; \n" + + "#]\n" + + "\n" + + "\n" + + "\n" + " }\n"; formatSource(source, - "public class X { \n" + - "\n" + - "\n" + - "\n" + - " int i = 1;\n" + - "\n" + - "\n" + - "\n" + + "public class X { \n" + + "\n" + + "\n" + + "\n" + + " int i = 1;\n" + + "\n" + + "\n" + + "\n" + " }\n" ); } public void testBug234583d() throws JavaModelException { - String source = - "public class X { \n" + - "\n" + - "\n" + - "[#\n" + - " int i= 1; \n" + - "\n" + - "#]\n" + - "\n" + - "\n" + + String source = + "public class X { \n" + + "\n" + + "\n" + + "[#\n" + + " int i= 1; \n" + + "\n" + + "#]\n" + + "\n" + + "\n" + " }\n"; formatSource(source, - "public class X { \n" + - "\n" + - "\n" + - " int i = 1;\n" + - "\n" + - "\n" + + "public class X { \n" + + "\n" + + "\n" + + " int i = 1;\n" + + "\n" + + "\n" + " }\n" ); } public void testBug234583e() throws JavaModelException { - String source = - "public class X { \n" + - "\n" + - "[#\n" + - "\n" + - " int i= 1; \n" + - "\n" + - "\n" + - "#]\n" + - "\n" + + String source = + "public class X { \n" + + "\n" + + "[#\n" + + "\n" + + " int i= 1; \n" + + "\n" + + "\n" + + "#]\n" + + "\n" + " }\n"; formatSource(source, - "public class X { \n" + - "\n" + - " int i = 1;\n" + - "\n" + - " }\n" + "public class X { \n" + + "\n" + + " int i = 1;\n" + + "\n" + + " }\n" ); } public void testBug234583f() throws JavaModelException { - String source = - "public class X { \n" + - "[#\n" + - "\n" + - "\n" + - " int i= 1; \n" + - "\n" + - "\n" + - "\n" + - "#]\n" + + String source = + "public class X { \n" + + "[#\n" + + "\n" + + "\n" + + " int i= 1; \n" + + "\n" + + "\n" + + "\n" + + "#]\n" + " }\n"; formatSource(source, - "public class X { \n" + - "\n" + - " int i = 1;\n" + - "\n" + + "public class X { \n" + + "\n" + + " int i = 1;\n" + + "\n" + " }\n" ); } public void testBug234583g() throws JavaModelException { - String source = - "public class X { [#\n" + - "\n" + - "\n" + - "\n" + - " int i= 1; \n" + - "\n" + - "\n" + - "\n" + - "\n" + + String source = + "public class X { [#\n" + + "\n" + + "\n" + + "\n" + + " int i= 1; \n" + + "\n" + + "\n" + + "\n" + + "\n" + "#] }\n"; formatSource(source, - "public class X { \n" + - "\n" + - " int i = 1;\n" + - "\n" + + "public class X { \n" + + "\n" + + " int i = 1;\n" + + "\n" + " }\n" ); } public void testBug234583h() throws JavaModelException { - String source = - "public class X { [# \n" + - "\n" + - "\n" + - "\n" + - " int i= 1; \n" + - "\n" + - "\n" + - "\n" + - "\n" + + String source = + "public class X { [# \n" + + "\n" + + "\n" + + "\n" + + " int i= 1; \n" + + "\n" + + "\n" + + "\n" + + "\n" + " #] }\n"; formatSource(source, - "public class X { \n" + - "\n" + - " int i = 1;\n" + - "\n" + + "public class X { \n" + + "\n" + + " int i = 1;\n" + + "\n" + " }\n" ); } public void testBug234583i() throws JavaModelException { - String source = - "public class X {[# \n" + - "\n" + - "\n" + - "\n" + - " int i= 1; \n" + - "\n" + - "\n" + - "\n" + - "\n" + + String source = + "public class X {[# \n" + + "\n" + + "\n" + + "\n" + + " int i= 1; \n" + + "\n" + + "\n" + + "\n" + + "\n" + " #]}\n"; formatSource(source, - "public class X {\n" + - "\n" + - " int i = 1;\n" + - "\n" + + "public class X {\n" + + "\n" + + " int i = 1;\n" + + "\n" + "}\n" ); } // duplicate https://bugs.eclipse.org/bugs/show_bug.cgi?id=239447 public void testBug234583_Bug239447() throws JavaModelException { - String source = - "public class Bug239447 {\n" + - " private static final String CONTENT = \"test.ObjectB {\\n\"\n" + - "[# + \" multiEle = { name=\\\"Foo\\\" }\\n\"#]\n" + - " + \" multiEle = :x { name=\\\"Bar\\\" }\\n\" + \" singleEle = x;\\n\"\n" + - " + \"}\";\n" + - "\n" + + String source = + "public class Bug239447 {\n" + + " private static final String CONTENT = \"test.ObjectB {\\n\"\n" + + "[# + \" multiEle = { name=\\\"Foo\\\" }\\n\"#]\n" + + " + \" multiEle = :x { name=\\\"Bar\\\" }\\n\" + \" singleEle = x;\\n\"\n" + + " + \"}\";\n" + + "\n" + "}\n"; formatSource(source, - "public class Bug239447 {\n" + - " private static final String CONTENT = \"test.ObjectB {\\n\"\n" + - " + \" multiEle = { name=\\\"Foo\\\" }\\n\"\n" + - " + \" multiEle = :x { name=\\\"Bar\\\" }\\n\" + \" singleEle = x;\\n\"\n" + - " + \"}\";\n" + - "\n" + + "public class Bug239447 {\n" + + " private static final String CONTENT = \"test.ObjectB {\\n\"\n" + + " + \" multiEle = { name=\\\"Foo\\\" }\\n\"\n" + + " + \" multiEle = :x { name=\\\"Bar\\\" }\\n\" + \" singleEle = x;\\n\"\n" + + " + \"}\";\n" + + "\n" + "}\n" ); } // duplicate https://bugs.eclipse.org/bugs/show_bug.cgi?id=237592 public void testBug234583_Bug237592() throws JavaModelException { - String source = - "package test;\n" + - "\n" + - "public class Test {\n" + - "\n" + - " void foo() {\n" + - " }\n" + - "\n" + - "[# #]\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "[# #]\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " void bar() {\n" + - " }\n" + - "\n" + - "}\n"; - formatSource(source, - "package test;\n" + - "\n" + - "public class Test {\n" + - "\n" + - " void foo() {\n" + - " }\n" + - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " void bar() {\n" + - " }\n" + - "\n" + + String source = + "package test;\n" + + "\n" + + "public class Test {\n" + + "\n" + + " void foo() {\n" + + " }\n" + + "\n" + + "[# #]\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "[# #]\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " void bar() {\n" + + " }\n" + + "\n" + + "}\n"; + formatSource(source, + "package test;\n" + + "\n" + + "public class Test {\n" + + "\n" + + " void foo() {\n" + + " }\n" + + "\n" + + "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " void bar() {\n" + + " }\n" + + "\n" + "}\n" ); } @@ -2393,223 +2393,223 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=237453" */ public void testBug237453a() throws JavaModelException { - String source = - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " [#\n" + - " #]\n" + - " void bar() {\n" + - " }\n" + - "}"; - formatSource(source, - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - " void bar() {\n" + - " }\n" + + String source = + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " [#\n" + + " #]\n" + + " void bar() {\n" + + " }\n" + + "}"; + formatSource(source, + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + " void bar() {\n" + + " }\n" + "}" ); } public void testBug237453b() throws JavaModelException { - String source = - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - "[# #]\n" + - " void bar() {\n" + - " }\n" + - "}"; - formatSource(source, - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - "\n" + - " void bar() {\n" + - " }\n" + + String source = + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + "[# #]\n" + + " void bar() {\n" + + " }\n" + + "}"; + formatSource(source, + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + "\n" + + " void bar() {\n" + + " }\n" + "}" ); } public void testBug237453c() throws JavaModelException { - String source = - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - "[# \n" + - "#] void bar() {\n" + - " }\n" + - "}"; - formatSource(source, - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - " void bar() {\n" + - " }\n" + + String source = + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + "[# \n" + + "#] void bar() {\n" + + " }\n" + + "}"; + formatSource(source, + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + " void bar() {\n" + + " }\n" + "}" ); } public void testBug237453d() throws JavaModelException { - String source = - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - "[# \n" + - " #] void bar() {\n" + - " }\n" + - "}"; - formatSource(source, - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - " void bar() {\n" + - " }\n" + + String source = + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + "[# \n" + + " #] void bar() {\n" + + " }\n" + + "}"; + formatSource(source, + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + " void bar() {\n" + + " }\n" + "}" ); } public void testBug237453e() throws JavaModelException { - String source = - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - "[# \n" + - " #]void bar() {\n" + - " }\n" + - "}"; - formatSource(source, - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - " void bar() {\n" + - " }\n" + + String source = + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + "[# \n" + + " #]void bar() {\n" + + " }\n" + + "}"; + formatSource(source, + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + " void bar() {\n" + + " }\n" + "}" ); } public void testBug237453f() throws JavaModelException { - String source = - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - " \n" + - "[# #] void bar() {\n" + - " }\n" + - "}"; - formatSource(source, - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - " \n" + - " void bar() {\n" + - " }\n" + + String source = + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + " \n" + + "[# #] void bar() {\n" + + " }\n" + + "}"; + formatSource(source, + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + " \n" + + " void bar() {\n" + + " }\n" + "}" ); } public void testBug237453g() throws JavaModelException { - String source = - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - " \n" + - "[# #] void bar() {\n" + - " }\n" + - "}"; - formatSource(source, - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - " \n" + - " void bar() {\n" + - " }\n" + + String source = + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + " \n" + + "[# #] void bar() {\n" + + " }\n" + + "}"; + formatSource(source, + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + " \n" + + " void bar() {\n" + + " }\n" + "}" ); } public void testBug237453h() throws JavaModelException { - String source = - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - " \n" + - "[# #]void bar() {\n" + - " }\n" + - "}"; - formatSource(source, - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - " \n" + - " void bar() {\n" + - " }\n" + + String source = + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + " \n" + + "[# #]void bar() {\n" + + " }\n" + + "}"; + formatSource(source, + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + " \n" + + " void bar() {\n" + + " }\n" + "}" ); } public void testBug237453i() throws JavaModelException { - String source = - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - " \n" + - "[# #]void bar() {\n" + - " }\n" + - "}"; - formatSource(source, - "package test1;\n" + - "\n" + - "public class E1 {\n" + - " void foo() {\n" + - " }\n" + - " \n" + - " \n" + - " void bar() {\n" + - " }\n" + + String source = + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + " \n" + + "[# #]void bar() {\n" + + " }\n" + + "}"; + formatSource(source, + "package test1;\n" + + "\n" + + "public class E1 {\n" + + " void foo() {\n" + + " }\n" + + " \n" + + " \n" + + " void bar() {\n" + + " }\n" + "}" ); } @@ -2657,150 +2657,150 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=238210" */ public void testBug238210() throws JavaModelException { - String source = - "/**\n" + - " * LineCommentTestCase\n" + - " * \n" + - " * Formatting this compilation unit with line comment enabled and comment line width set to 100 or\n" + - " * lower will result in both protected region comments to be wrapped although they do not contain\n" + - " * any whitespace (excluding leading whitespace which should be / is being ignored altogether)\n" + - " * \n" + - " * @author Axel Faust, PRODYNA AG\n" + - " */\n" + - "public class LineCommentTestCase {\n" + - "\n" + - " public void someGeneratedMethod() {\n" + - " //protected-region-start_[id=_14_0_1_3dd20592_1202209856234_914658_24183_someGeneratedMethod]\n" + - " // some manually written code\n" + - " // protected-region-end_[id=_14_0_1_3dd20592_1202209856234_914658_24183_someGeneratedMethod]\n" + - " }\n" + - "}\n"; - formatSource(source, - "/**\n" + - " * LineCommentTestCase\n" + - " * \n" + - " * Formatting this compilation unit with line comment enabled and comment line\n" + - " * width set to 100 or lower will result in both protected region comments to be\n" + - " * wrapped although they do not contain any whitespace (excluding leading\n" + - " * whitespace which should be / is being ignored altogether)\n" + - " * \n" + - " * @author Axel Faust, PRODYNA AG\n" + - " */\n" + - "public class LineCommentTestCase {\n" + - "\n" + - " public void someGeneratedMethod() {\n" + - " // protected-region-start_[id=_14_0_1_3dd20592_1202209856234_914658_24183_someGeneratedMethod]\n" + - " // some manually written code\n" + - " // protected-region-end_[id=_14_0_1_3dd20592_1202209856234_914658_24183_someGeneratedMethod]\n" + - " }\n" + + String source = + "/**\n" + + " * LineCommentTestCase\n" + + " * \n" + + " * Formatting this compilation unit with line comment enabled and comment line width set to 100 or\n" + + " * lower will result in both protected region comments to be wrapped although they do not contain\n" + + " * any whitespace (excluding leading whitespace which should be / is being ignored altogether)\n" + + " * \n" + + " * @author Axel Faust, PRODYNA AG\n" + + " */\n" + + "public class LineCommentTestCase {\n" + + "\n" + + " public void someGeneratedMethod() {\n" + + " //protected-region-start_[id=_14_0_1_3dd20592_1202209856234_914658_24183_someGeneratedMethod]\n" + + " // some manually written code\n" + + " // protected-region-end_[id=_14_0_1_3dd20592_1202209856234_914658_24183_someGeneratedMethod]\n" + + " }\n" + + "}\n"; + formatSource(source, + "/**\n" + + " * LineCommentTestCase\n" + + " * \n" + + " * Formatting this compilation unit with line comment enabled and comment line\n" + + " * width set to 100 or lower will result in both protected region comments to be\n" + + " * wrapped although they do not contain any whitespace (excluding leading\n" + + " * whitespace which should be / is being ignored altogether)\n" + + " * \n" + + " * @author Axel Faust, PRODYNA AG\n" + + " */\n" + + "public class LineCommentTestCase {\n" + + "\n" + + " public void someGeneratedMethod() {\n" + + " // protected-region-start_[id=_14_0_1_3dd20592_1202209856234_914658_24183_someGeneratedMethod]\n" + + " // some manually written code\n" + + " // protected-region-end_[id=_14_0_1_3dd20592_1202209856234_914658_24183_someGeneratedMethod]\n" + + " }\n" + "}\n" ); } // possible side effects detected while running massive tests public void testBug238210_X01() throws JavaModelException { - String source = - "package eclipse30;\n" + - "\n" + - "public class X01 {\n" + - "\n" + - " void foo() {\n" + - " \n" + - " binding = new LocalVariableBinding(this, tb, modifiers, false); // argument decl, but local var (where isArgument = false)\n" + - " }\n" + - "\n" + - " public class LocalVariableBinding {\n" + - "\n" + - " public LocalVariableBinding(X01 x01, Object tb, Object modifiers,\n" + - " boolean b) {\n" + - " }\n" + - "\n" + - " }\n" + - "\n" + - " Object modifiers;\n" + - " Object tb;\n" + - " LocalVariableBinding binding;\n" + - "}\n"; - formatSource(source, - "package eclipse30;\n" + - "\n" + - "public class X01 {\n" + - "\n" + - " void foo() {\n" + - "\n" + - " binding = new LocalVariableBinding(this, tb, modifiers, false); // argument\n" + - " // decl,\n" + - " // but\n" + - " // local\n" + - " // var\n" + - " // (where\n" + - " // isArgument\n" + - " // =\n" + - " // false)\n" + - " }\n" + - "\n" + - " public class LocalVariableBinding {\n" + - "\n" + - " public LocalVariableBinding(X01 x01, Object tb, Object modifiers,\n" + - " boolean b) {\n" + - " }\n" + - "\n" + - " }\n" + - "\n" + - " Object modifiers;\n" + - " Object tb;\n" + - " LocalVariableBinding binding;\n" + + String source = + "package eclipse30;\n" + + "\n" + + "public class X01 {\n" + + "\n" + + " void foo() {\n" + + " \n" + + " binding = new LocalVariableBinding(this, tb, modifiers, false); // argument decl, but local var (where isArgument = false)\n" + + " }\n" + + "\n" + + " public class LocalVariableBinding {\n" + + "\n" + + " public LocalVariableBinding(X01 x01, Object tb, Object modifiers,\n" + + " boolean b) {\n" + + " }\n" + + "\n" + + " }\n" + + "\n" + + " Object modifiers;\n" + + " Object tb;\n" + + " LocalVariableBinding binding;\n" + + "}\n"; + formatSource(source, + "package eclipse30;\n" + + "\n" + + "public class X01 {\n" + + "\n" + + " void foo() {\n" + + "\n" + + " binding = new LocalVariableBinding(this, tb, modifiers, false); // argument\n" + + " // decl,\n" + + " // but\n" + + " // local\n" + + " // var\n" + + " // (where\n" + + " // isArgument\n" + + " // =\n" + + " // false)\n" + + " }\n" + + "\n" + + " public class LocalVariableBinding {\n" + + "\n" + + " public LocalVariableBinding(X01 x01, Object tb, Object modifiers,\n" + + " boolean b) {\n" + + " }\n" + + "\n" + + " }\n" + + "\n" + + " Object modifiers;\n" + + " Object tb;\n" + + " LocalVariableBinding binding;\n" + "}\n", false /*do not formatting twice*/ ); } public void testBug238210_X02() throws JavaModelException { - String source = - "package eclipse30;\n" + - "\n" + - "public class X02 {\n" + - " //private static short[] randomArray = {213, 231, 37, 85, 211, 29, 161, 175, 187, 3, 147, 246, 170, 30, 202, 183, 242, 47, 254, 189, 25, 248, 193, 2};\n" + + String source = + "package eclipse30;\n" + + "\n" + + "public class X02 {\n" + + " //private static short[] randomArray = {213, 231, 37, 85, 211, 29, 161, 175, 187, 3, 147, 246, 170, 30, 202, 183, 242, 47, 254, 189, 25, 248, 193, 2};\n" + "}\n"; formatSource(source, - "package eclipse30;\n" + - "\n" + - "public class X02 {\n" + - " // private static short[] randomArray = {213, 231, 37, 85, 211, 29, 161,\n" + - " // 175, 187, 3, 147, 246, 170, 30, 202, 183, 242, 47, 254, 189, 25, 248,\n" + - " // 193, 2};\n" + + "package eclipse30;\n" + + "\n" + + "public class X02 {\n" + + " // private static short[] randomArray = {213, 231, 37, 85, 211, 29, 161,\n" + + " // 175, 187, 3, 147, 246, 170, 30, 202, 183, 242, 47, 254, 189, 25, 248,\n" + + " // 193, 2};\n" + "}\n" ); } public void testBug238210_X03() throws JavaModelException { - String source = - "package eclipse30;\n" + - "\n" + - "public class X03 {\n" + - "\n" + - " \n" + - " /**\n" + - " * @see org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint#handleBreakpointEvent(com.sun.jdi.event.Event, org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget, org.eclipse.jdt.internal.debug.core.model.JDIThread)\n" + - " * \n" + - " * (From referenced JavaDoc:\n" + - " * Returns whethers the thread should be resumed\n" + - " */\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - formatSource(source, - "package eclipse30;\n" + - "\n" + - "public class X03 {\n" + - "\n" + - " /**\n" + - " * @see org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint#handleBreakpointEvent(com.sun.jdi.event.Event,\n" + - " * org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget,\n" + - " * org.eclipse.jdt.internal.debug.core.model.JDIThread)\n" + - " * \n" + - " * (From referenced JavaDoc: Returns whethers the thread should be\n" + - " * resumed\n" + - " */\n" + - " void foo() {\n" + - " }\n" + + String source = + "package eclipse30;\n" + + "\n" + + "public class X03 {\n" + + "\n" + + " \n" + + " /**\n" + + " * @see org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint#handleBreakpointEvent(com.sun.jdi.event.Event, org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget, org.eclipse.jdt.internal.debug.core.model.JDIThread)\n" + + " * \n" + + " * (From referenced JavaDoc:\n" + + " * Returns whethers the thread should be resumed\n" + + " */\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + formatSource(source, + "package eclipse30;\n" + + "\n" + + "public class X03 {\n" + + "\n" + + " /**\n" + + " * @see org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint#handleBreakpointEvent(com.sun.jdi.event.Event,\n" + + " * org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget,\n" + + " * org.eclipse.jdt.internal.debug.core.model.JDIThread)\n" + + " * \n" + + " * (From referenced JavaDoc: Returns whethers the thread should be\n" + + " * resumed\n" + + " */\n" + + " void foo() {\n" + + " }\n" + "}\n" ); } @@ -2811,30 +2811,30 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=238853" */ public void testBug238853() throws JavaModelException { - String source = - "public class Test {\n" + - "\n" + - "/**\n" + - " * This is a test comment. \n" + - " *

\n" + - " * Another comment.
\n" + - " * Another comment.\n" + - " */\n" + - "public void testMethod1()\n" + - "{\n" + - "}\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " /**\n" + - " * This is a test comment.\n" + - " *

\n" + - " * Another comment.
\n" + - " * Another comment.\n" + - " */\n" + - " public void testMethod1() {\n" + - " }\n" + + String source = + "public class Test {\n" + + "\n" + + "/**\n" + + " * This is a test comment. \n" + + " *

\n" + + " * Another comment.
\n" + + " * Another comment.\n" + + " */\n" + + "public void testMethod1()\n" + + "{\n" + + "}\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " /**\n" + + " * This is a test comment.\n" + + " *

\n" + + " * Another comment.
\n" + + " * Another comment.\n" + + " */\n" + + " public void testMethod1() {\n" + + " }\n" + "}\n" ); } @@ -2845,66 +2845,66 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=238920" */ public void testBug238920() throws JavaModelException { - String source = - "public class X01 {\n" + - "/**\n" + - " * @category test\n" + - " */\n" + - "void foo() {\n" + - "}\n" + - "}\n"; - formatSource(source, - "public class X01 {\n" + - " /**\n" + - " * @category test\n" + - " */\n" + - " void foo() {\n" + - " }\n" + + String source = + "public class X01 {\n" + + "/**\n" + + " * @category test\n" + + " */\n" + + "void foo() {\n" + + "}\n" + + "}\n"; + formatSource(source, + "public class X01 {\n" + + " /**\n" + + " * @category test\n" + + " */\n" + + " void foo() {\n" + + " }\n" + "}\n" ); } public void testBug238920b() throws JavaModelException { - String source = - "public class X02 {\n" + - "/**\n" + - " * Test for bug 238920\n" + - " * @category test\n" + - " */\n" + - "void foo() {\n" + - "}\n" + - "}\n"; - formatSource(source, - "public class X02 {\n" + - " /**\n" + - " * Test for bug 238920\n" + - " * \n" + - " * @category test\n" + - " */\n" + - " void foo() {\n" + - " }\n" + + String source = + "public class X02 {\n" + + "/**\n" + + " * Test for bug 238920\n" + + " * @category test\n" + + " */\n" + + "void foo() {\n" + + "}\n" + + "}\n"; + formatSource(source, + "public class X02 {\n" + + " /**\n" + + " * Test for bug 238920\n" + + " * \n" + + " * @category test\n" + + " */\n" + + " void foo() {\n" + + " }\n" + "}\n" ); } public void testBug238920c() throws JavaModelException { - String source = - "public class X03 {\n" + - "/**\n" + - " * @category test\n" + - " * @return zero\n" + - " */\n" + - "int foo() {\n" + - " return 0;\n" + - "}\n" + - "}\n"; - formatSource(source, - "public class X03 {\n" + - " /**\n" + - " * @category test\n" + - " * @return zero\n" + - " */\n" + - " int foo() {\n" + - " return 0;\n" + - " }\n" + + String source = + "public class X03 {\n" + + "/**\n" + + " * @category test\n" + + " * @return zero\n" + + " */\n" + + "int foo() {\n" + + " return 0;\n" + + "}\n" + + "}\n"; + formatSource(source, + "public class X03 {\n" + + " /**\n" + + " * @category test\n" + + " * @return zero\n" + + " */\n" + + " int foo() {\n" + + " return 0;\n" + + " }\n" + "}\n" ); } @@ -2915,328 +2915,328 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=239130" */ public void testBug239130_default() throws JavaModelException { - String source = - "public class X {\n" + - "\n" + - " /**\n" + - " * @see java.lang.String\n" + - " * \n" + - " * Formatter should keep empty line above\n" + - " */\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class X {\n" + - "\n" + - " /**\n" + - " * @see java.lang.String\n" + - " * \n" + - " * Formatter should keep empty line above\n" + - " */\n" + - " void foo() {\n" + - " }\n" + + String source = + "public class X {\n" + + "\n" + + " /**\n" + + " * @see java.lang.String\n" + + " * \n" + + " * Formatter should keep empty line above\n" + + " */\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class X {\n" + + "\n" + + " /**\n" + + " * @see java.lang.String\n" + + " * \n" + + " * Formatter should keep empty line above\n" + + " */\n" + + " void foo() {\n" + + " }\n" + "}\n" ); } public void testBug239130_clearBlankLines() throws JavaModelException { this.formatterPrefs.comment_clear_blank_lines_in_javadoc_comment = true; - String source = - "public class X {\n" + - "\n" + - " /**\n" + - " * @see java.lang.String\n" + - " * \n" + - " * Formatter should keep empty line above\n" + - " */\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class X {\n" + - "\n" + - " /**\n" + - " * @see java.lang.String Formatter should keep empty line above\n" + - " */\n" + - " void foo() {\n" + - " }\n" + + String source = + "public class X {\n" + + "\n" + + " /**\n" + + " * @see java.lang.String\n" + + " * \n" + + " * Formatter should keep empty line above\n" + + " */\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class X {\n" + + "\n" + + " /**\n" + + " * @see java.lang.String Formatter should keep empty line above\n" + + " */\n" + + " void foo() {\n" + + " }\n" + "}\n" ); } public void testBug239130_preserveLineBreaks() throws JavaModelException { this.formatterPrefs.join_lines_in_comments = false; - String source = - "public class X {\n" + - "\n" + - " /**\n" + - " * @see java.lang.String\n" + - " * \n" + - " * Formatter should keep empty line above\n" + - " */\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class X {\n" + - "\n" + - " /**\n" + - " * @see java.lang.String\n" + - " * \n" + - " * Formatter should keep empty line above\n" + - " */\n" + - " void foo() {\n" + - " }\n" + + String source = + "public class X {\n" + + "\n" + + " /**\n" + + " * @see java.lang.String\n" + + " * \n" + + " * Formatter should keep empty line above\n" + + " */\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class X {\n" + + "\n" + + " /**\n" + + " * @see java.lang.String\n" + + " * \n" + + " * Formatter should keep empty line above\n" + + " */\n" + + " void foo() {\n" + + " }\n" + "}\n" ); } public void testBug239130_clearBlankLines_preserveLineBreaks() throws JavaModelException { this.formatterPrefs.join_lines_in_comments = false; this.formatterPrefs.comment_clear_blank_lines_in_javadoc_comment = true; - String source = - "public class X {\n" + - "\n" + - " /**\n" + - " * @see java.lang.String\n" + - " * \n" + - " * Formatter should keep empty line above\n" + - " */\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class X {\n" + - "\n" + - " /**\n" + - " * @see java.lang.String\n" + - " * Formatter should keep empty line above\n" + - " */\n" + - " void foo() {\n" + - " }\n" + + String source = + "public class X {\n" + + "\n" + + " /**\n" + + " * @see java.lang.String\n" + + " * \n" + + " * Formatter should keep empty line above\n" + + " */\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class X {\n" + + "\n" + + " /**\n" + + " * @see java.lang.String\n" + + " * Formatter should keep empty line above\n" + + " */\n" + + " void foo() {\n" + + " }\n" + "}\n" ); } // duplicate bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=196124 public void testBug239130_196124_default() throws JavaModelException { - String source = - "public class X {\n" + - "\n" + - " /**\n" + - " * The foo method.\n" + - " * foo is a substitute for bar.\n" + - " * \n" + - " * @param param1 The first parameter\n" + - " * @param param2\n" + - " * The second parameter.\n" + - " * If nullthe first parameter is used\n" + - " */\n" + - " public void foo(Object param1, Object param2) {\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class X {\n" + - "\n" + - " /**\n" + - " * The foo method. foo is a substitute for bar.\n" + - " * \n" + - " * @param param1\n" + - " * The first parameter\n" + - " * @param param2\n" + - " * The second parameter. If nullthe first parameter is\n" + - " * used\n" + - " */\n" + - " public void foo(Object param1, Object param2) {\n" + - " }\n" + + String source = + "public class X {\n" + + "\n" + + " /**\n" + + " * The foo method.\n" + + " * foo is a substitute for bar.\n" + + " * \n" + + " * @param param1 The first parameter\n" + + " * @param param2\n" + + " * The second parameter.\n" + + " * If nullthe first parameter is used\n" + + " */\n" + + " public void foo(Object param1, Object param2) {\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class X {\n" + + "\n" + + " /**\n" + + " * The foo method. foo is a substitute for bar.\n" + + " * \n" + + " * @param param1\n" + + " * The first parameter\n" + + " * @param param2\n" + + " * The second parameter. If nullthe first parameter is\n" + + " * used\n" + + " */\n" + + " public void foo(Object param1, Object param2) {\n" + + " }\n" + "}\n" ); } public void testBug239130_196124() throws JavaModelException { this.formatterPrefs.join_lines_in_comments = false; - String source = - "public class X {\n" + - "\n" + - " /**\n" + - " * The foo method.\n" + - " * foo is a substitute for bar.\n" + - " * \n" + - " * @param param1 The first parameter\n" + - " * @param param2\n" + - " * The second parameter.\n" + - " * If nullthe first parameter is used\n" + - " */\n" + - " public void foo(Object param1, Object param2) {\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class X {\n" + - "\n" + - " /**\n" + + String source = + "public class X {\n" + + "\n" + + " /**\n" + + " * The foo method.\n" + + " * foo is a substitute for bar.\n" + + " * \n" + + " * @param param1 The first parameter\n" + + " * @param param2\n" + + " * The second parameter.\n" + + " * If nullthe first parameter is used\n" + + " */\n" + + " public void foo(Object param1, Object param2) {\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class X {\n" + + "\n" + + " /**\n" + " * The foo method.\n" + - " * foo is a substitute for bar.\n" + - " * \n" + - " * @param param1\n" + - " * The first parameter\n" + - " * @param param2\n" + - " * The second parameter.\n" + - " * If nullthe first parameter is used\n" + - " */\n" + - " public void foo(Object param1, Object param2) {\n" + - " }\n" + + " * foo is a substitute for bar.\n" + + " * \n" + + " * @param param1\n" + + " * The first parameter\n" + + " * @param param2\n" + + " * The second parameter.\n" + + " * If nullthe first parameter is used\n" + + " */\n" + + " public void foo(Object param1, Object param2) {\n" + + " }\n" + "}\n" ); } // duplicate bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=96696 public void testBug239130_96696_block_default() throws JavaModelException { - String source = - "public class Test {\n" + - "\n" + - " /*\n" + - " * Conceptually, all viewers perform two primary tasks:\n" + - " * \n" + - " * - They help adapt your domain objects into viewable entities\n" + - " * \n" + - " * - They provide notifications when the viewable entities are selected or\n" + - " * changed through the UI\n" + - " */\n" + - " public void foo() {\n" + - " }\n" + + String source = + "public class Test {\n" + + "\n" + + " /*\n" + + " * Conceptually, all viewers perform two primary tasks:\n" + + " * \n" + + " * - They help adapt your domain objects into viewable entities\n" + + " * \n" + + " * - They provide notifications when the viewable entities are selected or\n" + + " * changed through the UI\n" + + " */\n" + + " public void foo() {\n" + + " }\n" + "}\n"; formatSource(source, source); } public void testBug239130_96696_block_clearBlankLines() throws JavaModelException { this.formatterPrefs.join_wrapped_lines = false; this.formatterPrefs.comment_clear_blank_lines_in_block_comment = true; - String source = - "public class Test {\n" + - "\n" + - " /*\n" + - " * Conceptually, all viewers perform two primary tasks:\n" + - " * \n" + - " * - They help adapt your domain objects into viewable entities\n" + - " * \n" + - " * - They provide notifications when the viewable entities are selected or\n" + - " * changed through the UI\n" + - " */\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " /*\n" + - " * Conceptually, all viewers perform two primary tasks: - They help adapt\n" + - " * your domain objects into viewable entities - They provide notifications\n" + - " * when the viewable entities are selected or changed through the UI\n" + - " */\n" + - " public void foo() {\n" + - " }\n" + + String source = + "public class Test {\n" + + "\n" + + " /*\n" + + " * Conceptually, all viewers perform two primary tasks:\n" + + " * \n" + + " * - They help adapt your domain objects into viewable entities\n" + + " * \n" + + " * - They provide notifications when the viewable entities are selected or\n" + + " * changed through the UI\n" + + " */\n" + + " public void foo() {\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " /*\n" + + " * Conceptually, all viewers perform two primary tasks: - They help adapt\n" + + " * your domain objects into viewable entities - They provide notifications\n" + + " * when the viewable entities are selected or changed through the UI\n" + + " */\n" + + " public void foo() {\n" + + " }\n" + "}\n" ); } public void testBug239130_96696_block_clearBlankLines_preserveLineBreaks() throws JavaModelException { this.formatterPrefs.join_lines_in_comments = false; this.formatterPrefs.comment_clear_blank_lines_in_block_comment = true; - String source = - "public class Test {\n" + - "\n" + - " /*\n" + - " * Conceptually, all viewers perform two primary tasks:\n" + - " * \n" + - " * - They help adapt your domain objects into viewable entities\n" + - " * \n" + - " * - They provide notifications when the viewable entities are selected or\n" + - " * changed through the UI\n" + - " */\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " /*\n" + - " * Conceptually, all viewers perform two primary tasks:\n" + - " * - They help adapt your domain objects into viewable entities\n" + - " * - They provide notifications when the viewable entities are selected or\n" + - " * changed through the UI\n" + - " */\n" + - " public void foo() {\n" + - " }\n" + + String source = + "public class Test {\n" + + "\n" + + " /*\n" + + " * Conceptually, all viewers perform two primary tasks:\n" + + " * \n" + + " * - They help adapt your domain objects into viewable entities\n" + + " * \n" + + " * - They provide notifications when the viewable entities are selected or\n" + + " * changed through the UI\n" + + " */\n" + + " public void foo() {\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " /*\n" + + " * Conceptually, all viewers perform two primary tasks:\n" + + " * - They help adapt your domain objects into viewable entities\n" + + " * - They provide notifications when the viewable entities are selected or\n" + + " * changed through the UI\n" + + " */\n" + + " public void foo() {\n" + + " }\n" + "}\n" ); } public void testBug239130_96696_javadoc_default() throws JavaModelException { - String source = - "public class Test {\n" + - "\n" + - " /**\n" + - " * Conceptually, all viewers perform two primary tasks:\n" + - " * \n" + - " * - They help adapt your domain objects into viewable entities\n" + - " * \n" + - " * - They provide notifications when the viewable entities are selected or\n" + - " * changed through the UI\n" + - " */\n" + - " public void foo() {\n" + - " }\n" + + String source = + "public class Test {\n" + + "\n" + + " /**\n" + + " * Conceptually, all viewers perform two primary tasks:\n" + + " * \n" + + " * - They help adapt your domain objects into viewable entities\n" + + " * \n" + + " * - They provide notifications when the viewable entities are selected or\n" + + " * changed through the UI\n" + + " */\n" + + " public void foo() {\n" + + " }\n" + "}\n"; formatSource(source, source); } public void testBug239130_96696_javadoc_clearBlankLines() throws JavaModelException { this.formatterPrefs.comment_clear_blank_lines_in_javadoc_comment = true; - String source = - "public class Test {\n" + - "\n" + - " /**\n" + - " * Conceptually, all viewers perform two primary tasks:\n" + - " * \n" + - " * - They help adapt your domain objects into viewable entities\n" + - " * \n" + - " * - They provide notifications when the viewable entities are selected or\n" + - " * changed through the UI\n" + - " */\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " /**\n" + - " * Conceptually, all viewers perform two primary tasks: - They help adapt\n" + - " * your domain objects into viewable entities - They provide notifications\n" + - " * when the viewable entities are selected or changed through the UI\n" + - " */\n" + - " public void foo() {\n" + - " }\n" + + String source = + "public class Test {\n" + + "\n" + + " /**\n" + + " * Conceptually, all viewers perform two primary tasks:\n" + + " * \n" + + " * - They help adapt your domain objects into viewable entities\n" + + " * \n" + + " * - They provide notifications when the viewable entities are selected or\n" + + " * changed through the UI\n" + + " */\n" + + " public void foo() {\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " /**\n" + + " * Conceptually, all viewers perform two primary tasks: - They help adapt\n" + + " * your domain objects into viewable entities - They provide notifications\n" + + " * when the viewable entities are selected or changed through the UI\n" + + " */\n" + + " public void foo() {\n" + + " }\n" + "}\n" ); } public void testBug239130_96696_javadoc_clearBlankLines_preserveLineBreaks() throws JavaModelException { this.formatterPrefs.join_lines_in_comments = false; this.formatterPrefs.comment_clear_blank_lines_in_javadoc_comment = true; - String source = - "public class Test {\n" + - "\n" + - " /**\n" + - " * Conceptually, all viewers perform two primary tasks:\n" + - " * \n" + - " * - They help adapt your domain objects into viewable entities\n" + - " * \n" + - " * - They provide notifications when the viewable entities are selected or\n" + - " * changed through the UI\n" + - " */\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " /**\n" + - " * Conceptually, all viewers perform two primary tasks:\n" + - " * - They help adapt your domain objects into viewable entities\n" + - " * - They provide notifications when the viewable entities are selected or\n" + - " * changed through the UI\n" + - " */\n" + - " public void foo() {\n" + - " }\n" + + String source = + "public class Test {\n" + + "\n" + + " /**\n" + + " * Conceptually, all viewers perform two primary tasks:\n" + + " * \n" + + " * - They help adapt your domain objects into viewable entities\n" + + " * \n" + + " * - They provide notifications when the viewable entities are selected or\n" + + " * changed through the UI\n" + + " */\n" + + " public void foo() {\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " /**\n" + + " * Conceptually, all viewers perform two primary tasks:\n" + + " * - They help adapt your domain objects into viewable entities\n" + + " * - They provide notifications when the viewable entities are selected or\n" + + " * changed through the UI\n" + + " */\n" + + " public void foo() {\n" + + " }\n" + "}\n" ); } @@ -3247,83 +3247,83 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=239719" */ public void testBug239719() throws JavaModelException { - String source = - "/**\n" + - " *

\n" + 
-		" *  public class Test implements Runnable\n" + 
-		" *  {\n" + 
-		" *    @Override\n" + 
-		" *    public void run()\n" + 
-		" *    { \n" + 
-		" *      // Hello really bad Ganymede formatter !!!\n" + 
-		" *      // Shit happens when somebody tries to change a running system\n" + 
-		" *      System.out.println(\"Press Shift+Ctrl+F to format\");\n" + 
-		" *    }\n" + 
-		" *  }
\n" + - " */\n" + - " public class Test \n" + - " {\n" + + String source = + "/**\n" + + " *
\n" +
+		" *  public class Test implements Runnable\n" +
+		" *  {\n" +
+		" *    @Override\n" +
+		" *    public void run()\n" +
+		" *    { \n" +
+		" *      // Hello really bad Ganymede formatter !!!\n" +
+		" *      // Shit happens when somebody tries to change a running system\n" +
+		" *      System.out.println(\"Press Shift+Ctrl+F to format\");\n" +
+		" *    }\n" +
+		" *  }
\n" + + " */\n" + + " public class Test \n" + + " {\n" + " }\n"; formatSource(source, - "/**\n" + - " *
\n" + 
-		" * public class Test implements Runnable {\n" + 
-		" * 	@Override\n" + 
-		" * 	public void run() {\n" + 
-		" * 		// Hello really bad Ganymede formatter !!!\n" + 
-		" * 		// Shit happens when somebody tries to change a running system\n" + 
-		" * 		System.out.println("Press Shift+Ctrl+F to format");\n" + 
-		" * 	}\n" + 
-		" * }\n" + 
-		" * 
\n" + - " */\n" + - "public class Test {\n" + + "/**\n" + + " *
\n" +
+		" * public class Test implements Runnable {\n" +
+		" * 	@Override\n" +
+		" * 	public void run() {\n" +
+		" * 		// Hello really bad Ganymede formatter !!!\n" +
+		" * 		// Shit happens when somebody tries to change a running system\n" +
+		" * 		System.out.println("Press Shift+Ctrl+F to format");\n" +
+		" * 	}\n" +
+		" * }\n" +
+		" * 
\n" + + " */\n" + + "public class Test {\n" + "}\n" ); } public void testBug239719b() throws JavaModelException { - String source = - "public class X01 {\n" + - " \n" + - " private int fLength;\n" + - " private int fOffset;\n" + - "\n" + - " /**\n" + - " * Returns the inclusive end position of this edit. The inclusive end\n" + - " * position denotes the last character of the region manipulated by\n" + - " * this edit. The returned value is the result of the following\n" + - " * calculation:\n" + - " *
\n" + 
-		"	 *   getOffset() + getLength() - 1;\n" + 
-		"	 * 
\n" + 
-		"	 * \n" + 
-		"	 * @return the inclusive end position\n" + 
-		"	 */\n" + 
-		"	public final int getInclusiveEnd() {\n" + 
-		"		return fOffset + fLength - 1;\n" + 
-		"	}\n" + 
-		"}\n";
-	formatSource(source,
-		"public class X01 {\n" + 
-		"\n" + 
-		"	private int fLength;\n" + 
-		"	private int fOffset;\n" + 
-		"\n" + 
-		"	/**\n" + 
-		"	 * Returns the inclusive end position of this edit. The inclusive end\n" + 
-		"	 * position denotes the last character of the region manipulated by this\n" + 
-		"	 * edit. The returned value is the result of the following calculation:\n" + 
-		"	 * \n" + 
-		"	 * 
\n" + 
-		"	 * getOffset() + getLength() - 1;\n" + 
-		"	 * \n" + 
-		"	 * 
\n" + 
-		"	 * \n" + 
-		"	 * @return the inclusive end position\n" + 
-		"	 */\n" + 
-		"	public final int getInclusiveEnd() {\n" + 
-		"		return fOffset + fLength - 1;\n" + 
-		"	}\n" + 
+	String source =
+		"public class X01 {\n" +
+		"	\n" +
+		"	private int fLength;\n" +
+		"	private int fOffset;\n" +
+		"\n" +
+		"	/**\n" +
+		"	 * Returns the inclusive end position of this edit. The inclusive end\n" +
+		"	 * position denotes the last character of the region manipulated by\n" +
+		"	 * this edit. The returned value is the result of the following\n" +
+		"	 * calculation:\n" +
+		"	 * 
\n" +
+		"	 *   getOffset() + getLength() - 1;\n" +
+		"	 * 
\n" +
+		"	 * \n" +
+		"	 * @return the inclusive end position\n" +
+		"	 */\n" +
+		"	public final int getInclusiveEnd() {\n" +
+		"		return fOffset + fLength - 1;\n" +
+		"	}\n" +
+		"}\n";
+	formatSource(source,
+		"public class X01 {\n" +
+		"\n" +
+		"	private int fLength;\n" +
+		"	private int fOffset;\n" +
+		"\n" +
+		"	/**\n" +
+		"	 * Returns the inclusive end position of this edit. The inclusive end\n" +
+		"	 * position denotes the last character of the region manipulated by this\n" +
+		"	 * edit. The returned value is the result of the following calculation:\n" +
+		"	 * \n" +
+		"	 * 
\n" +
+		"	 * getOffset() + getLength() - 1;\n" +
+		"	 * \n" +
+		"	 * 
\n" +
+		"	 * \n" +
+		"	 * @return the inclusive end position\n" +
+		"	 */\n" +
+		"	public final int getInclusiveEnd() {\n" +
+		"		return fOffset + fLength - 1;\n" +
+		"	}\n" +
 		"}\n"
 	);
 }
@@ -3334,86 +3334,86 @@
  * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=239941"
  */
 public void testBug239941() throws JavaModelException {
-	String source = 
-		"public class X01 {\n" + 
-		"\n" + 
-		"	/**\n" + 
-		"	 * 
\n" + 
-		"	 * Unclosed pre tag\n" + 
-		"	 */\n" + 
-		"	int foo;\n" + 
-		"\n" + 
-		"    /**\n" + 
-		"     * Gets the signers of this class.\n" + 
-		"     *\n" + 
-		"     * @return  the signers of this class, or null if there are no signers.  In\n" + 
-		"     * 		particular, this method returns null if this object represents\n" + 
-		"     * 		a primitive type or void.\n" + 
-		"     * @since 	JDK1.1\n" + 
-		"     */\n" + 
-		"    public native Object[] getSigners();\n" + 
-		"}\n";
-	formatSource(source,
-		"public class X01 {\n" + 
-		"\n" + 
-		"	/**\n" + 
-		"	 * 
\n" + 
-		"	 * Unclosed pre tag\n" + 
-		"	 */\n" + 
-		"	int foo;\n" + 
-		"\n" + 
-		"	/**\n" + 
-		"	 * Gets the signers of this class.\n" + 
-		"	 * \n" + 
-		"	 * @return the signers of this class, or null if there are no signers. In\n" + 
-		"	 *         particular, this method returns null if this object represents a\n" + 
-		"	 *         primitive type or void.\n" + 
-		"	 * @since JDK1.1\n" + 
-		"	 */\n" + 
-		"	public native Object[] getSigners();\n" + 
-		"}\n"
-	);
-}
-
-/**
- * @bug 240686: [formatter] Formatter do unexpected things
- * @test Ensure that open brace are well taken into account just after the HTML tag opening
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=240686"
- */
-public void testBug240686() throws JavaModelException {
-	String source = 
-		"public class Test {\n" + 
-		"\n" + 
-		"/** \n" + 
-		" * 
{ }
\n" + - " * \n" + - " * \n" + - " * { \"1\",\n" + - " * \"2\"}\n" + - " * \n" + - " *
\n" + - " */\n" + - "void foo() {}\n" + - "}\n"; - // output is different than 3.3 one: is considered as new line tag - // hence the text inside the tag is put on a new line - formatSource(source, - "public class Test {\n" + - "\n" + - " /**\n" + - " *
\n" + 
-		"	 * {}\n" + 
-		"	 * 
\n" + - " * \n" + - " * \n" + - " * \n" + - " * { \"1\", \"2\"}\n" + - " * \n" + - " *
\n" + - " */\n" + - " void foo() {\n" + - " }\n" + - "}\n" + String source = + "public class X01 {\n" + + "\n" + + " /**\n" + + " *
\n" +
+		"	 * Unclosed pre tag\n" +
+		"	 */\n" +
+		"	int foo;\n" +
+		"\n" +
+		"    /**\n" +
+		"     * Gets the signers of this class.\n" +
+		"     *\n" +
+		"     * @return  the signers of this class, or null if there are no signers.  In\n" +
+		"     * 		particular, this method returns null if this object represents\n" +
+		"     * 		a primitive type or void.\n" +
+		"     * @since 	JDK1.1\n" +
+		"     */\n" +
+		"    public native Object[] getSigners();\n" +
+		"}\n";
+	formatSource(source,
+		"public class X01 {\n" +
+		"\n" +
+		"	/**\n" +
+		"	 * 
\n" +
+		"	 * Unclosed pre tag\n" +
+		"	 */\n" +
+		"	int foo;\n" +
+		"\n" +
+		"	/**\n" +
+		"	 * Gets the signers of this class.\n" +
+		"	 * \n" +
+		"	 * @return the signers of this class, or null if there are no signers. In\n" +
+		"	 *         particular, this method returns null if this object represents a\n" +
+		"	 *         primitive type or void.\n" +
+		"	 * @since JDK1.1\n" +
+		"	 */\n" +
+		"	public native Object[] getSigners();\n" +
+		"}\n"
+	);
+}
+
+/**
+ * @bug 240686: [formatter] Formatter do unexpected things
+ * @test Ensure that open brace are well taken into account just after the HTML tag opening
+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=240686"
+ */
+public void testBug240686() throws JavaModelException {
+	String source =
+		"public class Test {\n" +
+		"\n" +
+		"/** \n" +
+		" * 
{ }
\n" + + " * \n" + + " * \n" + + " * { \"1\",\n" + + " * \"2\"}\n" + + " * \n" + + " *
\n" + + " */\n" + + "void foo() {}\n" + + "}\n"; + // output is different than 3.3 one: is considered as new line tag + // hence the text inside the tag is put on a new line + formatSource(source, + "public class Test {\n" + + "\n" + + " /**\n" + + " *
\n" +
+		"	 * {}\n" +
+		"	 * 
\n" + + " * \n" + + " * \n" + + " * \n" + + " * { \"1\", \"2\"}\n" + + " * \n" + + " *
\n" + + " */\n" + + " void foo() {\n" + + " }\n" + + "}\n" ); } @@ -3424,31 +3424,31 @@ */ public void testBug241345() throws JavaModelException { this.formatterPrefs.comment_format_html = false; - String source = - "/**\n" + - " *

Should not format HTML paragraph

\n" + - " */\n" + - "public interface Test {\n" + - " /**\n" + - " * \n" + - " * These possibilities include:
  • Formatting of header\n" + - " * comments.
  • Formatting of Javadoc tags
\n" + - " */\n" + - " int bar();\n" + - "\n" + - "}\n"; - formatSource(source, - "/**\n" + - " *

Should not format HTML paragraph

\n" + - " */\n" + - "public interface Test {\n" + - " /**\n" + - " * \n" + - " * These possibilities include:
  • Formatting of header\n" + - " * comments.
  • Formatting of Javadoc tags
\n" + - " */\n" + - " int bar();\n" + - "\n" + + String source = + "/**\n" + + " *

Should not format HTML paragraph

\n" + + " */\n" + + "public interface Test {\n" + + " /**\n" + + " * \n" + + " * These possibilities include:
  • Formatting of header\n" + + " * comments.
  • Formatting of Javadoc tags
\n" + + " */\n" + + " int bar();\n" + + "\n" + + "}\n"; + formatSource(source, + "/**\n" + + " *

Should not format HTML paragraph

\n" + + " */\n" + + "public interface Test {\n" + + " /**\n" + + " * \n" + + " * These possibilities include:
  • Formatting of header\n" + + " * comments.
  • Formatting of Javadoc tags
\n" + + " */\n" + + " int bar();\n" + + "\n" + "}\n" ); } @@ -3459,29 +3459,29 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=241687" */ public void testBug241687() throws JavaModelException { - String source = - "public interface Test {\n" + - "\n" + - "/*---------------------\n" + - " * END OF SETS AND GETS\n" + - " * test test test test test test test\n" + - "test test test test test test \n" + - " * \n" + - "*\n" + - " *---------------------*/\n" + - "void foo();\n" + - "}\n"; - formatSource(source, - "public interface Test {\n" + - "\n" + - " /*---------------------\n" + - " * END OF SETS AND GETS\n" + - " * test test test test test test test\n" + - " test test test test test test \n" + - " * \n" + - " *\n" + - " *---------------------*/\n" + - " void foo();\n" + + String source = + "public interface Test {\n" + + "\n" + + "/*---------------------\n" + + " * END OF SETS AND GETS\n" + + " * test test test test test test test\n" + + "test test test test test test \n" + + " * \n" + + "*\n" + + " *---------------------*/\n" + + "void foo();\n" + + "}\n"; + formatSource(source, + "public interface Test {\n" + + "\n" + + " /*---------------------\n" + + " * END OF SETS AND GETS\n" + + " * test test test test test test test\n" + + " test test test test test test \n" + + " * \n" + + " *\n" + + " *---------------------*/\n" + + " void foo();\n" + "}\n" ); } @@ -3492,254 +3492,254 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=256799" */ public void testBug256799_Line01() throws JavaModelException { - String source = - "public class X01 {\n" + - " int foo(int value) {\n" + - " int test = 0;\n" + - " switch (value) {\n" + - " case 1:\n" + - " test = value;\n" + - " //$FALL-THROUGH$\n" + - " case 2:\n" + - " test = value;\n" + - " // $FALL-THROUGH$\n" + - " case 3:\n" + - " test = value;\n" + - " // $FALL-THROUGH$\n" + - " case 4:\n" + - " test = value;\n" + - " // $FALL-THROUGH$ \n" + - " default:\n" + - " test = -1;\n" + - " break;\n" + - " }\n" + - " return test;\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class X01 {\n" + - " int foo(int value) {\n" + - " int test = 0;\n" + - " switch (value) {\n" + - " case 1:\n" + - " test = value;\n" + - " //$FALL-THROUGH$\n" + - " case 2:\n" + - " test = value;\n" + - " // $FALL-THROUGH$\n" + - " case 3:\n" + - " test = value;\n" + - " // $FALL-THROUGH$\n" + - " case 4:\n" + - " test = value;\n" + - " // $FALL-THROUGH$\n" + - " default:\n" + - " test = -1;\n" + - " break;\n" + - " }\n" + - " return test;\n" + - " }\n" + + String source = + "public class X01 {\n" + + " int foo(int value) {\n" + + " int test = 0;\n" + + " switch (value) {\n" + + " case 1:\n" + + " test = value;\n" + + " //$FALL-THROUGH$\n" + + " case 2:\n" + + " test = value;\n" + + " // $FALL-THROUGH$\n" + + " case 3:\n" + + " test = value;\n" + + " // $FALL-THROUGH$\n" + + " case 4:\n" + + " test = value;\n" + + " // $FALL-THROUGH$ \n" + + " default:\n" + + " test = -1;\n" + + " break;\n" + + " }\n" + + " return test;\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class X01 {\n" + + " int foo(int value) {\n" + + " int test = 0;\n" + + " switch (value) {\n" + + " case 1:\n" + + " test = value;\n" + + " //$FALL-THROUGH$\n" + + " case 2:\n" + + " test = value;\n" + + " // $FALL-THROUGH$\n" + + " case 3:\n" + + " test = value;\n" + + " // $FALL-THROUGH$\n" + + " case 4:\n" + + " test = value;\n" + + " // $FALL-THROUGH$\n" + + " default:\n" + + " test = -1;\n" + + " break;\n" + + " }\n" + + " return test;\n" + + " }\n" + "}\n" ); } public void testBug256799_Line02() throws JavaModelException { - String source = - "public class X01 {\n" + - " int foo(int value) {\n" + - " int test = 0;\n" + - " switch (value) {\n" + - " case 1:\n" + - " test = value;\n" + - " //$FALL-THROUGH$ with text after \n" + - " case 2:\n" + - " test = value;\n" + - " // $FALL-THROUGH$ with text after \n" + - " case 3:\n" + - " test = value;\n" + - " // $FALL-THROUGH$ with text after \n" + - " case 4:\n" + - " test = value;\n" + - " // $FALL-THROUGH$ with text after \n" + - " default:\n" + - " test = -1;\n" + - " break;\n" + - " }\n" + - " return test;\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class X01 {\n" + - " int foo(int value) {\n" + - " int test = 0;\n" + - " switch (value) {\n" + - " case 1:\n" + - " test = value;\n" + - " //$FALL-THROUGH$ with text after\n" + - " case 2:\n" + - " test = value;\n" + - " // $FALL-THROUGH$ with text after\n" + - " case 3:\n" + - " test = value;\n" + - " // $FALL-THROUGH$ with text after\n" + - " case 4:\n" + - " test = value;\n" + - " // $FALL-THROUGH$ with text after\n" + - " default:\n" + - " test = -1;\n" + - " break;\n" + - " }\n" + - " return test;\n" + - " }\n" + + String source = + "public class X01 {\n" + + " int foo(int value) {\n" + + " int test = 0;\n" + + " switch (value) {\n" + + " case 1:\n" + + " test = value;\n" + + " //$FALL-THROUGH$ with text after \n" + + " case 2:\n" + + " test = value;\n" + + " // $FALL-THROUGH$ with text after \n" + + " case 3:\n" + + " test = value;\n" + + " // $FALL-THROUGH$ with text after \n" + + " case 4:\n" + + " test = value;\n" + + " // $FALL-THROUGH$ with text after \n" + + " default:\n" + + " test = -1;\n" + + " break;\n" + + " }\n" + + " return test;\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class X01 {\n" + + " int foo(int value) {\n" + + " int test = 0;\n" + + " switch (value) {\n" + + " case 1:\n" + + " test = value;\n" + + " //$FALL-THROUGH$ with text after\n" + + " case 2:\n" + + " test = value;\n" + + " // $FALL-THROUGH$ with text after\n" + + " case 3:\n" + + " test = value;\n" + + " // $FALL-THROUGH$ with text after\n" + + " case 4:\n" + + " test = value;\n" + + " // $FALL-THROUGH$ with text after\n" + + " default:\n" + + " test = -1;\n" + + " break;\n" + + " }\n" + + " return test;\n" + + " }\n" + "}\n" ); } public void testBug256799_Block01() throws JavaModelException { - String source = - "public class X01 {\n" + - " int foo(int value) {\n" + - " int test = 0;\n" + - " switch (value) {\n" + - " case 1:\n" + - " test = value;\n" + - " /*$FALL-THROUGH$*/\n" + - " case 2:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$*/\n" + - " case 3:\n" + - " test = value;\n" + - " /*$FALL-THROUGH$ */\n" + - " case 4:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ */\n" + - " case 5:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$*/\n" + - " case 6:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ */\n" + - " case 7:\n" + - " test = value;\n" + - " /*$FALL-THROUGH$ */\n" + - " case 8:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ */\n" + - " default:\n" + - " test = -1;\n" + - " break;\n" + - " }\n" + - " return test;\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class X01 {\n" + - " int foo(int value) {\n" + - " int test = 0;\n" + - " switch (value) {\n" + - " case 1:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ */\n" + - " case 2:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ */\n" + - " case 3:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ */\n" + - " case 4:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ */\n" + - " case 5:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ */\n" + - " case 6:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ */\n" + - " case 7:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ */\n" + - " case 8:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ */\n" + - " default:\n" + - " test = -1;\n" + - " break;\n" + - " }\n" + - " return test;\n" + - " }\n" + + String source = + "public class X01 {\n" + + " int foo(int value) {\n" + + " int test = 0;\n" + + " switch (value) {\n" + + " case 1:\n" + + " test = value;\n" + + " /*$FALL-THROUGH$*/\n" + + " case 2:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$*/\n" + + " case 3:\n" + + " test = value;\n" + + " /*$FALL-THROUGH$ */\n" + + " case 4:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ */\n" + + " case 5:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$*/\n" + + " case 6:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ */\n" + + " case 7:\n" + + " test = value;\n" + + " /*$FALL-THROUGH$ */\n" + + " case 8:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ */\n" + + " default:\n" + + " test = -1;\n" + + " break;\n" + + " }\n" + + " return test;\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class X01 {\n" + + " int foo(int value) {\n" + + " int test = 0;\n" + + " switch (value) {\n" + + " case 1:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ */\n" + + " case 2:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ */\n" + + " case 3:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ */\n" + + " case 4:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ */\n" + + " case 5:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ */\n" + + " case 6:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ */\n" + + " case 7:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ */\n" + + " case 8:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ */\n" + + " default:\n" + + " test = -1;\n" + + " break;\n" + + " }\n" + + " return test;\n" + + " }\n" + "}\n" ); } public void testBug256799_Block02() throws JavaModelException { - String source = - "public class X01 {\n" + - " int foo(int value) {\n" + - " int test = 0;\n" + - " switch (value) {\n" + - " case 1:\n" + - " test = value;\n" + - " /*$FALL-THROUGH$with text after*/\n" + - " case 2:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$with text after*/\n" + - " case 3:\n" + - " test = value;\n" + - " /*$FALL-THROUGH$ with text after */\n" + - " case 4:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ with text after */\n" + - " case 5:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ with text after*/\n" + - " case 6:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ with text after */\n" + - " case 7:\n" + - " test = value;\n" + - " /*$FALL-THROUGH$ with text after */\n" + - " case 8:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ with text after */\n" + - " default:\n" + - " test = -1;\n" + - " break;\n" + - " }\n" + - " return test;\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class X01 {\n" + - " int foo(int value) {\n" + - " int test = 0;\n" + - " switch (value) {\n" + - " case 1:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$with text after */\n" + - " case 2:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$with text after */\n" + - " case 3:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ with text after */\n" + - " case 4:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ with text after */\n" + - " case 5:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ with text after */\n" + - " case 6:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ with text after */\n" + - " case 7:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ with text after */\n" + - " case 8:\n" + - " test = value;\n" + - " /* $FALL-THROUGH$ with text after */\n" + - " default:\n" + - " test = -1;\n" + - " break;\n" + - " }\n" + - " return test;\n" + - " }\n" + + String source = + "public class X01 {\n" + + " int foo(int value) {\n" + + " int test = 0;\n" + + " switch (value) {\n" + + " case 1:\n" + + " test = value;\n" + + " /*$FALL-THROUGH$with text after*/\n" + + " case 2:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$with text after*/\n" + + " case 3:\n" + + " test = value;\n" + + " /*$FALL-THROUGH$ with text after */\n" + + " case 4:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ with text after */\n" + + " case 5:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ with text after*/\n" + + " case 6:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ with text after */\n" + + " case 7:\n" + + " test = value;\n" + + " /*$FALL-THROUGH$ with text after */\n" + + " case 8:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ with text after */\n" + + " default:\n" + + " test = -1;\n" + + " break;\n" + + " }\n" + + " return test;\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class X01 {\n" + + " int foo(int value) {\n" + + " int test = 0;\n" + + " switch (value) {\n" + + " case 1:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$with text after */\n" + + " case 2:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$with text after */\n" + + " case 3:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ with text after */\n" + + " case 4:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ with text after */\n" + + " case 5:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ with text after */\n" + + " case 6:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ with text after */\n" + + " case 7:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ with text after */\n" + + " case 8:\n" + + " test = value;\n" + + " /* $FALL-THROUGH$ with text after */\n" + + " default:\n" + + " test = -1;\n" + + " break;\n" + + " }\n" + + " return test;\n" + + " }\n" + "}\n" ); } @@ -3754,32 +3754,32 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.comment_format_line_comment = false; this.formatterPrefs.comment_format_header = true; - String source = - "/**\n" + - " * Test for\n" + - " * bug 254998\n" + - " */\n" + - "package javadoc;\n" + - "\n" + - "/**\n" + - " * Test for\n" + - " * bug 254998\n" + - " */\n" + - "public class Test {\n" + - "\n" + - "}\n"; - formatSource(source, - "/**\n" + - " * Test for bug 254998\n" + - " */\n" + - "package javadoc;\n" + - "\n" + - "/**\n" + - " * Test for\n" + - " * bug 254998\n" + - " */\n" + - "public class Test {\n" + - "\n" + + String source = + "/**\n" + + " * Test for\n" + + " * bug 254998\n" + + " */\n" + + "package javadoc;\n" + + "\n" + + "/**\n" + + " * Test for\n" + + " * bug 254998\n" + + " */\n" + + "public class Test {\n" + + "\n" + + "}\n"; + formatSource(source, + "/**\n" + + " * Test for bug 254998\n" + + " */\n" + + "package javadoc;\n" + + "\n" + + "/**\n" + + " * Test for\n" + + " * bug 254998\n" + + " */\n" + + "public class Test {\n" + + "\n" + "}\n" ); } @@ -3788,37 +3788,37 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.comment_format_line_comment = false; this.formatterPrefs.comment_format_header = true; - String source = - "/*\n" + - " * Test for\n" + - " * bug 254998\n" + - " */\n" + - "package block;\n" + - "\n" + - "/*\n" + - " * Test for\n" + - " * bug 254998\n" + - " */\n" + - "public class Test {\n" + - "/*\n" + - " * Test for\n" + - " * bug 254998\n" + - " */\n" + - "}\n"; - formatSource(source, - "/*\n" + - " * Test for bug 254998\n" + - " */\n" + - "package block;\n" + - "\n" + - "/*\n" + - " * Test for bug 254998\n" + - " */\n" + - "public class Test {\n" + - " /*\n" + - " * Test for\n" + - " * bug 254998\n" + - " */\n" + + String source = + "/*\n" + + " * Test for\n" + + " * bug 254998\n" + + " */\n" + + "package block;\n" + + "\n" + + "/*\n" + + " * Test for\n" + + " * bug 254998\n" + + " */\n" + + "public class Test {\n" + + "/*\n" + + " * Test for\n" + + " * bug 254998\n" + + " */\n" + + "}\n"; + formatSource(source, + "/*\n" + + " * Test for bug 254998\n" + + " */\n" + + "package block;\n" + + "\n" + + "/*\n" + + " * Test for bug 254998\n" + + " */\n" + + "public class Test {\n" + + " /*\n" + + " * Test for\n" + + " * bug 254998\n" + + " */\n" + "}\n" ); } @@ -3827,21 +3827,21 @@ this.formatterPrefs.comment_format_block_comment = false; this.formatterPrefs.comment_format_line_comment = false; this.formatterPrefs.comment_format_header = true; - String source = - "// Test for bug 254998\n" + - "package line;\n" + - "\n" + - "// Test for bug 254998\n" + - "public class Test {\n" + - "// Test for bug 254998\n" + + String source = + "// Test for bug 254998\n" + + "package line;\n" + + "\n" + + "// Test for bug 254998\n" + + "public class Test {\n" + + "// Test for bug 254998\n" + "}\n"; formatSource(source, - "// Test for bug 254998\n" + - "package line;\n" + - "\n" + - "// Test for bug 254998\n" + - "public class Test {\n" + - " // Test for bug 254998\n" + + "// Test for bug 254998\n" + + "package line;\n" + + "\n" + + "// Test for bug 254998\n" + + "public class Test {\n" + + " // Test for bug 254998\n" + "}\n" ); } @@ -3852,346 +3852,345 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=260011" */ public void testBug260011() throws JavaModelException { - String source = - "public class Test {\n" + - " /**\n" + - " * some comment text here\n" + - " *

\n" + - " * some text to be styled a certain way\n" + - " *

\n" + - " */\n" + - " void foo() {}\n" + - "\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - " /**\n" + - " * some comment text here\n" + - " *

\n" + - " * some text to be styled a certain way\n" + - " *

\n" + - " */\n" + - " void foo() {\n" + - " }\n" + - "\n" + + String source = + "public class Test {\n" + + " /**\n" + + " * some comment text here\n" + + " *

\n" + + " * some text to be styled a certain way\n" + + " *

\n" + + " */\n" + + " void foo() {}\n" + + "\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + " /**\n" + + " * some comment text here\n" + + " *

\n" + + " * some text to be styled a certain way\n" + + " *

\n" + + " */\n" + + " void foo() {\n" + + " }\n" + + "\n" + "}\n" ); } public void testBug260011_01() throws JavaModelException { - String source = - "public class Test {\n" + - " /**\n" + - " * some comment text here\n" + - " *
  • \n" + - " * some text to be styled a certain way
\n" + - " * end of comment\n" + - " */\n" + - " void foo() {}\n" + - "\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - " /**\n" + - " * some comment text here\n" + - " *
    \n" + - " *
  • \n" + - " * some text to be styled a certain way
  • \n" + - " *
\n" + - " * end of comment\n" + - " */\n" + - " void foo() {\n" + - " }\n" + - "\n" + + String source = + "public class Test {\n" + + " /**\n" + + " * some comment text here\n" + + " *
  • \n" + + " * some text to be styled a certain way
\n" + + " * end of comment\n" + + " */\n" + + " void foo() {}\n" + + "\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + " /**\n" + + " * some comment text here\n" + + " *
    \n" + + " *
  • \n" + + " * some text to be styled a certain way
  • \n" + + " *
\n" + + " * end of comment\n" + + " */\n" + + " void foo() {\n" + + " }\n" + + "\n" + "}\n" ); } public void testBug260011_02() throws JavaModelException { - String source = - "public class Test {\n" + - " /**\n" + - " * some comment text here\n" + - " *
\n" + 
-		"     *      some text\n" + 
-		"     *           to be styled\n" + 
-		"     *                 a certain way\n" + 
-		"     *      \n" + 
-		"     * 
\n" + - " * end of comment\n" + - " */\n" + - " void foo() {}\n" + - "\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - " /**\n" + - " * some comment text here\n" + - " * \n" + - " *
\n" + 
-		"	 *      some text\n" + 
-		"	 *           to be styled\n" + 
-		"	 *                 a certain way\n" + 
-		"	 * \n" + 
-		"	 * 
\n" + - " * \n" + - " * end of comment\n" + - " */\n" + - " void foo() {\n" + - " }\n" + - "\n" + + String source = + "public class Test {\n" + + " /**\n" + + " * some comment text here\n" + + " *
\n" +
+		"     *      some text\n" +
+		"     *           to be styled\n" +
+		"     *                 a certain way\n" +
+		"     *      \n" +
+		"     * 
\n" + + " * end of comment\n" + + " */\n" + + " void foo() {}\n" + + "\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + " /**\n" + + " * some comment text here\n" + + " * \n" + + " *
\n" +
+		"	 *      some text\n" +
+		"	 *           to be styled\n" +
+		"	 *                 a certain way\n" +
+		"	 * \n" +
+		"	 * 
\n" + + " * \n" + + " * end of comment\n" + + " */\n" + + " void foo() {\n" + + " }\n" + + "\n" + "}\n" ); } public void testBug260011_03() throws JavaModelException { - String source = - "public class Test {\n" + - "\n" + - " /**\n" + - " * Indent char is a space char but not a line delimiters.\n" + - " * == Character.isWhitespace(ch) && ch != \'\\n\' && ch != \'\\r\'\n" + - " */\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " /**\n" + - " * Indent char is a space char but not a line delimiters.\n" + - " * == Character.isWhitespace(ch) && ch != \'\\n\' && ch != \'\\r\'\n" + - " */\n" + - " public void foo() {\n" + - " }\n" + + String source = + "public class Test {\n" + + "\n" + + " /**\n" + + " * Indent char is a space char but not a line delimiters.\n" + + " * == Character.isWhitespace(ch) && ch != \'\\n\' && ch != \'\\r\'\n" + + " */\n" + + " public void foo() {\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " /**\n" + + " * Indent char is a space char but not a line delimiters.\n" + + " * == Character.isWhitespace(ch) && ch != \'\\n\' && ch != \'\\r\'\n" + + " */\n" + + " public void foo() {\n" + + " }\n" + "}\n" ); } public void testBug260011_04() throws JavaModelException { - String source = - "public class Test {\n" + - "\n" + - " /**\n" + - " * The list of variable declaration fragments (element type: \n" + - " * ). Defaults to an empty list.\n" + - " */\n" + - " int field;\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " /**\n" + - " * The list of variable declaration fragments (element type:\n" + - " * ). Defaults to an empty list.\n" + - " */\n" + - " int field;\n" + + String source = + "public class Test {\n" + + "\n" + + " /**\n" + + " * The list of variable declaration fragments (element type: \n" + + " * ). Defaults to an empty list.\n" + + " */\n" + + " int field;\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " /**\n" + + " * The list of variable declaration fragments (element type:\n" + + " * ). Defaults to an empty list.\n" + + " */\n" + + " int field;\n" + "}\n" ); } public void testBug260011_05() throws JavaModelException { - String source = - "public class Test {\n" + - "\n" + - " /**\n" + - " * Compares version strings.\n" + - " * \n" + - " * @return result of comparison, as integer;\n" + - " * <0 if left is less than right \n" + - " * 0 if left is equals to right\n" + - " * >0 if left is greater than right\n" + - " */\n" + - " int foo() {\n" + - " return 0;\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " /**\n" + - " * Compares version strings.\n" + - " * \n" + - " * @return result of comparison, as integer;\n" + - " * <0 if left is less than right \n" + - " * 0 if left is equals to right\n" + - " * >0 if left is greater than right\n" + - " */\n" + - " int foo() {\n" + - " return 0;\n" + - " }\n" + + String source = + "public class Test {\n" + + "\n" + + " /**\n" + + " * Compares version strings.\n" + + " * \n" + + " * @return result of comparison, as integer;\n" + + " * <0 if left is less than right \n" + + " * 0 if left is equals to right\n" + + " * >0 if left is greater than right\n" + + " */\n" + + " int foo() {\n" + + " return 0;\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " /**\n" + + " * Compares version strings.\n" + + " * \n" + + " * @return result of comparison, as integer;\n" + + " * <0 if left is less than right \n" + + " * 0 if left is equals to right\n" + + " * >0 if left is greater than right\n" + + " */\n" + + " int foo() {\n" + + " return 0;\n" + + " }\n" + "}\n" ); } public void testBug260011_06() throws JavaModelException { - String source = - "public interface Test {\n" + - "\n" + - " /**\n" + - " * Returns the length of this array.\n" + - " * \n" + - " * @return the length of this array\n" + - " * @exception DebugException if this method fails. Reasons include:
    \n" + - " *
  • Failure communicating with the VM. The DebugException\'s\n" + - " * status code contains the underlying exception responsible for\n" + - " * the failure.
  • \n" + - " * \n" + - " *
  • Failure communicating with the VM. The\n" + - " * DebugException\'s status code contains the underlying\n" + - " * exception responsible for the failure.
  • \n" + - " * \n" + + " *
  • Failure communicating with the VM. The DebugException\'s\n" + + " * status code contains the underlying exception responsible for\n" + + " * the failure.
  • \n" + + " * \n" + + " *
  • Failure communicating with the VM. The\n" + + " * DebugException\'s status code contains the underlying\n" + + " * exception responsible for the failure.
  • \n" + + " * if the element isn\'t associated with a change.\n" + - " * \n" + - " * @return the change or null\n" + - " */\n" + - " public String getChange();\n" + - "}\n"; - formatSource(source, - "public interface Test {\n" + - "\n" + - " /**\n" + - " * Returns the change directly associated with this change element or \n" + - " * if the element isn\'t associated with a change.\n" + - " * \n" + - " * @return the change or null\n" + - " */\n" + - " public String getChange();\n" + + String source = + "public interface Test {\n" + + "\n" + + " \n" + + " /**\n" + + " * Returns the change directly associated with this change element or if the element isn\'t associated with a change.\n" + + " * \n" + + " * @return the change or null\n" + + " */\n" + + " public String getChange();\n" + + "}\n"; + formatSource(source, + "public interface Test {\n" + + "\n" + + " /**\n" + + " * Returns the change directly associated with this change element or if the element isn\'t associated with a change.\n" + + " * \n" + + " * @return the change or null\n" + + " */\n" + + " public String getChange();\n" + "}\n" ); } public void testBug260011_08() throws JavaModelException { - String source = - "public interface Test {\n" + - "\n" + - " /**\n" + - " * Answer the element factory for an id, or nullnullnullnull\n" + - " */\n" + - " void foo();\n" + - "}\n"; - formatSource(source, - "public interface Test {\n" + - "\n" + - " /**\n" + - " * Creates and opens a dialog to edit the given template.\n" + - " * \n" + - " */\n" + - " void foo();\n" + + String source = + "public interface Test {\n" + + "\n" + + " /**\n" + + " * Creates and opens a dialog to edit the given template.\n" + + " * \n" + + " */\n" + + " void foo();\n" + + "}\n"; + formatSource(source, + "public interface Test {\n" + + "\n" + + " /**\n" + + " * Creates and opens a dialog to edit the given template.\n" + + " * \n" + + " */\n" + + " void foo();\n" + "}\n" ); } public void testBug260011_11() throws JavaModelException { - String source = - "public class Test {\n" + - "\n" + - " /** \n" + - " *

    Binary property IDS_Trinary_Operator (new).

    \n" + - " * \n" + - " * @stable ICU 2.6\n" + - " */ \n" + - " public static final int IDS_TRINARY_OPERATOR = 19; \n" + - "}\n"; - formatSource(source, - "public class Test {\n" + - "\n" + - " /**\n" + - " *

    \n" + - " * Binary property IDS_Trinary_Operator (new).\n" + - " *

    \n" + - " * \n" + - " * \n" + - " * @stable ICU 2.6\n" + - " */\n" + - " public static final int IDS_TRINARY_OPERATOR = 19;\n" + + String source = + "public class Test {\n" + + "\n" + + " /** \n" + + " *

    Binary property IDS_Trinary_Operator (new).

    \n" + + " * \n" + + " * @stable ICU 2.6\n" + + " */ \n" + + " public static final int IDS_TRINARY_OPERATOR = 19; \n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + "\n" + + " /**\n" + + " *

    \n" + + " * Binary property IDS_Trinary_Operator (new).\n" + + " *

    \n" + + " * \n" + + " * \n" + + " * @stable ICU 2.6\n" + + " */\n" + + " public static final int IDS_TRINARY_OPERATOR = 19;\n" + "}\n" ); } @@ -4202,197 +4201,886 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=260274" */ public void testBug260274() throws JavaModelException { - String source = - "class X {\n" + - "/*\n" + - " * The formatter should NOT remove * character\n" + - " * in block comments!\n" + - " */\n" + + String source = + "class X {\n" + + "/*\n" + + " * The formatter should NOT remove * character\n" + + " * in block comments!\n" + + " */\n" + "}\n"; formatSource(source, - "class X {\n" + - " /*\n" + - " * The formatter should NOT remove * character in block comments!\n" + - " */\n" + + "class X {\n" + + " /*\n" + + " * The formatter should NOT remove * character in block comments!\n" + + " */\n" + "}\n" ); } public void testBug260274b() throws JavaModelException { - String source = - "class X {\n" + - "/*\n" + - " * The formatter should keep \'*\' characters\n" + - " * in block comments!\n" + - " */\n" + + String source = + "class X {\n" + + "/*\n" + + " * The formatter should keep \'*\' characters\n" + + " * in block comments!\n" + + " */\n" + "}\n"; formatSource(source, - "class X {\n" + - " /*\n" + - " * The formatter should keep \'*\' characters in block comments!\n" + - " */\n" + + "class X {\n" + + " /*\n" + + " * The formatter should keep \'*\' characters in block comments!\n" + + " */\n" + "}\n" ); } public void testBug260274c() throws JavaModelException { this.formatterPrefs.join_lines_in_comments = false; - String source = - "class X {\n" + - "/* *********************************************\n" + - " * Test \n" + - " */\n" + + String source = + "class X {\n" + + "/* *********************************************\n" + + " * Test \n" + + " */\n" + + "}\n"; + formatSource(source, + "class X {\n" + + " /* *********************************************\n" + + " * Test\n" + + " */\n" + + "}\n" + ); +} +public void testBug260274d() throws JavaModelException { + String source = + "class X {\n" + + "/* *********************************************\n" + + " * Test \n" + + " */\n" + + "}\n"; + formatSource(source, + "class X {\n" + + " /* *********************************************\n" + + " * Test\n" + + " */\n" + + "}\n" + ); +} +public void testBug260274e() throws JavaModelException { + String source = + "class X {\n" + + "/*\n" + + " * **************************************************\n" + + " * ********** Test ********** Test **************\n" + + " * **************************************************\n" + + " */\n" + + "}\n"; + formatSource(source, + "class X {\n" + + " /*\n" + + " * **************************************************\n" + + " * ********** Test ********** Test **************\n" + + " * **************************************************\n" + + " */\n" + + "}\n" + ); +} +public void testBug260274f() throws JavaModelException { + String source = + "class X {\n" + + "/* *****************************************************************************\n" + + " * Action that allows changing the model providers sort order.\n" + + " */\n" + + "void foo() {\n" + + "}\n" + + "}\n"; + formatSource(source, + "class X {\n" + + " /* *****************************************************************************\n" + + " * Action that allows changing the model providers sort order.\n" + + " */\n" + + " void foo() {\n" + + " }\n" + + "}\n" + ); +} +public void testBug260274g() throws JavaModelException { + String source = + "class X {\n" + + "/*\n" + + " * **********************************************************************************\n" + + " * **********************************************************************************\n" + + " * **********************************************************************************\n" + + " * The code below was added to track the view with focus\n" + + " * in order to support save actions from a view. Remove this\n" + + " * experimental code if the decision is to not allow views to \n" + + " * participate in save actions (see bug 10234) \n" + + " */\n" + + "}\n"; + formatSource(source, + "class X {\n" + + " /*\n" + + " * **********************************************************************************\n" + + " * **********************************************************************************\n" + + " * **********************************************************************************\n" + + " * The code below was added to track the view with focus in order to support\n" + + " * save actions from a view. Remove this experimental code if the decision\n" + + " * is to not allow views to participate in save actions (see bug 10234)\n" + + " */\n" + + "}\n" + ); +} +public void testBug260274h() throws JavaModelException { + String source = + "class X {\n" + + " /**\n" + + " * @see #spacing(Point)\n" + + " * * @see #spacing(int, int)\n" + + " */\n" + + " public void foo() {\n" + + " }\n" + + "}\n"; + formatSource(source, + "class X {\n" + + " /**\n" + + " * @see #spacing(Point) * @see #spacing(int, int)\n" + + " */\n" + + " public void foo() {\n" + + " }\n" + + "}\n" + ); +} + +/** + * @bug 260276: [formatter] Inconsistent formatting of one-line block comment + * @test Ensure that the comment formatter has a consistent behavior while formatting one-line block comment + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=260276" + */ +public void testBug260276() throws JavaModelException { + String source = + "class X {\n" + + "/* a\n" + + "comment */\n" + + "}\n"; + formatSource(source, + "class X {\n" + + " /*\n" + + " * a comment\n" + + " */\n" + + "}\n" + ); +} +public void testBug260276b() throws JavaModelException { + String source = + "class X {\n" + + "/* a\n" + + " comment */\n" + + "}\n"; + formatSource(source, + "class X {\n" + + " /*\n" + + " * a comment\n" + + " */\n" + + "}\n" + ); +} +public void testBug260276c() throws JavaModelException { + String source = + "class X {\n" + + "/* a\n" + + " * comment */\n" + + "}\n"; + formatSource(source, + "class X {\n" + + " /*\n" + + " * a comment\n" + + " */\n" + + "}\n" + ); +} + +/** + * @bug 260381: [formatter] Javadoc formatter breaks {@code ...} tags. + * @test Ensure that the @code tag is similar to HTML tag + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=260381" + */ +public void testBug260381() throws JavaModelException { + String source = + "/**\n" + + " * Comments that can be formated in several lines...\n" + + " * \n" + + " * @author Myself\n" + + " * @version {@code $Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $}\n" + + " */\n" + + "public class X01 {\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.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $\n" + + " */\n" + + "public class X01b {\n" + + "}\n"; + formatSource(source); +} +public void testBug260381c() throws JavaModelException { + String source = + "/**\n" + + " * Comments that can be formated in several lines...\n" + + " * \n" + + " * @author Myself\n" + + " * @version\n" + + " * 3.0 xxxxxxxxxxxxxx xwxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n" + + " */\n" + + "public class X01c {\n" + + "}\n"; + formatSource(source, + "/**\n" + + " * Comments that can be formated in several lines...\n" + + " * \n" + + " * @author Myself\n" + + " * @version 3.0 xxxxxxxxxxxxxx xwxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n" + + " */\n" + + "public class X01c {\n" + + "}\n" + ); +} +public void testBug260381d() throws JavaModelException { + String source = + "/**\n" + + " * Comments that can be formated in several lines...\n" + + " * \n" + + " * @author Myself\n" + + " * @see Object $Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $\n" + + " */\n" + + "public class X02 {\n" + + "}\n"; + formatSource(source, + "/**\n" + + " * Comments that can be formated in several lines...\n" + + " * \n" + + " * @author Myself\n" + + " * @see Object\n" + + " * $Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $\n" + + " */\n" + + "public class X02 {\n" + + "}\n" + ); +} +public void testBug260381e() throws JavaModelException { + String source = + "/**\n" + + " * Comments that can be formated in several lines...\n" + + " * \n" + + " * {@code $Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $\n" + + " * $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $}\n" + + " */\n" + + "public class X03 {\n" + + "}\n"; + formatSource(source); +} +public void testBug260381f() throws JavaModelException { + String source = + "/**\n" + + " * Literal inline tag should also be untouched by the formatter\n" + + " * \n" + + " * @version {@literal $Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $}\n" + + " */\n" + + "public class X04 {\n" + + "\n" + + "}\n"; + formatSource(source); +} +public void testBug260381_wksp1_01() throws JavaModelException { + String source = + "package wksp1;\n" + + "\n" + + "public interface I01 {\n" + + "\n" + + " /**\n" + + " * Returns all configured content types for the given source viewer. This list\n" + + " * tells the caller which content types must be configured for the given source \n" + + " * viewer, i.e. for which content types the given source viewer\'s functionalities\n" + + " * must be specified. This implementation always returns \n" + + " * new String[] { IDocument.DEFAULT_CONTENT_TYPE }.\n" + + " *\n" + + " * @param source the source viewer to be configured by this configuration\n" + + " * @return the configured content types for the given viewer\n" + + " */\n" + + " public String[] getConfiguredContentTypes(String source);\n" + + "}\n"; + formatSource(source, + "package wksp1;\n" + + "\n" + + "public interface I01 {\n" + + "\n" + + " /**\n" + + " * Returns all configured content types for the given source viewer. This\n" + + " * list tells the caller which content types must be configured for the\n" + + " * given source viewer, i.e. for which content types the given source\n" + + " * viewer\'s functionalities must be specified. This implementation always\n" + + " * returns \n" + + " * new String[] { IDocument.DEFAULT_CONTENT_TYPE }.\n" + + " * \n" + + " * @param source\n" + + " * the source viewer to be configured by this configuration\n" + + " * @return the configured content types for the given viewer\n" + + " */\n" + + " public String[] getConfiguredContentTypes(String source);\n" + + "}\n" + ); +} +public void testBug260381_wksp2_01() throws JavaModelException { + String source = + "package wksp2;\n" + + "public interface I01 {\n" + + " /**\n" + + " * Returns the composition of two functions. For {@code f: A->B} and\n" + + " * {@code g: B->C}, composition is defined as the function h such that\n" + + " * {@code h(a) == g(f(a))} for each {@code a}.\n" + + " *\n" + + " * @see \n" + + " * function composition\n" + + " *\n" + + " * @param g the second function to apply\n" + + " * @param f the first function to apply\n" + + " * @return the composition of {@code f} and {@code g}\n" + + " */\n" + + " void foo();\n" + + "}\n"; + formatSource(source, + "package wksp2;\n" + + "\n" + + "public interface I01 {\n" + + " /**\n" + + " * Returns the composition of two functions. For {@code f: A->B} and\n" + + " * {@code g: B->C}, composition is defined as the function h such that\n" + + " * {@code h(a) == g(f(a))} for each {@code a}.\n" + + " * \n" + + " * @see function\n" + + " * composition\n" + + " * \n" + + " * @param g\n" + + " * the second function to apply\n" + + " * @param f\n" + + " * the first function to apply\n" + + " * @return the composition of {@code f} and {@code g}\n" + + " */\n" + + " void foo();\n" + + "}\n" + ); +} +public void testBug260381_wksp2_01b() throws JavaModelException { + String source = + "package wksp2;\n" + + "public interface I01b {\n" + + " /**\n" + + " * Returns the composition of two functions. For f: A->B and\n" + + " * g: B->C, composition is defined as the function h such that\n" + + " * h(a) == g(f(a)) for each a.\n" + + " *\n" + + " * @see \n" + + " * function composition\n" + + " *\n" + + " * @param g the second function to apply\n" + + " * @param f the first function to apply\n" + + " * @return the composition of f and g\n" + + " */\n" + + " void foo();\n" + + "}\n"; + formatSource(source, + "package wksp2;\n" + + "\n" + + "public interface I01b {\n" + + " /**\n" + + " * Returns the composition of two functions. For f: A->B and\n" + + " * g: B->C, composition is defined as the function h such that\n" + + " * h(a) == g(f(a)) for each a.\n" + + " * \n" + + " * @see function\n" + + " * composition\n" + + " * \n" + + " * @param g\n" + + " * the second function to apply\n" + + " * @param f\n" + + " * the first function to apply\n" + + " * @return the composition of f and g\n" + + " */\n" + + " void foo();\n" + + "}\n" + ); +} +public void testBug260381_wksp2_01c() throws JavaModelException { + String source = + "package wksp2;\n" + + "public interface I01c {\n" + + " /**\n" + + " * Returns the composition of two functions. For f: A->B and\n" + + " * \n" + + " * g: B->C\n" + + " * ,\n" + + " * composition is defined as the function h such that\n" + + " * \n" + + " * h(a) == g(f(a))\n" + + " * \n" + + " * for each\n" + + " * \n" + + " * a\n" + + " * .\n" + + " *\n" + + " * @see \n" + + " * function composition\n" + + " *\n" + + " * @param g the second function to apply\n" + + " * @param f the first function to apply\n" + + " * @return the composition of f and g\n" + + " */\n" + + " void foo();\n" + + "}\n"; + formatSource(source, + "package wksp2;\n" + + "\n" + + "public interface I01c {\n" + + " /**\n" + + " * Returns the composition of two functions. For f: A->B and\n" + + " * \n" + + " * g: B->C\n" + + " * , composition is defined as the function h such that \n" + + " * h(a) == g(f(a))\n" + + " * for each \n" + + " * a\n" + + " * .\n" + + " * \n" + + " * @see function\n" + + " * composition\n" + + " * \n" + + " * @param g\n" + + " * the second function to apply\n" + + " * @param f\n" + + " * the first function to apply\n" + + " * @return the composition of f and g\n" + + " */\n" + + " void foo();\n" + + "}\n" + ); +} +public void testBug260381_wksp2_02() throws JavaModelException { + String source = + "package wksp2;\n" + + "\n" + + "public interface I02 {\n" + + "\n" + + " /**\n" + + " * Implementations of {@code computeNext} must invoke this method when\n" + + " * there are no elements left in the iteration.\n" + + " *\n" + + " * @return {@code null}; a convenience so your {@link #computeNext}\n" + + " * implementation can use the simple statement {@code return endOfData();}\n" + + " */\n" + + " void foo();\n" + "}\n"; formatSource(source, - "class X {\n" + - " /* *********************************************\n" + - " * Test\n" + - " */\n" + + "package wksp2;\n" + + "\n" + + "public interface I02 {\n" + + "\n" + + " /**\n" + + " * Implementations of {@code computeNext} must invoke this method\n" + + " * when there are no elements left in the iteration.\n" + + " * \n" + + " * @return {@code null}; a convenience so your {@link #computeNext}\n" + + " * implementation can use the simple statement\n" + + " * {@code return endOfData();}\n" + + " */\n" + + " void foo();\n" + "}\n" ); } -public void testBug260274d() throws JavaModelException { - String source = - "class X {\n" + - "/* *********************************************\n" + - " * Test \n" + - " */\n" + +public void testBug260381_wksp2_03() throws JavaModelException { + String source = + "package wksp2;\n" + + "\n" + + "public interface I03 {\n" + + " /**\n" + + " * A builder for creating immutable bimap instances, especially {@code public\n" + + " * static final} bimaps (\"constant bimaps\"). Example:
       {@code\n" +
    +		"   *\n" +
    +		"   *   static final ImmutableBiMap WORD_TO_INT =\n" +
    +		"   *       new ImmutableBiMap.Builder()\n" +
    +		"   *           .put(\"one\", 1)\n" +
    +		"   *           .put(\"two\", 2)\n" +
    +		"   *           .put(\"three\", 3)\n" +
    +		"   *           .build();}
    \n" + + " *\n" + + " * For small immutable bimaps, the {@code ImmutableBiMap.of()} methods\n" + + " * are even more convenient.\n" + + " *\n" + + " *

    Builder instances can be reused - it is safe to call {@link #build}\n" + + " * multiple times to build multiple bimaps in series. Each bimap is a superset\n" + + " * of the bimaps created before it.\n" + + " */\n" + + " void foo();\n" + "}\n"; formatSource(source, - "class X {\n" + - " /* *********************************************\n" + - " * Test\n" + - " */\n" + + "package wksp2;\n" + + "\n" + + "public interface I03 {\n" + + " /**\n" + + " * A builder for creating immutable bimap instances, especially\n" + + " * {@code public static final} bimaps (\"constant bimaps\"). Example:\n" + + " * \n" + + " *

    \n" +
    +		"	 * {\n" +
    +		"	 * 	@code\n" +
    +		"	 * 	static final ImmutableBiMap<String, Integer> WORD_TO_INT = new ImmutableBiMap.Builder<String, Integer>()\n" +
    +		"	 * 			.put("one", 1).put("two", 2).put("three", 3).build();\n" +
    +		"	 * }\n" +
    +		"	 * 
    \n" + + " * \n" + + " * For small immutable bimaps, the {@code ImmutableBiMap.of()}\n" + + " * methods are even more convenient.\n" + + " * \n" + + " *

    \n" + + " * Builder instances can be reused - it is safe to call {@link #build}\n" + + " * multiple times to build multiple bimaps in series. Each bimap is a\n" + + " * superset of the bimaps created before it.\n" + + " */\n" + + " void foo();\n" + "}\n" ); } -public void testBug260274e() throws JavaModelException { - String source = - "class X {\n" + - "/*\n" + - " * **************************************************\n" + - " * ********** Test ********** Test **************\n" + - " * **************************************************\n" + - " */\n" + +public void testBug260381_wksp2_04() throws JavaModelException { + String source = + "package wksp2;\n" + + "\n" + + "public interface I04 {\n" + + "\n" + + " /**\n" + + " * Returns an immutable multiset containing the given elements.\n" + + " * \n" + + " *

    The multiset is ordered by the first occurrence of each element. For\n" + + " * example, {@code ImmutableMultiset.copyOf(Arrays.asList(2, 3, 1, 3))} yields\n" + + " * a multiset with elements in the order {@code 2, 3, 3, 1}.\n" + + " *\n" + + " *

    Note that if {@code c} is a {@code Collection}, then {@code\n" + + " * 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" + + " *\n" + + " *

    Note: Despite what the method name suggests, if {@code elements}\n" + + " * is an {@code ImmutableMultiset}, no copy will actually be performed, and\n" + + " * the given multiset itself will be returned.\n" + + " *\n" + + " * @throws NullPointerException if any of {@code elements} is null\n" + + " */\n" + + " void foo();\n" + "}\n"; formatSource(source, - "class X {\n" + - " /*\n" + - " * **************************************************\n" + - " * ********** Test ********** Test **************\n" + - " * **************************************************\n" + - " */\n" + + "package wksp2;\n" + + "\n" + + "public interface I04 {\n" + + "\n" + + " /**\n" + + " * Returns an immutable multiset containing the given elements.\n" + + " * \n" + + " *

    \n" + + " * The multiset is ordered by the first occurrence of each element. For\n" + + " * example, {@code ImmutableMultiset.copyOf(Arrays.asList(2, 3, 1, 3))}\n" + + " * yields a multiset with elements in the order {@code 2, 3, 3, 1}.\n" + + " * \n" + + " *

    \n" + + " * Note that if {@code c} is a {@code Collection}, then\n" + + " * {@code ImmutableMultiset.copyOf(c)} returns an\n" + + " * {@code ImmutableMultiset} containing each of the strings in\n" + + " * {@code c}, while {@code ImmutableMultiset.of(c)} returns an\n" + + " * {@code ImmutableMultiset>} containing one element (the\n" + + " * given collection itself).\n" + + " * \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" + + " * the given multiset itself will be returned.\n" + + " * \n" + + " * @throws NullPointerException\n" + + " * if any of {@code elements} is null\n" + + " */\n" + + " void foo();\n" + "}\n" ); } -public void testBug260274f() throws JavaModelException { - String source = - "class X {\n" + - "/* *****************************************************************************\n" + - " * Action that allows changing the model providers sort order.\n" + - " */\n" + - "void foo() {\n" + - "}\n" + +public void testBug260381_wksp2_05() throws JavaModelException { + String source = + "package wksp2;\n" + + "\n" + + "public interface I05 {\n" + + "\n" + + " /**\n" + + " * Indexes the specified values into a {@code Multimap} by applying a\n" + + " * specified function to each item in an {@code Iterable} of values. Each\n" + + " * value will be stored as a value in the specified multimap. The key used to\n" + + " * store that value in the multimap will be the result of calling the function\n" + + " * on that value. Depending on the multimap implementation, duplicate entries\n" + + " * (equal keys and equal values) may be collapsed.\n" + + " *\n" + + " *

    For example,\n" + + " *\n" + + " *

    \n" +
    +		"   * List<String> badGuys =\n" +
    +		"   *   Arrays.asList(\"Inky\", \"Blinky\", \"Pinky\", \"Pinky\", \"Clyde\");\n" +
    +		"   * Function<String, Integer> stringLengthFunction = ...;\n" +
    +		"   * Multimap<Integer, String> index = Multimaps.newHashMultimap();\n" +
    +		"   * Multimaps.index(badGuys, stringLengthFunction, index);\n" +
    +		"   * System.out.println(index); 
    \n" + + " *\n" + + " * prints\n" + + " *\n" + + " *
    \n" +
    +		"   * {4=[Inky], 5=[Pinky, Clyde], 6=[Blinky]} 
    \n" + + " *\n" + + " * The {@link HashMultimap} collapses the duplicate occurrence of\n" + + " * {@code (5, \"Pinky\")}.\n" + + " *\n" + + " * @param values the values to add to the multimap\n" + + " * @param keyFunction the function used to produce the key for each value\n" + + " * @param multimap the multimap to store the key value pairs\n" + + " */\n" + + " void foo();\n" + "}\n"; formatSource(source, - "class X {\n" + - " /* *****************************************************************************\n" + - " * Action that allows changing the model providers sort order.\n" + - " */\n" + - " void foo() {\n" + - " }\n" + - "}\n" - ); -} -public void testBug260274g() throws JavaModelException { - String source = - "class X {\n" + - "/*\n" + - " * **********************************************************************************\n" + - " * **********************************************************************************\n" + - " * **********************************************************************************\n" + - " * The code below was added to track the view with focus\n" + - " * in order to support save actions from a view. Remove this\n" + - " * experimental code if the decision is to not allow views to \n" + - " * participate in save actions (see bug 10234) \n" + - " */\n" + - "}\n"; - formatSource(source, - "class X {\n" + - " /*\n" + - " * **********************************************************************************\n" + - " * **********************************************************************************\n" + - " * **********************************************************************************\n" + - " * The code below was added to track the view with focus in order to support\n" + - " * save actions from a view. Remove this experimental code if the decision\n" + - " * is to not allow views to participate in save actions (see bug 10234)\n" + - " */\n" + + "package wksp2;\n" + + "\n" + + "public interface I05 {\n" + + "\n" + + " /**\n" + + " * Indexes the specified values into a {@code Multimap} by applying a\n" + + " * specified function to each item in an {@code Iterable} of values. Each\n" + + " * value will be stored as a value in the specified multimap. The key used\n" + + " * to store that value in the multimap will be the result of calling the\n" + + " * function on that value. Depending on the multimap implementation,\n" + + " * duplicate entries (equal keys and equal values) may be collapsed.\n" + + " * \n" + + " *

    \n" + + " * For example,\n" + + " * \n" + + " *

    \n" +
    +		"	 * List<String> badGuys =\n" +
    +		"	 *   Arrays.asList(\"Inky\", \"Blinky\", \"Pinky\", \"Pinky\", \"Clyde\");\n" +
    +		"	 * Function<String, Integer> stringLengthFunction = ...;\n" +
    +		"	 * Multimap<Integer, String> index = Multimaps.newHashMultimap();\n" +
    +		"	 * Multimaps.index(badGuys, stringLengthFunction, index);\n" +
    +		"	 * System.out.println(index);\n" +
    +		"	 * 
    \n" + + " * \n" + + " * prints\n" + + " * \n" + + " *
    \n" +
    +		"	 * {4=[Inky], 5=[Pinky, Clyde], 6=[Blinky]}\n" +
    +		"	 * 
    \n" + + " * \n" + + " * The {@link HashMultimap} collapses the duplicate occurrence of\n" + + " * {@code (5, \"Pinky\")}.\n" + + " * \n" + + " * @param values\n" + + " * the values to add to the multimap\n" + + " * @param keyFunction\n" + + " * the function used to produce the key for each value\n" + + " * @param multimap\n" + + " * the multimap to store the key value pairs\n" + + " */\n" + + " void foo();\n" + "}\n" ); } -public void testBug260274h() throws JavaModelException { - String source = - "class X {\n" + - " /**\n" + - " * @see #spacing(Point)\n" + - " * * @see #spacing(int, int)\n" + - " */\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - formatSource(source, - "class X {\n" + - " /**\n" + - " * @see #spacing(Point) * @see #spacing(int, int)\n" + - " */\n" + - " public void foo() {\n" + - " }\n" + +public void testBug260381_wksp2_06() throws JavaModelException { + String source = + "package wksp2;\n" + + "\n" + + "public interface I06 {\n" + + "\n" + + " /**\n" + + " * Adds a number of occurrences of an element to this multiset. Note that if\n" + + " * {@code occurrences == 1}, this method has the identical effect to {@link\n" + + " * #add(Object)}. This method is functionally equivalent (except in the case\n" + + " * of overflow) to the call {@code addAll(Collections.nCopies(element,\n" + + " * occurrences))}, which would presumably perform much more poorly.\n" + + " *\n" + + " * @param element the element to add occurrences of; may be {@code null} only\n" + + " * if explicitly allowed by the implementation\n" + + " * @param occurrences the number of occurrences of this element to add. May\n" + + " * be zero, in which case no change will be made.\n" + + " * @return the previous count of this element before the operation; possibly\n" + + " * zero - TODO: make this the actual behavior!\n" + + " * @throws IllegalArgumentException if {@code occurrences} is negative, or if\n" + + " * this operation would result in more than {@link Integer#MAX_VALUE}\n" + + " * occurrences of the element \n" + + " * @throws NullPointerException if {@code element} is null and this\n" + + " * implementation does not permit null elements. Note that if {@code\n" + + " * occurrences} is zero, the implementation may opt to return normally.\n" + + " */\n" + + " boolean /*int*/ add(E element, int occurrences);\n" + + "}\n"; + formatSource(source, + "package wksp2;\n" + + "\n" + + "public interface I06 {\n" + + "\n" + + " /**\n" + + " * Adds a number of occurrences of an element to this multiset. Note that if\n" + + " * {@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" + + " * \n" + + " * @param element\n" + + " * the element to add occurrences of; may be {@code null} only if\n" + + " * explicitly allowed by the implementation\n" + + " * @param occurrences\n" + + " * the number of occurrences of this element to add. May be zero,\n" + + " * in which case no change will be made.\n" + + " * @return the previous count of this element before the operation; possibly\n" + + " * zero - TODO: make this the actual behavior!\n" + + " * @throws IllegalArgumentException\n" + + " * if {@code occurrences} is negative, or if this operation\n" + + " * would result in more than {@link Integer#MAX_VALUE}\n" + + " * occurrences of the element\n" + + " * @throws NullPointerException\n" + + " * if {@code element} is null and this implementation does not\n" + + " * permit null elements. Note that if {@code occurrences} is\n" + + " * zero, the implementation may opt to return normally.\n" + + " */\n" + + " boolean /* int */add(E element, int occurrences);\n" + "}\n" ); } - -/** - * @bug 260276: [formatter] Inconsistent formatting of one-line block comment - * @test Ensure that the comment formatter has a consistent behavior while formatting one-line block comment - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=260276" - */ -public void testBug260276() throws JavaModelException { - String source = - "class X {\n" + - "/* a\n" + - "comment */\n" + +public void testBug260381_wksp2_07() throws JavaModelException { + String source = + "package wksp2;\n" + + "\n" + + "public interface I07 {\n" + + "\n" + + " /**\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: {@code comparator.compare(e1,\n" + + " * e2)} must not throw a {@code ClassCastException} for any elements {@code\n" + + " * e1} and {@code e2} in the multiset. If the user attempts to add an element\n" + + " * to the multiset that violates this constraint, the {@code add(Object)} call\n" + + " * will throw a {@code ClassCastException}.\n" + + " *\n" + + " * @param comparator the comparator that will be used to sort this multiset. A\n" + + " * null value indicates that the elements\' natural ordering should\n" + + " * be used.\n" + + " */\n" + + " void foo();\n" + "}\n"; formatSource(source, - "class X {\n" + - " /*\n" + - " * a comment\n" + - " */\n" + + "package wksp2;\n" + + "\n" + + "public interface I07 {\n" + + "\n" + + " /**\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" + + " * \n" + + " * @param comparator\n" + + " * the comparator that will be used to sort this multiset. A null\n" + + " * value indicates that the elements\' natural ordering\n" + + " * should be used.\n" + + " */\n" + + " void foo();\n" + "}\n" ); } -public void testBug260276b() throws JavaModelException { - String source = - "class X {\n" + - "/* a\n" + - " comment */\n" + +public void testBug260381_wksp2_08() throws JavaModelException { + String source = + "package wksp2;\n" + + "\n" + + "public interface I08 {\n" + + "\n" + + " /**\n" + + " * Returns the composition of a function and a predicate. For every {@code x},\n" + + " * the generated predicate returns {@code predicate(function(x))}.\n" + + " *\n" + + " * @return the composition of the provided function and predicate\n" + + " */\n" + + " void foo();\n" + "}\n"; formatSource(source, - "class X {\n" + - " /*\n" + - " * a comment\n" + - " */\n" + + "package wksp2;\n" + + "\n" + + "public interface I08 {\n" + + "\n" + + " /**\n" + + " * Returns the composition of a function and a predicate. For every\n" + + " * {@code x}, the generated predicate returns {@code predicate(function(x))}\n" + + " * .\n" + + " * \n" + + " * @return the composition of the provided function and predicate\n" + + " */\n" + + " void foo();\n" + "}\n" ); } -public void testBug260276c() throws JavaModelException { - String source = - "class X {\n" + - "/* a\n" + - " * comment */\n" + +public void testBug260381_wksp2_09() throws JavaModelException { + String source = + "package wksp2;\n" + + "\n" + + "/**\n" + + " A Conditional represents an if/then/else block.\n" + + " When this is created the code will already have\n" + + " the conditional check code. The code is optimized for branch\n" + + " offsets that fit in 2 bytes, though will handle 4 byte offsets.\n" + + "\n" + + " if condition\n" + + " then code\n" + + " else code\n" + + "\n" + + " what actually gets built is\n" + + "\n" + + " if !condition branch to eb:\n" + + " then code\n" + + " goto end: // skip else\n" + + " eb:\n" + + " else code\n" + + " end:\n" + + "\n" + + "*/\n" + + "public class X09 {\n" + + "\n" + "}\n"; formatSource(source, - "class X {\n" + - " /*\n" + - " * a comment\n" + - " */\n" + + "package wksp2;\n" + + "\n" + + "/**\n" + + " * A Conditional represents an if/then/else block. When this is created the code\n" + + " * will already have the conditional check code. The code is optimized for\n" + + " * branch offsets that fit in 2 bytes, though will handle 4 byte offsets. \n" + + " if condition\n" + + " then code\n" + + " else code\n" + + "\n" + + " * what actually gets built is \n" + + " if !condition branch to eb:\n" + + " then code\n" + + " goto end: // skip else\n" + + " eb:\n" + + " else code\n" + + " end:\n" + + "\n" + + " */\n" + + "public class X09 {\n" + + "\n" + "}\n" ); } @@ -4404,100 +5092,100 @@ */ public void testBug260798() throws JavaModelException { this.formatterPrefs.join_wrapped_lines = false; - String source = - "class X {\n" + - " @Override\n" + - " public void addSelectionListener(SelectionListener listener) {\n" + - " super.addSelectionListener(new SelectionListener() {\n" + - " @Override\n" + - " public void widgetSelected(SelectionEvent e) {\n" + - " }\n" + - "\n" + - " @Override\n" + - " public void widgetDefaultSelected(SelectionEvent e) {\n" + - " };\n" + - " });\n" + - " }\n" + - "}\n"; - formatSource(source, - "class X {\n" + - " @Override\n" + - " public void addSelectionListener(SelectionListener listener) {\n" + - " super.addSelectionListener(new SelectionListener() {\n" + - " @Override\n" + - " public void widgetSelected(SelectionEvent e) {\n" + - " }\n" + - "\n" + - " @Override\n" + - " public void widgetDefaultSelected(SelectionEvent e) {\n" + - " };\n" + - " });\n" + - " }\n" + + String source = + "class X {\n" + + " @Override\n" + + " public void addSelectionListener(SelectionListener listener) {\n" + + " super.addSelectionListener(new SelectionListener() {\n" + + " @Override\n" + + " public void widgetSelected(SelectionEvent e) {\n" + + " }\n" + + "\n" + + " @Override\n" + + " public void widgetDefaultSelected(SelectionEvent e) {\n" + + " };\n" + + " });\n" + + " }\n" + + "}\n"; + formatSource(source, + "class X {\n" + + " @Override\n" + + " public void addSelectionListener(SelectionListener listener) {\n" + + " super.addSelectionListener(new SelectionListener() {\n" + + " @Override\n" + + " public void widgetSelected(SelectionEvent e) {\n" + + " }\n" + + "\n" + + " @Override\n" + + " public void widgetDefaultSelected(SelectionEvent e) {\n" + + " };\n" + + " });\n" + + " }\n" + "}\n" ); } public void testBug260798b() throws JavaModelException { this.formatterPrefs.join_wrapped_lines = false; - String source = - "class X {\n" + - "\n" + - " void foo() {\n" + - " this.bar(new Object() {\n" + - " @Override\n" + - " public String toString() {\n" + - " return \"\";\n" + - " }\n" + - " });\n" + - " }\n" + - "}\n"; - formatSource(source, - "class X {\n" + - "\n" + - " void foo() {\n" + - " this.bar(new Object() {\n" + - " @Override\n" + - " public String toString() {\n" + - " return \"\";\n" + - " }\n" + - " });\n" + - " }\n" + + String source = + "class X {\n" + + "\n" + + " void foo() {\n" + + " this.bar(new Object() {\n" + + " @Override\n" + + " public String toString() {\n" + + " return \"\";\n" + + " }\n" + + " });\n" + + " }\n" + + "}\n"; + formatSource(source, + "class X {\n" + + "\n" + + " void foo() {\n" + + " this.bar(new Object() {\n" + + " @Override\n" + + " public String toString() {\n" + + " return \"\";\n" + + " }\n" + + " });\n" + + " }\n" + "}\n" ); } public void testBug260798c() throws JavaModelException { this.formatterPrefs.join_wrapped_lines = false; - String source = - "class X {\n" + - "\n" + - "{\n" + - " this.bar(new Object() {\n" + - " @Override\n" + - " public String toString() {\n" + - " return \"\";\n" + - " }\n" + - " });\n" + - "}\n" + - " void bar(Object object) {\n" + - " \n" + - " }\n" + - "\n" + - "}\n"; - formatSource(source, - "class X {\n" + - "\n" + - " {\n" + - " this.bar(new Object() {\n" + - " @Override\n" + - " public String toString() {\n" + - " return \"\";\n" + - " }\n" + - " });\n" + - " }\n" + - "\n" + - " void bar(Object object) {\n" + - "\n" + - " }\n" + - "\n" + + String source = + "class X {\n" + + "\n" + + "{\n" + + " this.bar(new Object() {\n" + + " @Override\n" + + " public String toString() {\n" + + " return \"\";\n" + + " }\n" + + " });\n" + + "}\n" + + " void bar(Object object) {\n" + + " \n" + + " }\n" + + "\n" + + "}\n"; + formatSource(source, + "class X {\n" + + "\n" + + " {\n" + + " this.bar(new Object() {\n" + + " @Override\n" + + " public String toString() {\n" + + " return \"\";\n" + + " }\n" + + " });\n" + + " }\n" + + "\n" + + " void bar(Object object) {\n" + + "\n" + + " }\n" + + "\n" + "}\n" ); } @@ -4508,18 +5196,18 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=267551" */ public void testBug267551() throws JavaModelException { - String source = - "import java.lang.annotation.*;\n" + - "\n" + - "@Target({ ElementType.ANNOTATION_TYPE })\n" + - "@Retention(RetentionPolicy.RUNTIME)\n" + + String source = + "import java.lang.annotation.*;\n" + + "\n" + + "@Target({ ElementType.ANNOTATION_TYPE })\n" + + "@Retention(RetentionPolicy.RUNTIME)\n" + "public @interface Foo { }\n"; formatSource(source, - "import java.lang.annotation.*;\n" + - "\n" + - "@Target({ ElementType.ANNOTATION_TYPE })\n" + - "@Retention(RetentionPolicy.RUNTIME)\n" + - "public @interface Foo {\n" + + "import java.lang.annotation.*;\n" + + "\n" + + "@Target({ ElementType.ANNOTATION_TYPE })\n" + + "@Retention(RetentionPolicy.RUNTIME)\n" + + "public @interface Foo {\n" + "}\n" ); } @@ -4534,41 +5222,41 @@ this.formatterPrefs.comment_format_javadoc_comment = false; this.formatterPrefs.comment_format_block_comment = true; this.formatterPrefs.comment_format_line_comment = false; - String source = - "/**\n" + - " * Test for\n" + - " * bug 267658\n" + - " */\n" + - "package javadoc;\n" + - "\n" + - "/**\n" + - " * Test for\n" + - " * bug 267658\n" + - " */\n" + - "public class Test {\n" + - "/**\n" + - " * Test for\n" + - " * bug 267658\n" + - " */\n" + - "int field;\n" + - "}\n"; - formatSource(source, - "/**\n" + - " * Test for\n" + - " * bug 267658\n" + - " */\n" + - "package javadoc;\n" + - "\n" + - "/**\n" + - " * Test for\n" + - " * bug 267658\n" + - " */\n" + - "public class Test {\n" + - " /**\n" + - " * Test for\n" + - " * bug 267658\n" + - " */\n" + - " int field;\n" + + String source = + "/**\n" + + " * Test for\n" + + " * bug 267658\n" + + " */\n" + + "package javadoc;\n" + + "\n" + + "/**\n" + + " * Test for\n" + + " * bug 267658\n" + + " */\n" + + "public class Test {\n" + + "/**\n" + + " * Test for\n" + + " * bug 267658\n" + + " */\n" + + "int field;\n" + + "}\n"; + formatSource(source, + "/**\n" + + " * Test for\n" + + " * bug 267658\n" + + " */\n" + + "package javadoc;\n" + + "\n" + + "/**\n" + + " * Test for\n" + + " * bug 267658\n" + + " */\n" + + "public class Test {\n" + + " /**\n" + + " * Test for\n" + + " * bug 267658\n" + + " */\n" + + " int field;\n" + "}\n" ); } @@ -4576,19 +5264,19 @@ this.formatterPrefs.comment_format_javadoc_comment = false; this.formatterPrefs.comment_format_block_comment = true; this.formatterPrefs.comment_format_line_comment = false; - String source = - "public class Test {\n" + - "/**\n" + - " * @test bug\n" + - " */\n" + - "int field;\n" + + String source = + "public class Test {\n" + + "/**\n" + + " * @test bug\n" + + " */\n" + + "int field;\n" + "}\n"; formatSource(source, - "public class Test {\n" + - " /**\n" + - " * @test bug\n" + - " */\n" + - " int field;\n" + + "public class Test {\n" + + " /**\n" + + " * @test bug\n" + + " */\n" + + " int field;\n" + "}\n" ); } @@ -4599,40 +5287,40 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=273619" */ public void testBug273619a() throws JavaModelException { - String source = - "/**\n" + - " *
      \n" + - " *
    • {@code *}
    • \n" + - " *
    \n" + - " */\n" + + String source = + "/**\n" + + " *
      \n" + + " *
    • {@code *}
    • \n" + + " *
    \n" + + " */\n" + "public class X {\n" + "}\n"; formatSource(source, - "/**\n" + - " *
      \n" + - " *
    • {@code *}
    • \n" + - " *
    \n" + - " */\n" + - "public class X {\n" + + "/**\n" + + " *
      \n" + + " *
    • {@code *}
    • \n" + + " *
    \n" + + " */\n" + + "public class X {\n" + "}\n" ); } public void testBug273619b() throws JavaModelException { - String source = - "/**\n" + - " *

    \n" + - " * {@link *}\n" + - " *

    \n" + - " */\n" + + String source = + "/**\n" + + " *

    \n" + + " * {@link *}\n" + + " *

    \n" + + " */\n" + "public class X {\n" + "}\n"; formatSource(source, - "/**\n" + - " *

    \n" + - " * {@link *}\n" + - " *

    \n" + - " */\n" + - "public class X {\n" + + "/**\n" + + " *

    \n" + + " * {@link *}\n" + + " *

    \n" + + " */\n" + + "public class X {\n" + "}\n" ); } @@ -4645,35 +5333,35 @@ */ public void testBug279359() throws JavaModelException { this.formatterPrefs.join_wrapped_lines = false; - String source = - "public class Formatter {\n" + - "\n" + - " public static void main(String[] args) {\n" + - "\n" + - " Executors.newCachedThreadPool().execute(new Runnable() {\n" + - "\n" + - " public void run() {\n" + - " throw new UnsupportedOperationException(\"stub\");\n" + - " }\n" + - "\n" + - " });\n" + - "\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class Formatter {\n" + - "\n" + - " public static void main(String[] args) {\n" + - "\n" + - " Executors.newCachedThreadPool().execute(new Runnable() {\n" + - "\n" + - " public void run() {\n" + - " throw new UnsupportedOperationException(\"stub\");\n" + - " }\n" + - "\n" + - " });\n" + - "\n" + - " }\n" + + String source = + "public class Formatter {\n" + + "\n" + + " public static void main(String[] args) {\n" + + "\n" + + " Executors.newCachedThreadPool().execute(new Runnable() {\n" + + "\n" + + " public void run() {\n" + + " throw new UnsupportedOperationException(\"stub\");\n" + + " }\n" + + "\n" + + " });\n" + + "\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class Formatter {\n" + + "\n" + + " public static void main(String[] args) {\n" + + "\n" + + " Executors.newCachedThreadPool().execute(new Runnable() {\n" + + "\n" + + " public void run() {\n" + + " throw new UnsupportedOperationException(\"stub\");\n" + + " }\n" + + "\n" + + " });\n" + + "\n" + + " }\n" + "}\n" ); } @@ -4685,49 +5373,49 @@ */ public void testBug280061() throws JavaModelException { this.formatterOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3); - String source = - "public interface X {\n" + - "/**\n" + - " *
    \n" + 
    -		" *   void solve(Executor e,\n" + 
    -		" *              Collection<Callable<Result>> solvers)\n" + 
    -		" *     throws InterruptedException, ExecutionException {\n" + 
    -		" *       CompletionService<Result> ecs\n" + 
    -		" *           = new ExecutorCompletionService<Result>(e);\n" + 
    -		" *       for (Callable<Result> s : solvers)\n" + 
    -		" *           ecs.submit(s);\n" + 
    -		" *       int n = solvers.size();\n" + 
    -		" *       for (int i = 0; i < n; ++i) {\n" + 
    -		" *           Result r = ecs.take().get();\n" + 
    -		" *           if (r != null)\n" + 
    -		" *               use(r);\n" + 
    -		" *       }\n" + 
    -		" *   }\n" + 
    -		" * 
    \n" + - " */\n" + - " void foo();\n" + - "}\n"; - formatSource(source, - "public interface X {\n" + - " /**\n" + - " *
    \n" + 
    -		"	 * void solve(Executor e,\n" + 
    -		"	 *              Collection<Callable<Result>> solvers)\n" + 
    -		"	 *     throws InterruptedException, ExecutionException {\n" + 
    -		"	 *       CompletionService<Result> ecs\n" + 
    -		"	 *           = new ExecutorCompletionService<Result>(e);\n" + 
    -		"	 *       for (Callable<Result> s : solvers)\n" + 
    -		"	 *           ecs.submit(s);\n" + 
    -		"	 *       int n = solvers.size();\n" + 
    -		"	 *       for (int i = 0; i < n; ++i) {\n" + 
    -		"	 *           Result r = ecs.take().get();\n" + 
    -		"	 *           if (r != null)\n" + 
    -		"	 *               use(r);\n" + 
    -		"	 *       }\n" + 
    -		"	 *   }\n" + 
    -		"	 * 
    \n" + - " */\n" + - " void foo();\n" + + String source = + "public interface X {\n" + + "/**\n" + + " *
    \n" +
    +		" *   void solve(Executor e,\n" +
    +		" *              Collection<Callable<Result>> solvers)\n" +
    +		" *     throws InterruptedException, ExecutionException {\n" +
    +		" *       CompletionService<Result> ecs\n" +
    +		" *           = new ExecutorCompletionService<Result>(e);\n" +
    +		" *       for (Callable<Result> s : solvers)\n" +
    +		" *           ecs.submit(s);\n" +
    +		" *       int n = solvers.size();\n" +
    +		" *       for (int i = 0; i < n; ++i) {\n" +
    +		" *           Result r = ecs.take().get();\n" +
    +		" *           if (r != null)\n" +
    +		" *               use(r);\n" +
    +		" *       }\n" +
    +		" *   }\n" +
    +		" * 
    \n" + + " */\n" + + " void foo();\n" + + "}\n"; + formatSource(source, + "public interface X {\n" + + " /**\n" + + " *
    \n" +
    +		"	 * void solve(Executor e,\n" +
    +		"	 *              Collection<Callable<Result>> solvers)\n" +
    +		"	 *     throws InterruptedException, ExecutionException {\n" +
    +		"	 *       CompletionService<Result> ecs\n" +
    +		"	 *           = new ExecutorCompletionService<Result>(e);\n" +
    +		"	 *       for (Callable<Result> s : solvers)\n" +
    +		"	 *           ecs.submit(s);\n" +
    +		"	 *       int n = solvers.size();\n" +
    +		"	 *       for (int i = 0; i < n; ++i) {\n" +
    +		"	 *           Result r = ecs.take().get();\n" +
    +		"	 *           if (r != null)\n" +
    +		"	 *               use(r);\n" +
    +		"	 *       }\n" +
    +		"	 *   }\n" +
    +		"	 * 
    \n" + + " */\n" + + " void foo();\n" + "}\n" ); } @@ -4740,61 +5428,61 @@ */ public void testBug280255() throws JavaModelException { this.formatterPrefs.indent_empty_lines = true; - String source = - "public class X {\n" + - " private void foo(int val) {\n" + - " switch (val) {\n" + - " case 0:\n" + - " {\n" + - "\n" + - "\n" + - "[# return ;#]\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - formatSource(source, - "public class X {\n" + - " private void foo(int val) {\n" + - " switch (val) {\n" + - " case 0:\n" + - " {\n" + - "\n" + - "\n" + - " return;\n" + - " }\n" + - " }\n" + - " }\n" + + String source = + "public class X {\n" + + " private void foo(int val) {\n" + + " switch (val) {\n" + + " case 0:\n" + + " {\n" + + "\n" + + "\n" + + "[# return ;#]\n" + + " }\n" + + " }\n" + + " }\n" + + "}\n"; + formatSource(source, + "public class X {\n" + + " private void foo(int val) {\n" + + " switch (val) {\n" + + " case 0:\n" + + " {\n" + + "\n" + + "\n" + + " return;\n" + + " }\n" + + " }\n" + + " }\n" + "}\n" ); } public void testBug280255b() throws JavaModelException { this.formatterPrefs.indent_empty_lines = true; - String source = - "public class X {\r\n" + - " private void foo(int val) {\r\n" + - " switch (val) {\r\n" + - " case 0:\r\n" + - " {\r\n" + - "\r\n" + - "\r\n" + - "[# return ;#]\r\n" + - " }\r\n" + - " }\r\n" + - " }\r\n" + + String source = + "public class X {\r\n" + + " private void foo(int val) {\r\n" + + " switch (val) {\r\n" + + " case 0:\r\n" + + " {\r\n" + + "\r\n" + + "\r\n" + + "[# return ;#]\r\n" + + " }\r\n" + + " }\r\n" + + " }\r\n" + "}\r\n"; formatSource(source, - "public class X {\r\n" + - " private void foo(int val) {\r\n" + - " switch (val) {\r\n" + - " case 0:\r\n" + - " {\r\n" + - "\r\n" + - "\r\n" + - " return;\r\n" + - " }\r\n" + - " }\r\n" + - " }\r\n" + + "public class X {\r\n" + + " private void foo(int val) {\r\n" + + " switch (val) {\r\n" + + " case 0:\r\n" + + " {\r\n" + + "\r\n" + + "\r\n" + + " return;\r\n" + + " }\r\n" + + " }\r\n" + + " }\r\n" + "}\r\n" ); } @@ -4805,58 +5493,58 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=280616" */ public void testBug280616() throws JavaModelException { - String source = - "public interface X {\n" + - "/**\n" + - " *
    \n" + 
    -		" *   void solve(Executor e,\n" + 
    -		" *              Collection<Callable<Result>> solvers)\n" + 
    -		" *     throws InterruptedException, ExecutionException {\n" + 
    -		" *       CompletionService<Result> ecs\n" + 
    -		" *           = new ExecutorCompletionService<Result>(e);\n" + 
    -		" *       for (Callable<Result> s : solvers)\n" + 
    -		" *           ecs.submit(s);\n" + 
    -		" *       int n = solvers.size();\n" + 
    -		" *       for (int i = 0; i < n; ++i) {\n" + 
    -		" *           Result r = ecs.take().get();\n" + 
    -		" *           if (r != null)\n" + 
    -		" *               use(r);\n" + 
    -		" *       }\n" + 
    -		" *   }\n" + 
    -		" * 
    \n" + - " */\n" + - " void foo();\n" + - "}\n"; - formatSource(source, - "public interface X {\n" + - " /**\n" + - " *
    \n" + 
    -		"	 * void solve(Executor e, Collection<Callable<Result>> solvers)\n" + 
    -		"	 * 		throws InterruptedException, ExecutionException {\n" + 
    -		"	 * 	CompletionService<Result> ecs = new ExecutorCompletionService<Result>(e);\n" + 
    -		"	 * 	for (Callable<Result> s : solvers)\n" + 
    -		"	 * 		ecs.submit(s);\n" + 
    -		"	 * 	int n = solvers.size();\n" + 
    -		"	 * 	for (int i = 0; i < n; ++i) {\n" + 
    -		"	 * 		Result r = ecs.take().get();\n" + 
    -		"	 * 		if (r != null)\n" + 
    -		"	 * 			use(r);\n" + 
    -		"	 * 	}\n" + 
    -		"	 * }\n" + 
    -		"	 * 
    \n" + - " */\n" + - " void foo();\n" + + String source = + "public interface X {\n" + + "/**\n" + + " *
    \n" +
    +		" *   void solve(Executor e,\n" +
    +		" *              Collection<Callable<Result>> solvers)\n" +
    +		" *     throws InterruptedException, ExecutionException {\n" +
    +		" *       CompletionService<Result> ecs\n" +
    +		" *           = new ExecutorCompletionService<Result>(e);\n" +
    +		" *       for (Callable<Result> s : solvers)\n" +
    +		" *           ecs.submit(s);\n" +
    +		" *       int n = solvers.size();\n" +
    +		" *       for (int i = 0; i < n; ++i) {\n" +
    +		" *           Result r = ecs.take().get();\n" +
    +		" *           if (r != null)\n" +
    +		" *               use(r);\n" +
    +		" *       }\n" +
    +		" *   }\n" +
    +		" * 
    \n" + + " */\n" + + " void foo();\n" + + "}\n"; + formatSource(source, + "public interface X {\n" + + " /**\n" + + " *
    \n" +
    +		"	 * void solve(Executor e, Collection<Callable<Result>> solvers)\n" +
    +		"	 * 		throws InterruptedException, ExecutionException {\n" +
    +		"	 * 	CompletionService<Result> ecs = new ExecutorCompletionService<Result>(e);\n" +
    +		"	 * 	for (Callable<Result> s : solvers)\n" +
    +		"	 * 		ecs.submit(s);\n" +
    +		"	 * 	int n = solvers.size();\n" +
    +		"	 * 	for (int i = 0; i < n; ++i) {\n" +
    +		"	 * 		Result r = ecs.take().get();\n" +
    +		"	 * 		if (r != null)\n" +
    +		"	 * 			use(r);\n" +
    +		"	 * 	}\n" +
    +		"	 * }\n" +
    +		"	 * 
    \n" + + " */\n" + + " void foo();\n" + "}\n" ); } /** - * @bug 287833: [formatter] Formatter removes the first character after the * in the
     tag 
    + * @bug 287833: [formatter] Formatter removes the first character after the * in the 
     tag
      * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=287833"
      */
     public void testBug287833a() {
    -	String source = 
    -		"public class test1 {\n" + 
    +	String source =
    +		"public class test1 {\n" +
     	    "/**\n"+
     	    "* 
    \n"+
     	    "*void foo() {\n"+
    @@ -4866,8 +5554,8 @@
     	    "void foo() {\n"+
     	    "}\n"+
     	    "}\n";
    -	    
    -	formatSource(source, 
    +
    +	formatSource(source,
     		"public class test1 {\n"+
     	    "	/**\n"+
     	    "	 * 
    \n"+
    @@ -4880,8 +5568,8 @@
     	    "}\n");
     }
     public void testBug287833b() {
    -	String source = 
    -		"public class test1 {\n" + 
    +	String source =
    +		"public class test1 {\n" +
     	    "/**\n"+
     	    "* 
    \n"+
     	    "* void foo() {\n"+
    @@ -4892,8 +5580,8 @@
     	    "void foo() {\n"+
     	    "}\n"+
     	    "}\n";
    -	    
    -	formatSource(source, 
    +
    +	formatSource(source,
     		"public class test1 {\n"+
     	    "	/**\n"+
     	    "	 * 
    \n"+
    @@ -4907,8 +5595,8 @@
     	    "}\n");
     }
     public void testBug287833c() {
    -	String source = 
    -		"public class test1 {\n" + 
    +	String source =
    +		"public class test1 {\n" +
     	    "/**\n"+
     	    "* 
    \n"+
     	    "* void foo() {\n"+
    @@ -4919,8 +5607,8 @@
     	    "void foo() {\n"+
     	    "}\n"+
     	    "}\n";
    -	    
    -	formatSource(source, 
    +
    +	formatSource(source,
     		"public class test1 {\n"+
     	    "	/**\n"+
     	    "	 * 
    \n"+
    @@ -4940,56 +5628,56 @@
      * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=300379"
      */
     public void testBug300379() {
    -	String source = 
    -		"public class X {\n" + 
    -		"    /**\n" + 
    -		"     * 
       {@code\n" + 
    -		"     * \n" + 
    -		"     *   public class X {\n" + 
    -		"     *   }}
    \n" + - " */\n" + - " public void foo() {}\n" + + String source = + "public class X {\n" + + " /**\n" + + " *
       {@code\n" +
    +		"     * \n" +
    +		"     *   public class X {\n" +
    +		"     *   }}
    \n" + + " */\n" + + " public void foo() {}\n" + "}\n"; - - formatSource(source, - "public class X {\n" + - " /**\n" + - " *
    \n" + 
    -		"	 * {\n" + 
    -		"	 * 	@code\n" + 
    -		"	 * 	public class X {\n" + 
    -		"	 * 	}\n" + 
    -		"	 * }\n" + 
    -		"	 * 
    \n" + - " */\n" + - " public void foo() {\n" + - " }\n" + + + formatSource(source, + "public class X {\n" + + " /**\n" + + " *
    \n" +
    +		"	 * {\n" +
    +		"	 * 	@code\n" +
    +		"	 * 	public class X {\n" +
    +		"	 * 	}\n" +
    +		"	 * }\n" +
    +		"	 * 
    \n" + + " */\n" + + " public void foo() {\n" + + " }\n" + "}\n"); } public void testBug300379b() { - String source = - "public class X {\n" + - " /**\n" + - " *
       {@code\n" + 
    -		"     * \n" + 
    -		"     *   public class X {}}
    \n" + - " */\n" + - " public void foo() {}\n" + + String source = + "public class X {\n" + + " /**\n" + + " *
       {@code\n" +
    +		"     * \n" +
    +		"     *   public class X {}}
    \n" + + " */\n" + + " public void foo() {}\n" + "}\n"; - - formatSource(source, - "public class X {\n" + - " /**\n" + - " *
    \n" + 
    -		"	 * {\n" + 
    -		"	 * 	@code\n" + 
    -		"	 * 	public class X {\n" + 
    -		"	 * 	}\n" + 
    -		"	 * }\n" + 
    -		"	 * 
    \n" + - " */\n" + - " public void foo() {\n" + - " }\n" + + + formatSource(source, + "public class X {\n" + + " /**\n" + + " *
    \n" +
    +		"	 * {\n" +
    +		"	 * 	@code\n" +
    +		"	 * 	public class X {\n" +
    +		"	 * 	}\n" +
    +		"	 * }\n" +
    +		"	 * 
    \n" + + " */\n" + + " public void foo() {\n" + + " }\n" + "}\n"); }