### 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.7321 diff -u -r1.7321 buildnotes_jdt-core.html --- buildnotes_jdt-core.html 23 Feb 2010 10:56:17 -0000 1.7321 +++ buildnotes_jdt-core.html 23 Feb 2010 11:33:45 -0000 @@ -113,14 +113,14 @@ Added two new formatter preferences to condense block and javadoc comments.
These new preferences are controlled respectively with the options:
-DefaultCodeFormatterConstants.FORMATTER_COMMENT_CONDENSED_BLOCK_COMMENT
DefaultCodeFormatterConstants.FORMATTER_COMMENT_CONDENSED_JAVADOC_COMMENT
+DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEW_LINES_AT_BLOCK_BOUNDARIES
DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEW_LINES_AT_JAVADOC_BOUNDARIES
/** - * FORMATTER / Option to control whether block comments are condensed or not - * - option id: "org.eclipse.jdt.core.formatter.comment.condensed_block_comment" + * FORMATTER / Option to control whether block comments will have new lines at boundaries + * - option id: "org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" * - possible values: { TRUE, FALSE } - * - default: FALSE + * - default: TRUE * * @see #TRUE * @see #FALSE @@ -128,10 +128,10 @@ */ /** - * FORMATTER / Option to control whether javadoc comments are condensed or not - * - option id: "org.eclipse.jdt.core.formatter.comment.condensed_javadoc_comment" + * FORMATTER / Option to control whether javadoc comments will have new lines at boundaries + * - option id: "org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" * - possible values: { TRUE, FALSE } - * - default: FALSE + * - default: TRUE * * @see #TRUE * @see #FALSE Index: formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java,v retrieving revision 1.103 diff -u -r1.103 DefaultCodeFormatterConstants.java --- formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java 23 Feb 2010 10:56:17 -0000 1.103 +++ formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java 23 Feb 2010 11:33:47 -0000 @@ -616,32 +616,6 @@ /** *- * FORMATTER / Option to control whether block comments are condensed or not - * - option id: "org.eclipse.jdt.core.formatter.comment.condensed_block_comment" - * - possible values: { TRUE, FALSE } - * - default: FALSE - *- * @see #TRUE - * @see #FALSE - * @since 3.6 - */ - public final static String FORMATTER_COMMENT_CONDENSED_BLOCK_COMMENT = "org.eclipse.jdt.core.formatter.comment.condensed_block_comment"; //$NON-NLS-1$ - - /** - *- * FORMATTER / Option to control whether javadoc comments are condensed or not - * - option id: "org.eclipse.jdt.core.formatter.comment.condensed_javadoc_comment" - * - possible values: { TRUE, FALSE } - * - default: FALSE - *- * @see #TRUE - * @see #FALSE - * @since 3.6 - */ - public final static String FORMATTER_COMMENT_CONDENSED_JAVADOC_COMMENT = "org.eclipse.jdt.core.formatter.comment.condensed_javadoc_comment"; //$NON-NLS-1$ - - /** - ** FORMATTER / Option to control whether comments are formatted * - option id: "org.eclipse.jdt.core.formatter.comment.format_comments" * - possible values: { TRUE, FALSE } @@ -798,6 +772,32 @@ /** *+ * FORMATTER / Option to control whether block comments will have new lines at boundaries + * - option id: "org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" + * - possible values: { TRUE, FALSE } + * - default: TRUE + *+ * @see #TRUE + * @see #FALSE + * @since 3.6 + */ + public final static String FORMATTER_COMMENT_NEW_LINES_AT_BLOCK_BOUNDARIES = "org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries"; //$NON-NLS-1$ + + /** + *+ * FORMATTER / Option to control whether javadoc comments will have new lines at boundaries + * - option id: "org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" + * - possible values: { TRUE, FALSE } + * - default: TRUE + *+ * @see #TRUE + * @see #FALSE + * @since 3.6 + */ + public final static String FORMATTER_COMMENT_NEW_LINES_AT_JAVADOC_BOUNDARIES = "org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries"; //$NON-NLS-1$ + + /** + ** FORMATTER / Option to compact else/if * - option id: "org.eclipse.jdt.core.formatter.compact_else_if" * - possible values: { TRUE, FALSE } Index: formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java,v retrieving revision 1.99 diff -u -r1.99 DefaultCodeFormatterOptions.java --- formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java 23 Feb 2010 10:56:18 -0000 1.99 +++ formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java 23 Feb 2010 11:33:49 -0000 @@ -100,8 +100,8 @@ public boolean comment_clear_blank_lines_in_javadoc_comment; public boolean comment_clear_blank_lines_in_block_comment; - public boolean comment_condensed_block_comment; - public boolean comment_condensed_javadoc_comment; + public boolean comment_new_lines_at_block_boundaries; + public boolean comment_new_lines_at_javadoc_boundaries; public boolean comment_format_javadoc_comment; public boolean comment_format_line_comment; public boolean comment_format_block_comment; @@ -371,8 +371,8 @@ options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, this.brace_position_for_switch); options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT, this.comment_clear_blank_lines_in_block_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT, this.comment_clear_blank_lines_in_javadoc_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); - options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CONDENSED_BLOCK_COMMENT, this.comment_condensed_block_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); - options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CONDENSED_JAVADOC_COMMENT, this.comment_condensed_javadoc_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); + options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEW_LINES_AT_BLOCK_BOUNDARIES, this.comment_new_lines_at_block_boundaries ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); + options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEW_LINES_AT_JAVADOC_BOUNDARIES, this.comment_new_lines_at_javadoc_boundaries ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_JAVADOC_COMMENT, this.comment_format_javadoc_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_LINE_COMMENT, this.comment_format_line_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT, this.comment_format_block_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); @@ -1105,13 +1105,13 @@ this.comment_line_length = 80; } } - final Object commentCondensedBlockCommentOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CONDENSED_BLOCK_COMMENT); - if (commentCondensedBlockCommentOption != null) { - this.comment_condensed_block_comment = DefaultCodeFormatterConstants.TRUE.equals(commentCondensedBlockCommentOption); - } - final Object commentCondensedJavadocCommentOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CONDENSED_JAVADOC_COMMENT); - if (commentCondensedJavadocCommentOption != null) { - this.comment_condensed_javadoc_comment = DefaultCodeFormatterConstants.TRUE.equals(commentCondensedJavadocCommentOption); + final Object commentNewLinesAtBlockBoundariesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEW_LINES_AT_BLOCK_BOUNDARIES); + if (commentNewLinesAtBlockBoundariesOption != null) { + this.comment_new_lines_at_block_boundaries = DefaultCodeFormatterConstants.TRUE.equals(commentNewLinesAtBlockBoundariesOption); + } + final Object commentNewLinesAtJavadocBoundariesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEW_LINES_AT_JAVADOC_BOUNDARIES); + if (commentNewLinesAtJavadocBoundariesOption != null) { + this.comment_new_lines_at_javadoc_boundaries = DefaultCodeFormatterConstants.TRUE.equals(commentNewLinesAtJavadocBoundariesOption); } final Object indentStatementsCompareToBlockOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK); if (indentStatementsCompareToBlockOption != null) { @@ -2024,6 +2024,8 @@ this.comment_indent_root_tags = true; this.comment_insert_empty_line_before_root_tags = true; this.comment_insert_new_line_for_parameter = true; + this.comment_new_lines_at_block_boundaries = true; + this.comment_new_lines_at_javadoc_boundaries = true; this.comment_line_length = 80; this.continuation_indentation = 2; this.continuation_indentation_for_array_initializer = 2; @@ -2291,6 +2293,8 @@ this.comment_indent_root_tags = true; this.comment_insert_empty_line_before_root_tags = true; this.comment_insert_new_line_for_parameter = true; + this.comment_new_lines_at_block_boundaries = true; + this.comment_new_lines_at_javadoc_boundaries = true; this.comment_line_length = 80; this.continuation_indentation = 2; this.continuation_indentation_for_array_initializer = 2; 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.193 diff -u -r1.193 Scribe.java --- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 22 Feb 2010 12:59:54 -0000 1.193 +++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 23 Feb 2010 11:33:51 -0000 @@ -1628,7 +1628,7 @@ boolean firstWord = true; boolean clearBlankLines = this.formatter.preferences.comment_clear_blank_lines_in_block_comment; boolean joinLines = this.formatter.preferences.join_lines_in_comments; - boolean condensed = this.formatter.preferences.comment_condensed_block_comment; + boolean newLinesAtBoundaries = this.formatter.preferences.comment_new_lines_at_block_boundaries; int scannerLine = Util.getLineNumber(this.scanner.currentPosition, this.lineEnds, 0, this.maxLines); int firstLine = scannerLine; int lineNumber = scannerLine; @@ -1688,7 +1688,7 @@ this.column += tokensBuffer.length(); } // end of comment - if (!condensed) { + if (newLinesAtBoundaries) { if (multiLines || hasMultiLines) { buffer.append(this.lineSeparator); this.column = 1; @@ -1739,7 +1739,7 @@ int max; lineNumber = Util.getLineNumber(this.scanner.currentPosition, this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines); if (lastTextLine == -1) { - linesGap = condensed ? 0 : lineNumber - firstLine; + linesGap = newLinesAtBoundaries ? lineNumber - firstLine : 0; max = 0; } else { linesGap = lineNumber - lastTextLine; @@ -1877,7 +1877,7 @@ } private void printBlockCommentHeaderLine(StringBuffer buffer) { - if (this.formatter.preferences.comment_condensed_block_comment) { + if (!this.formatter.preferences.comment_new_lines_at_block_boundaries) { buffer.insert(0, ' '); this.column++; } @@ -3283,7 +3283,7 @@ printJavadocBlock(previousBlock); // format the header and footer empty spaces - int newLines = (!this.formatter.preferences.comment_condensed_javadoc_comment && (this.line > currentLine || javadoc.isMultiLine())) ? 1 : 0; + int newLines = (this.formatter.preferences.comment_new_lines_at_javadoc_boundaries && (this.line > currentLine || javadoc.isMultiLine())) ? 1 : 0; printJavadocGapLines(javadoc.textStart, firstBlockStart-1, newLines, this.formatter.preferences.comment_clear_blank_lines_in_javadoc_comment, false, null); printJavadocGapLines(previousBlock.sourceEnd+1, javadoc.textEnd, newLines, this.formatter.preferences.comment_clear_blank_lines_in_javadoc_comment, true, null); } #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java,v retrieving revision 1.54 diff -u -r1.54 FormatterCommentsBugsTest.java --- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 22 Feb 2010 12:59:48 -0000 1.54 +++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 23 Feb 2010 11:33:55 -0000 @@ -5564,7 +5564,7 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=270209" */ public void testBug270209_Block01() throws JavaModelException { - this.formatterPrefs.comment_condensed_block_comment = true; + this.formatterPrefs.comment_new_lines_at_block_boundaries = false; String source = "public interface X01 {\n" + "\n" + @@ -5582,7 +5582,7 @@ ); } public void testBug270209_Block02() throws JavaModelException { - this.formatterPrefs.comment_condensed_block_comment = true; + this.formatterPrefs.comment_new_lines_at_block_boundaries = false; String source = "public interface X02 {\n" + "\n" + @@ -5602,7 +5602,7 @@ ); } public void testBug270209_Block03() throws JavaModelException { - this.formatterPrefs.comment_condensed_block_comment = true; + this.formatterPrefs.comment_new_lines_at_block_boundaries = false; String source = "public interface X03 {\n" + "\n" + @@ -5624,7 +5624,7 @@ ); } public void testBug270209_Javadoc01() throws JavaModelException { - this.formatterPrefs.comment_condensed_javadoc_comment = true; + this.formatterPrefs.comment_new_lines_at_javadoc_boundaries = false; String source = "public interface X01 {\n" + "\n" + @@ -5642,7 +5642,7 @@ ); } public void testBug270209_Javadoc02() throws JavaModelException { - this.formatterPrefs.comment_condensed_javadoc_comment = true; + this.formatterPrefs.comment_new_lines_at_javadoc_boundaries = false; String source = "public interface X02 {\n" + "\n" + @@ -5662,7 +5662,7 @@ ); } public void testBug270209_Javadoc03() throws JavaModelException { - this.formatterPrefs.comment_condensed_javadoc_comment = true; + this.formatterPrefs.comment_new_lines_at_javadoc_boundaries = false; String source = "public interface X03 {\n" + "\n" +