### 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.128
diff -u -r1.128 Scribe.java
--- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 27 Apr 2008 10:01:19 -0000 1.128
+++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 27 Apr 2008 16:25:10 -0000
@@ -1789,7 +1789,7 @@
int previousStart = currentTokenStartPosition;
if (!isNlsTag && includesLineComments()) {
- printLineComment(currentTokenStartPosition, currentTokenEndPosition);
+ printLineComment(currentTokenStartPosition, currentTokenEndPosition-1);
} else {
// do nothing!?
loop: while (nextCharacterStart <= currentTokenEndPosition && (currentCharacter = this.scanner.getNextChar()) != -1) {
@@ -1843,6 +1843,7 @@
this.numberOfIndentations = this.indentationLevel / this.indentationSize;
// Consume the comment prefix
+ this.scanner.resetTo(commentStart, commentEnd);
StringBuffer buffer = new StringBuffer();
this.scanner.getNextChar();
buffer.append(this.scanner.currentCharacter);
@@ -1856,6 +1857,7 @@
int previousPosition = commentStart;
char previousChar = 0;
boolean firstWord = true;
+ this.scanner.skipComments = true;
// Consume text token per token
while (!this.scanner.atEnd()) {
@@ -1925,7 +1927,7 @@
buffer.append(this.lineSeparator);
this.line++;
this.lastNumberOfNewLines++;
- } else if (previousPosition < commentEnd) {
+ } else {
this.scanner.resetTo(previousPosition, commentEnd);
while (!this.scanner.atEnd()) {
this.scanner.getNextChar();
@@ -1941,7 +1943,8 @@
}
// Replace the existing comment with new one
- addReplaceEdit(commentStart, commentEnd-1, buffer.toString());
+ addReplaceEdit(commentStart, commentEnd, buffer.toString());
+ this.scanner.skipComments = false;
}
public void printEmptyLines(int linesNumber) {
@@ -2071,9 +2074,6 @@
}
if (!block.isDescription()) {
this.column += previousEnd - block.sourceStart + 1;
- if (block.isInlined()) {
- this.column++; // Add extra character for inline tag
- }
FormatJavadocReference reference= block.reference;
if (reference != null) {
// format reference
@@ -2107,7 +2107,10 @@
while (token == TerminalTokens.TokenNameWHITESPACE || token == TerminalTokens.TokenNameMULTIPLY) {
token = this.scanner.getNextToken();
}
- buffer.append(this.scanner.source, this.scanner.startPosition, this.scanner.currentPosition-this.scanner.startPosition);
+ if (token == TerminalTokens.TokenNameRBRACE) {
+ buffer.append(this.scanner.source, this.scanner.startPosition, this.scanner.currentPosition-this.scanner.startPosition);
+ this.column += (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition;
+ }
} catch (InvalidInputException e) {
buffer.append('}');
}
@@ -2118,7 +2121,6 @@
}
// tag section: iterate through the blocks composing this tag but the last one
-// if (block.isHeaderLine()) maxColumn++;
for (int i=0; i<=maxNodes; i++) {
FormatJavadocNode node = block.nodes[i];
int nodeStart = node.sourceStart;
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.5
diff -u -r1.5 FormatterCommentParser.java
--- formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java 27 Apr 2008 10:01:19 -0000 1.5
+++ formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java 27 Apr 2008 16:25:08 -0000
@@ -26,6 +26,7 @@
public class FormatterCommentParser extends JavadocParser implements IJavaDocTagConstants {
char[][] htmlTags;
int htmlTagsPtr = -1;
+ private boolean invalidTagName;
FormatterCommentParser(Parser sourceParser) {
super(sourceParser);
@@ -115,6 +116,65 @@
}
/*
+ * Return the html tag index in the various arrays of IJavaDocTagConstants.
+ * The returned int is set as follow:
+ * - the array index is set on bits 0 to 7
+ * - the tag category is set on bit 8 to 15 (0xFF00 if no array includes the tag)
+ */
+private int getHtmlTagIndex(char[] htmlTag) {
+ int length = htmlTag == null ? 0 : htmlTag.length;
+ if (length > 0) {
+ for (int i=0, max=JAVADOC_SINGLE_BREAK_TAG.length; i" + DELIMITER +
+ (DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT ? " * " + DELIMITER : "") +
" *
" + DELIMITER +
" * " + DELIMITER +
" * " + DELIMITER +
@@ -874,8 +876,9 @@
" * " + DELIMITER +
" */";
- String expected =
- "/**" + DELIMITER +
+ String expected = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT
+ ? input // do not change as is an immutable tag
+ : "/**" + DELIMITER +
" *
" + DELIMITER +
" *
" + DELIMITER +
" * setLeadingComment("/* traditional comment */"); // correct" + DELIMITER +
@@ -936,6 +939,40 @@
assertEquals(expected, result);
}
+ public void test109636_4() {
+ if (DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT) {
+ Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
+
+ String input =
+ "/**" + DELIMITER +
+ " *
" + DELIMITER +
+ " * setLeadingComment(\"/* traditional comment */\"); // correct" + DELIMITER +
+ " * setLeadingComment(\"missing comment delimiters\"); // wrong" + DELIMITER +
+ " * setLeadingComment(\"/* unterminated traditional comment \"); // wrong" + DELIMITER +
+ " * setLeadingComment(\"/* broken\\n traditional comment */\"); // correct" + DELIMITER +
+ " * setLeadingComment(\"// end-of-line comment\\n\"); // correct" + DELIMITER +
+ " * setLeadingComment(\"// end-of-line comment without line terminator\"); // correct" + DELIMITER +
+ " * setLeadingComment(\"// broken\\n end-of-line comment\\n\"); // wrong" + DELIMITER +
+ " *
" + DELIMITER +
+ " */";
+
+ String expected =
+ "/**" + DELIMITER +
+ " * " + DELIMITER +
+ " * setLeadingComment("/* traditional comment */"); // correct" + DELIMITER +
+ " * setLeadingComment("missing comment delimiters"); // wrong" + DELIMITER +
+ " * setLeadingComment("/* unterminated traditional comment "); // wrong" + DELIMITER +
+ " * setLeadingComment("/* broken\\n traditional comment */"); // correct" + DELIMITER +
+ " * setLeadingComment("// end-of-line comment\\n"); // correct" + DELIMITER +
+ " * setLeadingComment("// end-of-line comment without line terminator"); // correct" + DELIMITER +
+ " * setLeadingComment("// broken\\n end-of-line comment\\n"); // wrong" + DELIMITER +
+ " *
" + DELIMITER +
+ " */";
+ String result=testFormat(input, options);
+ assertEquals(expected, result);
+ }
+ }
+
/**
* @bug 228652: [formatter] New line inserted while formatting a region of a compilation unit.
* @test Insure that no new line is inserted before the formatted region
Index: src/org/eclipse/jdt/core/tests/formatter/comment/MultiLineTestCase.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/MultiLineTestCase.java,v
retrieving revision 1.10
diff -u -r1.10 MultiLineTestCase.java
--- src/org/eclipse/jdt/core/tests/formatter/comment/MultiLineTestCase.java 6 Mar 2007 04:43:20 -0000 1.10
+++ src/org/eclipse/jdt/core/tests/formatter/comment/MultiLineTestCase.java 27 Apr 2008 16:25:17 -0000
@@ -17,6 +17,7 @@
import junit.framework.Test;
+import org.eclipse.jdt.internal.formatter.DefaultCodeFormatter;
import org.eclipse.jdt.internal.formatter.comment.MultiCommentLine;
public class MultiLineTestCase extends CommentTestCase {
@@ -115,7 +116,11 @@
" * Member comment\n" +//$NON-NLS-1$
" */";//$NON-NLS-1$
String result= testFormat(input, 0, input.length(), CodeFormatter.K_MULTI_LINE_COMMENT , 2);
- String expectedOutput = "/***********************************************************************\n" +
+ String expectedOutput = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT
+ ? "/**\n" +
+ " * Member comment\n" +
+ " */"
+ : "/***********************************************************************\n" +
" * Member comment\n" +
" */";
assertEquals("Different output", expectedOutput, result);
Index: src/org/eclipse/jdt/core/tests/formatter/comment/CommentsTestSuite.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/CommentsTestSuite.java,v
retrieving revision 1.3
diff -u -r1.3 CommentsTestSuite.java
--- src/org/eclipse/jdt/core/tests/formatter/comment/CommentsTestSuite.java 23 Apr 2008 10:13:41 -0000 1.3
+++ src/org/eclipse/jdt/core/tests/formatter/comment/CommentsTestSuite.java 27 Apr 2008 16:25:15 -0000
@@ -22,16 +22,10 @@
public static Test suite() {
return new CommentsTestSuite();
}
-
- // TODO (frederic) Fix the failures on SingleLineTestCase when new formatter is enabled...
+
public CommentsTestSuite() {
addTest(MultiLineTestCase.suite());
- String newFormatter = System.getProperty("org.eclipse.jdt.core.formatter.comments.new");
- if (newFormatter == null) {
- addTest(SingleLineTestCase.suite());
- } else {
- System.out.println("SingleLineTestCase temporarily disabled as new formatter is enabled!");
- }
+ addTest(SingleLineTestCase.suite());
addTest(JavaDocTestCase.suite());
}
}
Index: src/org/eclipse/jdt/core/tests/formatter/comment/SingleLineTestCase.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/SingleLineTestCase.java,v
retrieving revision 1.5
diff -u -r1.5 SingleLineTestCase.java
--- src/org/eclipse/jdt/core/tests/formatter/comment/SingleLineTestCase.java 6 Mar 2007 04:43:20 -0000 1.5
+++ src/org/eclipse/jdt/core/tests/formatter/comment/SingleLineTestCase.java 27 Apr 2008 16:25:17 -0000
@@ -16,6 +16,7 @@
import org.eclipse.jdt.core.formatter.CodeFormatter;
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
+import org.eclipse.jdt.internal.formatter.DefaultCodeFormatter;
import org.eclipse.jdt.internal.formatter.comment.SingleCommentLine;
public class SingleLineTestCase extends CommentTestCase {
@@ -41,29 +42,44 @@
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "5"); //$NON-NLS-1$
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT, DefaultCodeFormatterConstants.FALSE);
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT, DefaultCodeFormatterConstants.FALSE);
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test\ttest" + DELIMITER + "//" + DELIMITER + "//\t\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ String expected = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT
+ ? PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + "//"+ DELIMITER + PREFIX + "test"
+ : PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER;
+ assertEquals(expected, testFormat("//test\ttest" + DELIMITER + "//" + DELIMITER + "//\t\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
}
public void testClearBlankLines2() {
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "5"); //$NON-NLS-1$
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT, DefaultCodeFormatterConstants.FALSE);
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT, DefaultCodeFormatterConstants.FALSE);
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test\t\ttest" + DELIMITER + PREFIX + DELIMITER + "//\t\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ String expected = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT
+ ? PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + "//"+ DELIMITER + PREFIX + "test"
+ : PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER;
+ assertEquals(expected, testFormat("//test\t\ttest" + DELIMITER + PREFIX + DELIMITER + "//\t\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
}
public void testClearBlankLines3() {
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "5"); //$NON-NLS-1$
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT, DefaultCodeFormatterConstants.FALSE);
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT, DefaultCodeFormatterConstants.FALSE);
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test\ttest" + DELIMITER + "//" + DELIMITER + PREFIX + "test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ String expected = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT
+ ? PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + "//"+ DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test"
+ : PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER;
+ assertEquals(expected, testFormat("//test\ttest" + DELIMITER + "//" + DELIMITER + PREFIX + "test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
}
public void testCommentBegin1() {
- assertEquals(PREFIX + "test" + DELIMITER, testFormat("//test")); //$NON-NLS-1$ //$NON-NLS-2$
+ String expected = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT
+ ? PREFIX + "test"
+ : PREFIX + "test" + DELIMITER;
+ assertEquals(expected, testFormat("//test")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testCommentBegin2() {
- assertEquals(PREFIX + "test" + DELIMITER, testFormat(PREFIX + "test")); //$NON-NLS-1$ //$NON-NLS-2$
+ String expected = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT
+ ? PREFIX + "test"
+ : PREFIX + "test" + DELIMITER;
+ assertEquals(expected, testFormat(PREFIX + "test")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testCommentBegin3() {
@@ -71,11 +87,15 @@
}
public void testCommentDelimiter1() {
- assertEquals(PREFIX + "test" + DELIMITER, testFormat("//\t\ttest " + DELIMITER + DELIMITER)); //$NON-NLS-1$ //$NON-NLS-2$
+ String expected = PREFIX + "test" + DELIMITER;
+ if (DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT) expected += DELIMITER;
+ assertEquals(expected, testFormat("//\t\ttest " + DELIMITER + DELIMITER)); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testCommentDelimiter2() {
- assertEquals(PREFIX + "test" + DELIMITER, testFormat(PREFIX + "test " + DELIMITER + DELIMITER + DELIMITER)); //$NON-NLS-1$ //$NON-NLS-2$
+ String expected = PREFIX + "test" + DELIMITER;
+ if (DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT) expected += DELIMITER ;
+ assertEquals(expected, testFormat(PREFIX + "test " + DELIMITER + DELIMITER + DELIMITER)); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testCommentNls1() {
@@ -103,30 +123,48 @@
}
public void testCommentSpace1() {
- assertEquals(PREFIX + "test test" + DELIMITER, testFormat("//test\t \t test")); //$NON-NLS-1$ //$NON-NLS-2$
+ String expected = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT
+ ? PREFIX + "test test"
+ : PREFIX + "test test" + DELIMITER;
+ assertEquals(expected, testFormat("//test\t \t test")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testCommentSpace2() {
- assertEquals(PREFIX + "test test" + DELIMITER, testFormat("//test test")); //$NON-NLS-1$ //$NON-NLS-2$
+ String expected = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT
+ ? PREFIX + "test test"
+ : PREFIX + "test test" + DELIMITER;
+ assertEquals(expected, testFormat("//test test")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testCommentSpace3() {
- assertEquals(PREFIX + "test test" + DELIMITER, testFormat(PREFIX + "test \t \t test")); //$NON-NLS-1$ //$NON-NLS-2$
+ String expected = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT
+ ? PREFIX + "test test"
+ : PREFIX + "test test" + DELIMITER;
+ assertEquals(expected, testFormat(PREFIX + "test \t \t test")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testCommentWrapping1() {
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "5"); //$NON-NLS-1$
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ String expected = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT
+ ? PREFIX + "test" + DELIMITER + PREFIX + "test"
+ : PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER;
+ assertEquals(expected, testFormat("//test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testCommentWrapping2() {
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "1"); //$NON-NLS-1$
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ String expected = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT
+ ? PREFIX + "test" + DELIMITER + PREFIX + "test"
+ : PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER;
+ assertEquals(expected, testFormat("//test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testCommentWrapping3() {
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "32"); //$NON-NLS-1$
- assertEquals(PREFIX + "test test" + DELIMITER, testFormat("//test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ String expected = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT
+ ? PREFIX + "test test"
+ : PREFIX + "test test" + DELIMITER;
+ assertEquals(expected, testFormat("//test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testCommentWrapping4() {
@@ -148,38 +186,59 @@
public void testHeaderComment1() {
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HEADER, DefaultCodeFormatterConstants.FALSE);
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "12"); //$NON-NLS-1$
- assertEquals(PREFIX + "test test" + DELIMITER + PREFIX + "test test" + DELIMITER + PREFIX + "test test" + DELIMITER, testFormat("//test\t\t\t\ttest" + DELIMITER + PREFIX + "test test test test")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ String expected = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT
+ ? PREFIX + "test test" + DELIMITER + PREFIX + "test test" + DELIMITER + PREFIX + "test test"
+ : PREFIX + "test test" + DELIMITER + PREFIX + "test test" + DELIMITER + PREFIX + "test test" + DELIMITER;
+ assertEquals(expected, testFormat("//test\t\t\t\ttest" + DELIMITER + PREFIX + "test test test test")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
}
public void testHeaderComment2() {
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HEADER, DefaultCodeFormatterConstants.FALSE);
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "24"); //$NON-NLS-1$
- assertEquals(PREFIX + "test test test test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test\t\t\t" + DELIMITER + PREFIX + "test test test test" + DELIMITER)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ String expected = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT
+ ? "// test" + DELIMITER + PREFIX + "test test test test" + DELIMITER
+ : PREFIX + "test test test test" + DELIMITER + PREFIX + "test" + DELIMITER;
+ assertEquals(expected, testFormat("//test\t\t\t" + DELIMITER + PREFIX + "test test test test" + DELIMITER)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
public void testIllegalLineLength1() {
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "1"); //$NON-NLS-1$
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ String expected =PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER;
+ if (DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT) expected = expected.substring(0, expected.length()-DELIMITER.length());
+ assertEquals(expected, testFormat("//test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testIllegalLineLength2() {
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "-16"); //$NON-NLS-1$
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat(PREFIX + "\t\t test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ String expected = PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER;
+ if (DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT) expected = expected.substring(0, expected.length()-DELIMITER.length());
+ assertEquals(expected, testFormat(PREFIX + "\t\t test\ttest")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testMultipleComments1() {
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "5"); //$NON-NLS-1$
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test test" + DELIMITER + PREFIX + "test test test test")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
+ String expected = PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER;
+ if (DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT) expected = expected.substring(0, expected.length()-DELIMITER.length());
+ assertEquals(expected, testFormat("//test test" + DELIMITER + PREFIX + "test test test test")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
}
public void testMultipleComments2() {
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "12"); //$NON-NLS-1$
- assertEquals(PREFIX + "test test" + DELIMITER + PREFIX + "test test" + DELIMITER + PREFIX + "test test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("//test test\ttest" + DELIMITER + PREFIX + DELIMITER + PREFIX + "test test test test")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ String expected = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT
+ ? "// test test" + DELIMITER +
+ "// test" + DELIMITER +
+ "//" + DELIMITER +
+ "// test test" + DELIMITER +
+ "// test test"
+ : PREFIX + "test test" + DELIMITER + PREFIX + "test test" + DELIMITER + PREFIX + "test test" + DELIMITER + PREFIX + "test" + DELIMITER;
+ assertEquals(expected, testFormat("//test test\ttest" + DELIMITER + PREFIX + DELIMITER + PREFIX + "test test test test")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
}
public void testMultipleComments3() {
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "11"); //$NON-NLS-1$
- assertEquals(PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER, testFormat("// test\t\t\ttest\ttest" + DELIMITER + PREFIX + "test test test test")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
+ String expected = PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER + PREFIX + "test" + DELIMITER;
+ if (DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT) expected = expected.substring(0, expected.length()-DELIMITER.length());
+ assertEquals(expected, testFormat("// test\t\t\ttest\ttest" + DELIMITER + PREFIX + "test test test test")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
}
public void testIndentedComment1() {
@@ -208,13 +267,14 @@
public void testNoChange1() {
String content= PREFIX;
- assertEquals(content, testFormat(content));
+ String expected = DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT ? "//" : content;
+ assertEquals(expected, testFormat(content));
}
public void testNoFormat1() {
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_LINE_COMMENT, DefaultCodeFormatterConstants.FALSE);
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "1");
- String content= PREFIX + "test test";
+ String content = PREFIX + "test test";
assertEquals(content, testFormat(content));
}
public void _test109581() {
Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X19.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X19.java,v
retrieving revision 1.1
diff -u -r1.1 X19.java
--- workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X19.java 27 Apr 2008 10:01:23 -0000 1.1
+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X19.java 27 Apr 2008 16:25:17 -0000
@@ -17,18 +17,18 @@
* source string. It includes entries for comments of all kinds (line,
* block, and doc), arranged in order of increasing source position.
*
null
, and
- * {@link ASTNode#getRoot() getRoot()} will return the comment node itself,
- * indicating that these comment nodes are not directly connected to the AST
- * for the compilation unit. The {@link Comment#getAlternateRoot
- * Comment.getAlternateRoot} method provides a way to navigate from a
- * comment to its compilation unit.
+ * Note on comment parenting: The {@link ASTNode#getParent() getParent()} of
+ * a doc comment associated with a body declaration is the body declaration
+ * node; for these comment nodes {@link ASTNode#getRoot() getRoot()} will
+ * return the compilation unit (assuming an unmodified AST) reflecting the
+ * fact that these nodes are property located in the AST for the compilation
+ * unit. However, for other comment nodes, {@link ASTNode#getParent()
+ * getParent()} will return null
, and {@link ASTNode#getRoot()
+ * getRoot()} will return the comment node itself, indicating that these
+ * comment nodes are not directly connected to the AST for the compilation
+ * unit. The {@link Comment#getAlternateRoot Comment.getAlternateRoot}
+ * method provides a way to navigate from a comment to its compilation unit.
+ *
* * A note on visitors: The only comment nodes that will be visited when * visiting a compilation unit are the doc comments parented by body Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X18.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X18.java,v retrieving revision 1.1 diff -u -r1.1 X18.java --- workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X18.java 27 Apr 2008 10:01:23 -0000 1.1 +++ workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X18.java 27 Apr 2008 16:25:17 -0000 @@ -43,10 +43,10 @@ *
** Lexical or syntax errors detected while parsing can result in a result - * node being marked as {@link ASTNode#MALFORMED MALFORMED} . In more - * severe failure cases where the parser is unable to recognize the input, - * this method returns a {@link CompilationUnit CompilationUnit} node with - * at least the compiler messages. + * node being marked as {@link ASTNode#MALFORMED MALFORMED} . In more severe + * failure cases where the parser is unable to recognize the input, this + * method returns a {@link CompilationUnit CompilationUnit} node with at + * least the compiler messages. *
** Each node in the subtree (other than the contrived nodes) carries source Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X18.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X18.java,v retrieving revision 1.1 diff -u -r1.1 X18.java --- workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X18.java 27 Apr 2008 10:01:24 -0000 1.1 +++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X18.java 27 Apr 2008 16:25:17 -0000 @@ -43,10 +43,10 @@ *
** Lexical or syntax errors detected while parsing can result in a result - * node being marked as {@link ASTNode#MALFORMED MALFORMED} . In more - * severe failure cases where the parser is unable to recognize the input, - * this method returns a {@link CompilationUnit CompilationUnit} node with - * at least the compiler messages. + * node being marked as {@link ASTNode#MALFORMED MALFORMED} . In more severe + * failure cases where the parser is unable to recognize the input, this + * method returns a {@link CompilationUnit CompilationUnit} node with at + * least the compiler messages. *
** Each node in the subtree (other than the contrived nodes) carries source Index: src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsMassiveTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsMassiveTests.java,v retrieving revision 1.8 diff -u -r1.8 FormatterCommentsMassiveTests.java --- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsMassiveTests.java 27 Apr 2008 10:01:23 -0000 1.8 +++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsMassiveTests.java 27 Apr 2008 16:25:15 -0000 @@ -124,16 +124,16 @@ *
null
, and
- * {@link ASTNode#getRoot() getRoot()} will return the comment node itself,
- * indicating that these comment nodes are not directly connected to the AST
- * for the compilation unit. The {@link Comment#getAlternateRoot
- * Comment.getAlternateRoot} method provides a way to navigate from a
- * comment to its compilation unit.
+ * Note on comment parenting: The {@link ASTNode#getParent() getParent()} of
+ * a doc comment associated with a body declaration is the body declaration
+ * node; for these comment nodes {@link ASTNode#getRoot() getRoot()} will
+ * return the compilation unit (assuming an unmodified AST) reflecting the
+ * fact that these nodes are property located in the AST for the compilation
+ * unit. However, for other comment nodes, {@link ASTNode#getParent()
+ * getParent()} will return null
, and {@link ASTNode#getRoot()
+ * getRoot()} will return the comment node itself, indicating that these
+ * comment nodes are not directly connected to the AST for the compilation
+ * unit. The {@link Comment#getAlternateRoot Comment.getAlternateRoot}
+ * method provides a way to navigate from a comment to its compilation unit.
+ *
* * A note on visitors: The only comment nodes that will be visited when * visiting a compilation unit are the doc comments parented by body Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X18.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X18.java,v retrieving revision 1.1 diff -u -r1.1 X18.java --- workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X18.java 27 Apr 2008 10:01:23 -0000 1.1 +++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X18.java 27 Apr 2008 16:25:17 -0000 @@ -43,10 +43,10 @@ *
** Lexical or syntax errors detected while parsing can result in a result - * node being marked as {@link ASTNode#MALFORMED MALFORMED} . In more - * severe failure cases where the parser is unable to recognize the input, - * this method returns a {@link CompilationUnit CompilationUnit} node with - * at least the compiler messages. + * node being marked as {@link ASTNode#MALFORMED MALFORMED} . In more severe + * failure cases where the parser is unable to recognize the input, this + * method returns a {@link CompilationUnit CompilationUnit} node with at + * least the compiler messages. *
*
* Each node in the subtree (other than the contrived nodes) carries source
Index: workspace/Formatter/test553/A_in.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/workspace/Formatter/test553/A_in.java,v
retrieving revision 1.1
diff -u -r1.1 A_in.java
--- workspace/Formatter/test553/A_in.java 28 Mar 2005 21:15:48 -0000 1.1
+++ workspace/Formatter/test553/A_in.java 27 Apr 2008 16:25:17 -0000
@@ -1 +1 @@
-// This is a really long single line comment that should be wrapped on two lines once it is formatted
\ No newline at end of file
+// This is a really long single line comment that should be wrapped on two lines once it is formatted
Index: workspace/FormatterJavadoc/test/tags/others/out/default/X03.java
===================================================================
RCS file: workspace/FormatterJavadoc/test/tags/others/out/default/X03.java
diff -N workspace/FormatterJavadoc/test/tags/others/out/default/X03.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ workspace/FormatterJavadoc/test/tags/others/out/default/X03.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,10 @@
+package test.tags.others;
+
+public interface X03 {
+
+ /**
+ * A complex type can have one root compositor. @ return root complex type
+ * compositor
+ */
+ int foo();
+}
Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X21.java
===================================================================
RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X21.java
diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X21.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X21.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,65 @@
+package test.wksp.eclipse;
+
+public class X21 {
+
+ /**
+ * Returns a search pattern based on a given string pattern. The string
+ * patterns support '*' wild-cards. The remaining parameters are used to
+ * narrow down the type of expected results.
+ * Examples:
+ *
Object
:
+ * createSearchPattern("Object", TYPE, REFERENCES, false);
Object()
+ * constructor:
+ * createSearchPattern("java.lang.Object()", CONSTRUCTOR, REFERENCES, true);
+ * java.lang.Runnable
:
+ * createSearchPattern("java.lang.Runnable", TYPE, IMPLEMENTORS, true);
+ * IJavaSearchConstants.CLASS
: only look for classesIJavaSearchConstants.INTERFACE
: only look for
+ * interfacesIJavaSearchConstants.TYPE
: look for both classes and
+ * interfacesIJavaSearchConstants.FIELD
: look for fieldsIJavaSearchConstants.METHOD
: look for methodsIJavaSearchConstants.CONSTRUCTOR
: look for
+ * constructorsIJavaSearchConstants.PACKAGE
: look for packagesIJavaSearchConstants.DECLARATIONS
: will search
+ * declarations matching with the corresponding element. In case the element
+ * is a method, declarations of matching methods in subtypes will also be
+ * found, allowing to find declarations of abstract methods, etc.IJavaSearchConstants.REFERENCES
: will search
+ * references to the given element.IJavaSearchConstants.ALL_OCCURRENCES
: will search for
+ * either declarations or references as specified above.IJavaSearchConstants.IMPLEMENTORS
: for interface, will
+ * find all types which implements a given interface.null
if the string pattern is ill-formed.
+ * @deprecated Use {@link SearchPattern#createPattern(String, int, int, int)
+ * } instead.
+ */
+ void createSearchPattern() {
+ }
+}
Index: workspace/FormatterJavadoc/test/tags/others/X03.java
===================================================================
RCS file: workspace/FormatterJavadoc/test/tags/others/X03.java
diff -N workspace/FormatterJavadoc/test/tags/others/X03.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ workspace/FormatterJavadoc/test/tags/others/X03.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,10 @@
+package test.tags.others;
+
+public interface X03 {
+
+/**
+ * A complex type can have one root compositor.
+ @ return root complex type compositor
+ */
+int foo();
+}
Index: workspace/FormatterJavadoc/test/comments/line/X06.java
===================================================================
RCS file: workspace/FormatterJavadoc/test/comments/line/X06.java
diff -N workspace/FormatterJavadoc/test/comments/line/X06.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ workspace/FormatterJavadoc/test/comments/line/X06.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,15 @@
+package test.comments.line;
+
+public class X06 {
+
+ String foo() {
+// // Move cursor on to the left if the proposal ends with '}'
+ String str;
+ // XXX: currently there's no smartness: position the cursor after the proposal
+// if (relativeOffset > 0 && proposal.charAt(relativeOffset - 1) == '}')
+// relativeOffset--;
+
+ str = toString();
+ return str;
+ }
+}
Index: workspace/FormatterJavadoc/test/wksp/eclipse/X21.java
===================================================================
RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/X21.java
diff -N workspace/FormatterJavadoc/test/wksp/eclipse/X21.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ workspace/FormatterJavadoc/test/wksp/eclipse/X21.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,50 @@
+package test.wksp.eclipse;
+
+public class X21 {
+
+ /**
+ * Returns a search pattern based on a given string pattern. The string patterns support '*' wild-cards.
+ * The remaining parameters are used to narrow down the type of expected results.
+ *
+ * Object
:
+ * createSearchPattern("Object", TYPE, REFERENCES, false);
Object()
constructor:
+ * createSearchPattern("java.lang.Object()", CONSTRUCTOR, REFERENCES, true);
java.lang.Runnable
:
+ * createSearchPattern("java.lang.Runnable", TYPE, IMPLEMENTORS, true);
IJavaSearchConstants.CLASS
: only look for classesIJavaSearchConstants.INTERFACE
: only look for interfacesIJavaSearchConstants.TYPE
: look for both classes and interfacesIJavaSearchConstants.FIELD
: look for fieldsIJavaSearchConstants.METHOD
: look for methodsIJavaSearchConstants.CONSTRUCTOR
: look for constructorsIJavaSearchConstants.PACKAGE
: look for packagesIJavaSearchConstants.DECLARATIONS
: will search declarations matching with the corresponding
+ * element. In case the element is a method, declarations of matching methods in subtypes will also
+ * be found, allowing to find declarations of abstract methods, etc.IJavaSearchConstants.REFERENCES
: will search references to the given element.IJavaSearchConstants.ALL_OCCURRENCES
: will search for either declarations or references as specified
+ * above.IJavaSearchConstants.IMPLEMENTORS
: for interface, will find all types which implements a given interface.null
if the string pattern is ill-formed.
+ * @deprecated Use {@link SearchPattern#createPattern(String, int, int, int)} instead.
+ */
+ void createSearchPattern() {
+ }
+}
Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X21.java
===================================================================
RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X21.java
diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X21.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X21.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,69 @@
+package test.wksp.eclipse;
+
+public class X21 {
+
+ /**
+ * Returns a search pattern based on a given string pattern. The string
+ * patterns support '*' wild-cards. The remaining parameters are used to
+ * narrow down the type of expected results. Object
:
+ * createSearchPattern("Object", TYPE, REFERENCES, false);
Object()
+ * constructor:
+ * createSearchPattern("java.lang.Object()", CONSTRUCTOR, REFERENCES, true);
+ * java.lang.Runnable
:
+ * createSearchPattern("java.lang.Runnable", TYPE, IMPLEMENTORS, true);
+ * IJavaSearchConstants.CLASS
: only look for classes
+ * IJavaSearchConstants.INTERFACE
: only look for
+ * interfacesIJavaSearchConstants.TYPE
: look for both classes
+ * and interfacesIJavaSearchConstants.FIELD
: look for fieldsIJavaSearchConstants.METHOD
: look for methods
+ * IJavaSearchConstants.CONSTRUCTOR
: look for
+ * constructorsIJavaSearchConstants.PACKAGE
: look for packages
+ * IJavaSearchConstants.DECLARATIONS
: will search
+ * declarations matching with the corresponding element. In case the
+ * element is a method, declarations of matching methods in subtypes
+ * will also be found, allowing to find declarations of abstract
+ * methods, etc.IJavaSearchConstants.REFERENCES
: will search
+ * references to the given element.IJavaSearchConstants.ALL_OCCURRENCES
: will search
+ * for either declarations or references as specified above.IJavaSearchConstants.IMPLEMENTORS
: for interface,
+ * will find all types which implements a given interface.null
if the string pattern is ill-formed.
+ * @deprecated Use {@link SearchPattern#createPattern(String, int, int, int)
+ * } instead.
+ */
+ void createSearchPattern() {
+ }
+}
Index: workspace/FormatterJavadoc/test/comments/line/out/default/X06.java
===================================================================
RCS file: workspace/FormatterJavadoc/test/comments/line/out/default/X06.java
diff -N workspace/FormatterJavadoc/test/comments/line/out/default/X06.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ workspace/FormatterJavadoc/test/comments/line/out/default/X06.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,16 @@
+package test.comments.line;
+
+public class X06 {
+
+ String foo() {
+ // // Move cursor on to the left if the proposal ends with '}'
+ String str;
+ // XXX: currently there's no smartness: position the cursor after the
+ // proposal
+ // if (relativeOffset > 0 && proposal.charAt(relativeOffset - 1) == '}')
+ // relativeOffset--;
+
+ str = toString();
+ return str;
+ }
+}
Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X21.java
===================================================================
RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X21.java
diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X21.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X21.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,67 @@
+package test.wksp.eclipse;
+
+public class X21 {
+
+ /**
+ * Returns a search pattern based on a given string pattern. The string
+ * patterns support '*' wild-cards. The remaining parameters are used to
+ * narrow down the type of expected results. Object
:
+ * createSearchPattern("Object", TYPE, REFERENCES, false);
Object()
+ * constructor:
+ * createSearchPattern("java.lang.Object()", CONSTRUCTOR, REFERENCES, true);
+ * java.lang.Runnable
:
+ * createSearchPattern("java.lang.Runnable", TYPE, IMPLEMENTORS, true);
+ * IJavaSearchConstants.CLASS
: only look for classes
+ * IJavaSearchConstants.INTERFACE
: only look for
+ * interfacesIJavaSearchConstants.TYPE
: look for both classes and
+ * interfacesIJavaSearchConstants.FIELD
: look for fieldsIJavaSearchConstants.METHOD
: look for methodsIJavaSearchConstants.CONSTRUCTOR
: look for
+ * constructorsIJavaSearchConstants.PACKAGE
: look for packagesIJavaSearchConstants.DECLARATIONS
: will search
+ * declarations matching with the corresponding element. In case the
+ * element is a method, declarations of matching methods in subtypes will
+ * also be found, allowing to find declarations of abstract methods, etc.
+ * IJavaSearchConstants.REFERENCES
: will search
+ * references to the given element.IJavaSearchConstants.ALL_OCCURRENCES
: will search for
+ * either declarations or references as specified above.IJavaSearchConstants.IMPLEMENTORS
: for interface,
+ * will find all types which implements a given interface.null
if the string pattern is ill-formed.
+ * @deprecated Use {@link SearchPattern#createPattern(String, int, int, int)
+ * } instead.
+ */
+ void createSearchPattern() {
+ }
+}