### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core 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.136 diff -u -r1.136 Scribe.java --- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 13 May 2008 17:06:08 -0000 1.136 +++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 18 May 2008 15:41:40 -0000 @@ -2179,6 +2179,18 @@ // Nothing else to do if the tag has no node if (maxNodes < 0) { if (block.isInlined()) { + this.scanner.resetTo(previousEnd+1, block.sourceEnd); + try { + int token = this.scanner.getNextToken(); + while (!this.scanner.atEnd() && token != TerminalTokens.TokenNameRBRACE) { + token = this.scanner.getNextToken(); + } + if (token == TerminalTokens.TokenNameRBRACE) { + addDeleteEdit(previousEnd+1, this.scanner.startPosition-1); + } + } catch (InvalidInputException iie) { + // skip + } this.column++; } return; @@ -2388,6 +2400,16 @@ return 0; } + /* + * Print block reference knowing that: + * 1) reference of inlined tag can never be split + * 2) reference of root tag can only be split between method argument + * + * Note that even if the reference has been split, the formatted output + * is rewritten on one line (or several if there are arguments and the reference + * is over the line max lenght). This behavior might be changed while fixing bug + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=196124 + */ private void printJavadocBlockReference(FormatJavadocBlock block, FormatJavadocReference reference) { int maxColumn = this.formatter.preferences.comment_line_length + 1; boolean headerLine = block.isHeaderLine(); @@ -2399,10 +2421,11 @@ StringBuffer buffer = new StringBuffer(); boolean needFormat = false; int previousToken = -1; - int spacePosition = -1; String newLineString = null; StringBuffer newLineBuffer = null; + StringBuffer tokensBuffer = new StringBuffer(); int firstColumn = -1; + int previousLine = this.line; while (!this.scanner.atEnd()) { int token; try { @@ -2411,55 +2434,155 @@ switch (token) { case TerminalTokens.TokenNameWHITESPACE: if (previousToken != -1 || tokenLength > 1 || this.scanner.currentCharacter != ' ') needFormat = true; - if (previousToken == -1) { // space before reference - buffer.append(' '); - this.column++; - } - if (previousToken == TerminalTokens.TokenNameCOMMA) { // space between method arguments - spacePosition = buffer.length(); - buffer.append(' '); - this.column++; // space before reference + if (tokensBuffer.length() > 0) { + if (buffer.length() == 0) { // space before reference + buffer.append(' '); + this.column++; + } + if (previousToken == TerminalTokens.TokenNameCOMMA) { + // Allow to split only after the comma between method arguments + if (!inlined && (this.column+tokensBuffer.length()+1) > maxColumn) { + // not enough space on the line + this.lastNumberOfNewLines++; + this.line++; + if (newLineString == null) { + newLineBuffer = new StringBuffer(this.lineSeparator); + this.column = 1; + printIndentationIfNecessary(newLineBuffer); + newLineBuffer.append(BLOCK_LINE_PREFIX); + this.column += BLOCK_LINE_PREFIX_LENGTH; + if (this.commentIndentation != null) { + newLineBuffer.append(this.commentIndentation); + this.column += this.commentIndentation.length(); + } + newLineString = newLineBuffer.toString(); + firstColumn = this.column; + } else { + this.column = firstColumn; + } + buffer.append(newLineString); + if (headerLine) { + headerLine = false; + maxColumn--; + } + if (tokensBuffer.charAt(0) == ' ') { + buffer.append(tokensBuffer.substring(1)); + this.column += tokensBuffer.length() - 1; + } else { + buffer.append(tokensBuffer); + this.column += tokensBuffer.length(); + } + tokensBuffer.setLength(0); + continue; + } + } + buffer.append(tokensBuffer); + this.column += tokensBuffer.length(); + tokensBuffer.setLength(0); } break; case TerminalTokens.TokenNameMULTIPLY: + // Do not consider '*' at the beginning of the javadoc line as a character of the reference break; + case TerminalTokens.TokenNameboolean : + case TerminalTokens.TokenNamebyte : + case TerminalTokens.TokenNamechar: + case TerminalTokens.TokenNameshort : + case TerminalTokens.TokenNameint : + case TerminalTokens.TokenNamelong : + case TerminalTokens.TokenNamedouble : + case TerminalTokens.TokenNamefloat : + switch (previousToken) { + case TerminalTokens.TokenNameCOMMA: + // insert space after a comma if the line hasn't changed + tokensBuffer.append(' '); + this.column++; + break; + } + tokensBuffer.append(this.scanner.source, this.scanner.startPosition, tokenLength); + previousToken = token; + break; + case TerminalTokens.TokenNameIdentifier: + switch (previousToken) { + case TerminalTokens.TokenNameIdentifier: + case TerminalTokens.TokenNameRBRACKET: + case TerminalTokens.TokenNameboolean : + case TerminalTokens.TokenNamebyte : + case TerminalTokens.TokenNamechar: + case TerminalTokens.TokenNameshort : + case TerminalTokens.TokenNameint : + case TerminalTokens.TokenNamelong : + case TerminalTokens.TokenNamedouble : + case TerminalTokens.TokenNamefloat : + case TerminalTokens.TokenNameCOMMA: + // insert space between the argument type and name + tokensBuffer.append(' '); + this.column++; + break; + } + tokensBuffer.append(this.scanner.source, this.scanner.startPosition, tokenLength); + previousToken = token; + break; default: - if (!inlined && spacePosition > 0 && (this.column+tokenLength) > maxColumn) { - // not enough space on the line - this.lastNumberOfNewLines++; - this.line++; - if (newLineString == null) { - newLineBuffer = new StringBuffer(this.lineSeparator); - this.column = 1; - printIndentationIfNecessary(newLineBuffer); - newLineBuffer.append(BLOCK_LINE_PREFIX); - this.column += BLOCK_LINE_PREFIX_LENGTH; - if (this.commentIndentation != null) { - newLineBuffer.append(this.commentIndentation); - this.column += this.commentIndentation.length(); - } - newLineString = newLineBuffer.substring(0, newLineBuffer.length()-1); // remove last space as buffer will be inserted before a space - firstColumn = this.column; - } else { - this.column = firstColumn; - } - this.column = firstColumn + buffer.length() - spacePosition - 1; - buffer.insert(spacePosition, newLineString); - if (headerLine) { - headerLine = false; - maxColumn--; - } + if (previousToken == TerminalTokens.TokenNameCOMMA) { + // insert space between the argument type and name + tokensBuffer.append(' '); + this.column++; } - buffer.append(this.scanner.source, this.scanner.startPosition, tokenLength); - this.column += tokenLength; + tokensBuffer.append(this.scanner.source, this.scanner.startPosition, tokenLength); + previousToken = token; break; } - previousToken = token; } catch (InvalidInputException iie) { // does not happen as syntax is correct } + previousLine = this.line; } if (needFormat) { + if (tokensBuffer.length() > 0) { + // Add remaining buffered tokens + if (!inlined && (this.column+tokensBuffer.length()+1) > maxColumn) { + // not enough space on the line + if (buffer.length() == 0) { + // the reference wasn't split => keep on the same line + buffer.append(' '); + this.column++; + buffer.append(tokensBuffer); + this.column += tokensBuffer.length(); + } else { + this.lastNumberOfNewLines++; + this.line++; + if (newLineString == null) { + buffer.append(this.lineSeparator); + this.column = 1; + printIndentationIfNecessary(buffer); + buffer.append(BLOCK_LINE_PREFIX); + this.column += BLOCK_LINE_PREFIX_LENGTH; + if (this.commentIndentation != null) { + buffer.append(this.commentIndentation); + this.column += this.commentIndentation.length(); + } + } else { + buffer.append(newLineString); + this.column = firstColumn; + } + if (tokensBuffer.charAt(0) == ' ') { + buffer.append(tokensBuffer.substring(1)); + this.column += tokensBuffer.length() - 1; + } else { + buffer.append(tokensBuffer); + this.column += tokensBuffer.length(); + } + } + } else { + if (buffer.length() == 0) { + buffer.append(' '); + this.column++; + } + buffer.append(tokensBuffer); + this.column += tokensBuffer.length(); + } + } addReplaceEdit(block.tagEnd+1, reference.sourceEnd, buffer.toString()); } } #P org.eclipse.jdt.core.tests.model Index: workspace/FormatterJavadoc/test/bugs/b232138/out/X01e.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/out/X01e.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/out/X01e.java --- workspace/FormatterJavadoc/test/bugs/b232138/out/X01e.java 15 May 2008 17:45:45 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,10 +0,0 @@ -public class X01e { - - /** - * - * Test header/footer. - * - *****************************************/ - void foo() { - } -} \ No newline at end of file Index: workspace/FormatterJavadoc/test/bugs/b232138/out/X01d.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/out/X01d.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/out/X01d.java --- workspace/FormatterJavadoc/test/bugs/b232138/out/X01d.java 15 May 2008 17:45:45 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,9 +0,0 @@ -public class X01d { - - /** - * - * Test header/footer. - ***/ - void foo() { - } -} \ No newline at end of file Index: workspace/FormatterJavadoc/test/bugs/b232138/out/X02.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/out/X02.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/out/X02.java --- workspace/FormatterJavadoc/test/bugs/b232138/out/X02.java 15 May 2008 17:45:45 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,9 +0,0 @@ -public class X02 { - - /** - ** - ** Returns true - **/ - void foo() { - } -} \ No newline at end of file Index: workspace/FormatterJavadoc/test/bugs/b232138/out/X04b.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/out/X04b.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/out/X04b.java --- workspace/FormatterJavadoc/test/bugs/b232138/out/X04b.java 15 May 2008 17:45:45 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,11 +0,0 @@ -public class X04b { - - void foo() { - if (true) { - /**** - * \r and \n are not valid - * in string literals - ****/ - } - } -} Index: workspace/FormatterJavadoc/test/bugs/b232138/out/X04.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/out/X04.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/out/X04.java --- workspace/FormatterJavadoc/test/bugs/b232138/out/X04.java 15 May 2008 17:45:45 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,8 +0,0 @@ -public class X04 { - - void foo() { - if (true) { - /**** string literals ****/ - } - } -} Index: workspace/FormatterJavadoc/test/bugs/b232138/out/X01f.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/out/X01f.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/out/X01f.java --- workspace/FormatterJavadoc/test/bugs/b232138/out/X01f.java 15 May 2008 17:45:45 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,10 +0,0 @@ -public class X01f { - - /***************************************** - * - * Returns true - * - *****************************************/ - void foo() { - } -} \ No newline at end of file Index: workspace/FormatterJavadoc/test/bugs/b232138/out/X01c.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/out/X01c.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/out/X01c.java --- workspace/FormatterJavadoc/test/bugs/b232138/out/X01c.java 15 May 2008 17:45:45 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,9 +0,0 @@ -public class X01c { - - /***************************************** - * - * Test header/footer. - */ - void foo() { - } -} \ No newline at end of file Index: workspace/FormatterJavadoc/test/bugs/b232138/out/X01.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/out/X01.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/out/X01.java --- workspace/FormatterJavadoc/test/bugs/b232138/out/X01.java 15 May 2008 17:45:45 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,10 +0,0 @@ -public class X01 { - - /** - * - * Returns true if the operator - * expects... - **/ - void foo() { - } -} \ No newline at end of file Index: workspace/FormatterJavadoc/test/bugs/b232138/out/X03.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/out/X03.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/out/X03.java --- workspace/FormatterJavadoc/test/bugs/b232138/out/X03.java 15 May 2008 17:45:45 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,10 +0,0 @@ -public class X03 { - - /** - ** - ** Returns true if the operator - * expects... - **/ - void foo() { - } -} \ No newline at end of file Index: workspace/FormatterJavadoc/test/bugs/b232138/out/X01b.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/out/X01b.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/out/X01b.java --- workspace/FormatterJavadoc/test/bugs/b232138/out/X01b.java 15 May 2008 17:45:45 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,9 +0,0 @@ -public class X01b { - - /*** - * - * Test header/footer. - */ - void foo() { - } -} \ No newline at end of file Index: workspace/FormatterJavadoc/test/bugs/b232138/X03.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/X03.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/X03.java --- workspace/FormatterJavadoc/test/bugs/b232138/X03.java 15 May 2008 17:45:44 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,9 +0,0 @@ -public class X03 { - - /** - ** - ** Returns true if the operator expects... - **/ - void foo() { - } -} \ No newline at end of file Index: workspace/FormatterJavadoc/test/bugs/b232138/X02.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/X02.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/X02.java --- workspace/FormatterJavadoc/test/bugs/b232138/X02.java 15 May 2008 17:45:44 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,9 +0,0 @@ -public class X02 { - - /** - ** - ** Returns true - **/ - void foo() { - } -} \ No newline at end of file Index: workspace/FormatterJavadoc/test/bugs/b232138/X04b.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/X04b.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/X04b.java --- workspace/FormatterJavadoc/test/bugs/b232138/X04b.java 15 May 2008 17:45:44 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,8 +0,0 @@ -public class X04b { - - void foo() { - if (true) { - /**** \r and \n are not valid in string literals ****/ - } - } -} Index: workspace/FormatterJavadoc/test/bugs/b232138/X01d.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/X01d.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/X01d.java --- workspace/FormatterJavadoc/test/bugs/b232138/X01d.java 15 May 2008 17:45:44 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,9 +0,0 @@ -public class X01d { - - /** - * - * Test header/footer. - ***/ - void foo() { - } -} \ No newline at end of file Index: workspace/FormatterJavadoc/test/bugs/b232138/X04.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/X04.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/X04.java --- workspace/FormatterJavadoc/test/bugs/b232138/X04.java 15 May 2008 17:45:44 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,8 +0,0 @@ -public class X04 { - - void foo() { - if (true) { - /**** string literals ****/ - } - } -} Index: workspace/FormatterJavadoc/test/bugs/b232138/X01.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/X01.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/X01.java --- workspace/FormatterJavadoc/test/bugs/b232138/X01.java 15 May 2008 17:45:44 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,9 +0,0 @@ -public class X01 { - - /** - * - * Returns true if the operator expects... - **/ - void foo() { - } -} \ No newline at end of file Index: workspace/FormatterJavadoc/test/bugs/b232138/X01b.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/X01b.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/X01b.java --- workspace/FormatterJavadoc/test/bugs/b232138/X01b.java 15 May 2008 17:45:44 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,9 +0,0 @@ -public class X01b { - - /*** - * - * Test header/footer. - */ - void foo() { - } -} \ No newline at end of file Index: workspace/FormatterJavadoc/test/bugs/b232138/X01c.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/X01c.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/X01c.java --- workspace/FormatterJavadoc/test/bugs/b232138/X01c.java 15 May 2008 17:45:44 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,9 +0,0 @@ -public class X01c { - - /***************************************** - * - * Test header/footer. - */ - void foo() { - } -} \ No newline at end of file Index: workspace/FormatterJavadoc/test/bugs/b232138/X01e.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/X01e.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/X01e.java --- workspace/FormatterJavadoc/test/bugs/b232138/X01e.java 15 May 2008 17:45:44 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,10 +0,0 @@ -public class X01e { - - /** - * - * Test header/footer. - * - *****************************************/ - void foo() { - } -} \ No newline at end of file Index: workspace/FormatterJavadoc/test/bugs/b232138/X01f.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232138/X01f.java diff -N workspace/FormatterJavadoc/test/bugs/b232138/X01f.java --- workspace/FormatterJavadoc/test/bugs/b232138/X01f.java 15 May 2008 17:45:44 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,10 +0,0 @@ -public class X01f { - - /***************************************** - * - * Returns true - * - *****************************************/ - void foo() { - } -} \ No newline at end of file Index: workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X02.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X02.java,v retrieving revision 1.2 diff -u -r1.2 X02.java --- workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X02.java 13 May 2008 17:06:15 -0000 1.2 +++ workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X02.java 18 May 2008 15:41:43 -0000 @@ -6,9 +6,9 @@ *

* Once a content extension has been bound to the INavigatorContentService, * clients may use - * {@link INavigatorActivationService#activateExtensions(String[], boolean) } + * {@link INavigatorActivationService#activateExtensions(String[], boolean)} * or - * {@link INavigatorActivationService#deactivateExtensions(String[], boolean) } + * {@link INavigatorActivationService#deactivateExtensions(String[], boolean)} * to control the activation state of the extension. See * {@link INavigatorContentService} for more information on the difference * between visible and active. Index: src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java,v retrieving revision 1.2 diff -u -r1.2 FormatterCommentsBugsTest.java --- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 15 May 2008 17:45:45 -0000 1.2 +++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 18 May 2008 15:41:43 -0000 @@ -120,49 +120,66 @@ } /** - * @bug 232138: [formatter] Javadoc header/footer formatting is different than 3.3 + * @bug 232285: [formatter] New comment formatter wrongly formats javadoc header/footer with several contiguous stars * @test Insure that new formatter do not add/remove stars in header and footer - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=232138" + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=232285" */ -public void testBug232138a() throws JavaModelException { +public void testBug232285a() throws JavaModelException { this.preferences.comment_line_length = 40; - formatUnit("bugs.b232138", "X01.java"); + formatUnit("bugs.b232285", "X01.java"); } -public void testBug232138b() throws JavaModelException { +public void testBug232285b() throws JavaModelException { this.preferences.comment_line_length = 40; - formatUnit("bugs.b232138", "X01b.java"); + formatUnit("bugs.b232285", "X01b.java"); } -public void testBug232138c() throws JavaModelException { +public void testBug232285c() throws JavaModelException { this.preferences.comment_line_length = 40; - formatUnit("bugs.b232138", "X01c.java"); + formatUnit("bugs.b232285", "X01c.java"); } -public void testBug232138d() throws JavaModelException { +public void testBug232285d() throws JavaModelException { this.preferences.comment_line_length = 40; - formatUnit("bugs.b232138", "X01d.java"); + formatUnit("bugs.b232285", "X01d.java"); } -public void testBug232138e() throws JavaModelException { +public void testBug232285e() throws JavaModelException { this.preferences.comment_line_length = 40; - formatUnit("bugs.b232138", "X01e.java"); + formatUnit("bugs.b232285", "X01e.java"); } -public void testBug232138f() throws JavaModelException { +public void testBug232285f() throws JavaModelException { this.preferences.comment_line_length = 40; - formatUnit("bugs.b232138", "X01f.java"); + formatUnit("bugs.b232285", "X01f.java"); } -public void testBug232138g() throws JavaModelException { +public void testBug232285g() throws JavaModelException { this.preferences.comment_line_length = 40; - formatUnit("bugs.b232138", "X02.java"); + formatUnit("bugs.b232285", "X02.java"); } -public void testBug232138h() throws JavaModelException { +public void testBug232285h() throws JavaModelException { this.preferences.comment_line_length = 40; - formatUnit("bugs.b232138", "X03.java"); + formatUnit("bugs.b232285", "X03.java"); } -public void testBug232138i() throws JavaModelException { +public void testBug232285i() throws JavaModelException { this.preferences.comment_line_length = 40; - formatUnit("bugs.b232138", "X04.java"); + formatUnit("bugs.b232285", "X04.java"); } -public void testBug232138j() throws JavaModelException { +public void testBug232285j() throws JavaModelException { this.preferences.comment_line_length = 40; - formatUnit("bugs.b232138", "X04b.java"); + formatUnit("bugs.b232285", "X04b.java"); } +/** + * @bug 232466: [formatter] References of inlined tags are still split in certain circumstances + * @test Insure that new formatter do not add/remove stars in header and footer + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=232466" + */ +public void testBug233466a() throws JavaModelException { + this.preferences.comment_line_length = 40; + formatUnit("bugs.b232466", "X01.java"); +} +public void testBug233466b() throws JavaModelException { + this.preferences.comment_line_length = 40; + formatUnit("bugs.b232466", "X02.java"); +} +public void testBug233466c() throws JavaModelException { + this.preferences.comment_line_length = 40; + formatUnit("bugs.b232466", "X03.java"); +} } Index: workspace/FormatterJavadoc/test/bugs/b232285/X03.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/X03.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/X03.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/X03.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,9 @@ +public class X03 { + + /** + ** + ** Returns true if the operator expects... + **/ + void foo() { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232285/out/X01c.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/out/X01c.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/out/X01c.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/out/X01c.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,9 @@ +public class X01c { + + /***************************************** + * + * Test header/footer. + */ + void foo() { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232285/X04.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/X04.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/X04.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/X04.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,8 @@ +public class X04 { + + void foo() { + if (true) { + /**** string literals ****/ + } + } +} Index: workspace/FormatterJavadoc/test/bugs/b232285/X04b.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/X04b.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/X04b.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/X04b.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,8 @@ +public class X04b { + + void foo() { + if (true) { + /**** \r and \n are not valid in string literals ****/ + } + } +} Index: workspace/FormatterJavadoc/test/bugs/b232466/out/X02.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232466/out/X02.java diff -N workspace/FormatterJavadoc/test/bugs/b232466/out/X02.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232466/out/X02.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,14 @@ +package test.bugs.b232466; + +/** + * {@link LocalClass02#searchAllTypeNames(char[] packageName, int packageMatchRule, char[] typeName)} + */ +public class X02 { + +} + +class LocalClass02 { + void searchAllTypeNames(char[] packageName, int packageMatchRule, + char[] typeName) { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232285/X02.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/X02.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/X02.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/X02.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,9 @@ +public class X02 { + + /** + ** + ** Returns true + **/ + void foo() { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232285/out/X01e.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/out/X01e.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/out/X01e.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/out/X01e.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,10 @@ +public class X01e { + + /** + * + * Test header/footer. + * + *****************************************/ + void foo() { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232466/X03.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232466/X03.java diff -N workspace/FormatterJavadoc/test/bugs/b232466/X03.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232466/X03.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,26 @@ +package test.bugs.b232466; + +/** + * {@link + * test . bugs. + * b232466 .X03.LocalClass03 + * # + * foo ( + * char [ ] + * packageName, + * java . lang .String + * packageMatchRule, + * char [ ] + * typeName + * ) + * } + */ +public class X03 { + +class LocalClass03 { + void foo(char[] packageName, String str, + char[] typeName) { + } +} + +} Index: workspace/FormatterJavadoc/test/bugs/b232285/out/X01b.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/out/X01b.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/out/X01b.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/out/X01b.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,9 @@ +public class X01b { + + /*** + * + * Test header/footer. + */ + void foo() { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232285/out/X01.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/out/X01.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/out/X01.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/out/X01.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,10 @@ +public class X01 { + + /** + * + * Returns true if the operator + * expects... + **/ + void foo() { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232466/out/X01.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232466/out/X01.java diff -N workspace/FormatterJavadoc/test/bugs/b232466/out/X01.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232466/out/X01.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,8 @@ +package test.bugs.b232466; + +/** + * {@link SearchEngine#searchAllTypeNames(char[] packageName, int packageMatchRule, char[] typeName, int typeMatchRule, int searchFor, IJavaSearchScope scope, TypeNameMatchRequestor nameMatchRequestor, int waitingPolicy, org.eclipse.core.runtime.IProgressMonitor monitor)} + */ +public class X01 { + +} Index: workspace/FormatterJavadoc/test/bugs/b232285/out/X03.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/out/X03.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/out/X03.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/out/X03.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,10 @@ +public class X03 { + + /** + ** + ** Returns true if the operator + * expects... + **/ + void foo() { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232285/out/X02.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/out/X02.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/out/X02.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/out/X02.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,9 @@ +public class X02 { + + /** + ** + ** Returns true + **/ + void foo() { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232466/out/X03.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232466/out/X03.java diff -N workspace/FormatterJavadoc/test/bugs/b232466/out/X03.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232466/out/X03.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,13 @@ +package test.bugs.b232466; + +/** + * {@link test.bugs.b232466.X03.LocalClass03#foo(char[] packageName, java.lang.String packageMatchRule, char[] typeName)} + */ +public class X03 { + + class LocalClass03 { + void foo(char[] packageName, String str, char[] typeName) { + } + } + +} Index: workspace/FormatterJavadoc/test/bugs/b232285/X01c.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/X01c.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/X01c.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/X01c.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,9 @@ +public class X01c { + + /***************************************** + * + * Test header/footer. + */ + void foo() { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232466/X01.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232466/X01.java diff -N workspace/FormatterJavadoc/test/bugs/b232466/X01.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232466/X01.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,17 @@ +package test.bugs.b232466; + +/** + * {@link SearchEngine#searchAllTypeNames( + * char[] packageName, + * int packageMatchRule, + * char[] typeName, + * int typeMatchRule, + * int searchFor, + * IJavaSearchScope scope, + * TypeNameMatchRequestor nameMatchRequestor, + * int waitingPolicy, + * org.eclipse.core.runtime.IProgressMonitor monitor)} + */ +public class X01 { + +} Index: workspace/FormatterJavadoc/test/bugs/b232285/out/X04.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/out/X04.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/out/X04.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/out/X04.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,8 @@ +public class X04 { + + void foo() { + if (true) { + /**** string literals ****/ + } + } +} Index: workspace/FormatterJavadoc/test/bugs/b232285/X01f.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/X01f.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/X01f.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/X01f.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,10 @@ +public class X01f { + + /***************************************** + * + * Returns true + * + *****************************************/ + void foo() { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232285/X01.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/X01.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/X01.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/X01.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,9 @@ +public class X01 { + + /** + * + * Returns true if the operator expects... + **/ + void foo() { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232285/out/X01d.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/out/X01d.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/out/X01d.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/out/X01d.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,9 @@ +public class X01d { + + /** + * + * Test header/footer. + ***/ + void foo() { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232466/X02.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232466/X02.java diff -N workspace/FormatterJavadoc/test/bugs/b232466/X02.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232466/X02.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,20 @@ +package test.bugs.b232466; + +/** + * {@link LocalClass02#searchAllTypeNames( + * char[] + * packageName, + * int + * packageMatchRule, + * char[] + * typeName)} + */ +public class X02 { + +} + +class LocalClass02 { + void searchAllTypeNames(char[] packageName, int packageMatchRule, + char[] typeName) { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232285/out/X04b.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/out/X04b.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/out/X04b.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/out/X04b.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,11 @@ +public class X04b { + + void foo() { + if (true) { + /**** + * \r and \n are not valid + * in string literals + ****/ + } + } +} Index: workspace/FormatterJavadoc/test/bugs/b232285/X01d.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/X01d.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/X01d.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/X01d.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,9 @@ +public class X01d { + + /** + * + * Test header/footer. + ***/ + void foo() { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232285/X01e.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/X01e.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/X01e.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/X01e.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,10 @@ +public class X01e { + + /** + * + * Test header/footer. + * + *****************************************/ + void foo() { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232285/X01b.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/X01b.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/X01b.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/X01b.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,9 @@ +public class X01b { + + /*** + * + * Test header/footer. + */ + void foo() { + } +} Index: workspace/FormatterJavadoc/test/bugs/b232285/out/X01f.java =================================================================== RCS file: workspace/FormatterJavadoc/test/bugs/b232285/out/X01f.java diff -N workspace/FormatterJavadoc/test/bugs/b232285/out/X01f.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ workspace/FormatterJavadoc/test/bugs/b232285/out/X01f.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,10 @@ +public class X01f { + + /***************************************** + * + * Returns true + * + *****************************************/ + void foo() { + } +}