Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 98655 Details for
Bug 230230
[formatter] New comment formatter does not handle properly all scanner exceptions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v00.txt (text/plain), 81.48 KB, created by
Frederic Fusier
on 2008-05-05 12:05:37 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2008-05-05 12:05:37 EDT
Size:
81.48 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X06.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X06.java,v >retrieving revision 1.1 >diff -u -r1.1 X06.java >--- workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X06.java 23 Apr 2008 22:29:05 -0000 1.1 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X06.java 5 May 2008 16:01:55 -0000 >@@ -7,8 +7,7 @@ > * > * @param projectGroup > * the parent composite >- * @param boolean >- * - the initial enabled state of the widgets created >+ * @param boolean - the initial enabled state of the widgets created > */ > void foo(Object projectGroup, boolean enabled) { > } >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.3 >diff -u -r1.3 X18.java >--- workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X18.java 28 Apr 2008 16:29:56 -0000 1.3 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X18.java 5 May 2008 16:01:55 -0000 >@@ -28,8 +28,8 @@ > * <ul> > * <li>{@linkplain CompilationUnit#lineNumber(int) Line number map}. Line > * numbers start at 1 and only cover the subrange scanned ( >- * <code>source[offset]</code> through <code>source[offset+length-1]</code>). >- * </li> >+ * <code>source[offset]</code> through <code>source[offset+length-1]</code> >+ * ).</li> > * <li>{@linkplain CompilationUnit#getMessages() Compiler messages} and > * {@linkplain CompilationUnit#getProblems() detailed problem reports}. > * Character positions are relative to the start of <code>source</code>; >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X16.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X16.java,v >retrieving revision 1.1 >diff -u -r1.1 X16.java >--- workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X16.java 27 Apr 2008 10:01:23 -0000 1.1 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X16.java 5 May 2008 16:01:55 -0000 >@@ -8,7 +8,8 @@ > * constructor. > * > * @param methodBinding >- * org.eclipse.jdt.internal.compiler.nameloopkup.SyntheticAccessMethodBinding >+ * org.eclipse.jdt.internal.compiler.nameloopkup. >+ * SyntheticAccessMethodBinding > */ > void foo(Object methodBinding) { > } >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.3 >diff -u -r1.3 X18.java >--- workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X18.java 28 Apr 2008 16:29:56 -0000 1.3 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X18.java 5 May 2008 16:01:55 -0000 >@@ -28,8 +28,8 @@ > * <ul> > * <li>{@linkplain CompilationUnit#lineNumber(int) Line number map}. Line > * numbers start at 1 and only cover the subrange scanned ( >- * <code>source[offset]</code> through <code>source[offset+length-1]</code>). >- * </li> >+ * <code>source[offset]</code> through <code>source[offset+length-1]</code> >+ * ).</li> > * <li>{@linkplain CompilationUnit#getMessages() Compiler messages} and > * {@linkplain CompilationUnit#getProblems() detailed problem reports}. > * Character positions are relative to the start of <code>source</code>; >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X16.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X16.java,v >retrieving revision 1.1 >diff -u -r1.1 X16.java >--- workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X16.java 27 Apr 2008 10:01:24 -0000 1.1 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X16.java 5 May 2008 16:01:55 -0000 >@@ -8,7 +8,8 @@ > * constructor. > * > * @param methodBinding >- * org.eclipse.jdt.internal.compiler.nameloopkup.SyntheticAccessMethodBinding >+ * org.eclipse.jdt.internal.compiler.nameloopkup. >+ * SyntheticAccessMethodBinding > */ > void foo(Object methodBinding) { > } >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X06.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X06.java,v >retrieving revision 1.1 >diff -u -r1.1 X06.java >--- workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X06.java 23 Apr 2008 22:29:05 -0000 1.1 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X06.java 5 May 2008 16:01:55 -0000 >@@ -7,8 +7,7 @@ > * > * @param projectGroup > * the parent composite >- * @param boolean >- * - the initial enabled state of the widgets created >+ * @param boolean - the initial enabled state of the widgets created > */ > void foo(Object projectGroup, boolean enabled) { > } >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.11 >diff -u -r1.11 FormatterCommentsMassiveTests.java >--- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsMassiveTests.java 29 Apr 2008 14:55:05 -0000 1.11 >+++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsMassiveTests.java 5 May 2008 16:01:55 -0000 >@@ -18,6 +18,7 @@ > import java.util.HashMap; > import java.util.List; > import java.util.Map; >+import java.util.StringTokenizer; > > import junit.framework.AssertionFailedError; > import junit.framework.ComparisonFailure; >@@ -29,9 +30,11 @@ > import org.eclipse.jdt.core.tests.model.ModelTestsUtil; > import org.eclipse.jdt.core.tests.util.Util; > import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; > import org.eclipse.jdt.internal.compiler.parser.Scanner; >+import org.eclipse.jdt.internal.compiler.parser.ScannerHelper; > import org.eclipse.jdt.internal.core.util.CodeSnippetParsingUtil; > import org.eclipse.jdt.internal.core.util.SimpleDocument; > import org.eclipse.jdt.internal.formatter.DefaultCodeFormatter; >@@ -124,17 +127,17 @@ > * <ul> > * <li>3.0 performance workspace (9951 units):<ul> > * <li>0 error</li> >- * <li>14 failures</li> >+ * <li>5 failures</li> > * <li>8 failures due to old formatter</li> >- * <li>721 files have different lines leading spaces</li> >- * <li>14 files have different spaces</li> >+ * <li>720 files have different lines leading spaces</li> >+ * <li>17 files have different spaces</li> > * </ul></li> > * <li>ganymede M6a workspace (26336 units):<ul> > * <li>0 error</li> >- * <li>49 files has still different output while reformatting!</li> >- * <li>3 failures due to old formatter</li> >- * <li>1470 files have different line leading spaces when reformatting!</li> >- * <li>21 files have different spaces when reformatting!</li> >+ * <li>21 files has still different output while reformatting!</li> >+ * <li>17 failures due to old formatter</li> >+ * <li>1469 files have different line leading spaces when reformatting!</li> >+ * <li>25 files have different spaces when reformatting!</li> > * </ul></li> > * </ul> > */ >@@ -148,22 +151,62 @@ > List leadingWhitespacesFailures = new ArrayList(); > List whitespacesFailures= new ArrayList(); > boolean hasSpaceFailure; >+ private final static boolean DEBUG_TESTS = "true".equals(System.getProperty("debugTests")); > private final static String DIR = System.getProperty("dir"); //$NON-NLS-1$ > private final static boolean COMPARE = DefaultCodeFormatterConstants.TRUE.equals(System.getProperty("compare")); //$NON-NLS-1$ >- private final static boolean IGNORE_WHITESPACES = "all".equals(System.getProperty("ignoreWhitespaces")); //$NON-NLS-1$ >- private final static boolean IGNORE_LINES_LEADING_WHITESPACES = "linesLeading".equals(System.getProperty("ignoreWhitespaces")); //$NON-NLS-1$ >+ private final static int IGNORE_SPACES; >+ private final static int ALL_SPACES = 1; // ignore all spaces >+ private final static int LINES_LEADING_SPACES = 2; // ignore all spaces at the beginning of all lines >+ private final static int ALL_COMMENTS_SPACES = 3; // ignore all spaces inside all comments >+ private final static int ALL_COMMENTS_LINES_LEADING_SPACES = 4; // ignore all spaces at the beginning of all comments lines >+ static { >+ String ignoreSpaces = System.getProperty("ignoreSpaces"); //$NON-NLS-1$ >+ int filterValue; >+ if ("all".equals(ignoreSpaces)) { >+ filterValue = ALL_SPACES; >+ } else if ("linesLeading".equals(ignoreSpaces)) { >+ filterValue = LINES_LEADING_SPACES; >+ } else if ("comments".equals(ignoreSpaces)) { >+ filterValue = ALL_COMMENTS_SPACES; >+ } else if ("commentsLinesLeading".equals(ignoreSpaces)) { >+ filterValue = ALL_COMMENTS_LINES_LEADING_SPACES; >+ } else { >+ filterValue = 0; // no filter >+ } >+ IGNORE_SPACES = filterValue; >+ } > private final static int FORMAT_REPEAT = Integer.parseInt(System.getProperty("repeat", "2")); //$NON-NLS-1$ > private static final int MAX_FAILURES = Integer.parseInt(System.getProperty("maxFailures", "100")); // Max failures using string comparison > private static boolean ASSERT_EQUALS_STRINGS = MAX_FAILURES > 0; >- private final static String[] EXPECTED_FAILURES = { >- "org\\eclipse\\jdt\\internal\\compiler\\ast\\QualifiedNameReference.java", >- "org\\eclipse\\jdt\\internal\\eval\\CodeSnippetSingleNameReference.java", >- "org\\eclipse\\jdt\\internal\\core\\DeltaProcessor.java", >- "org\\eclipse\\jdt\\internal\\core\\JavaProject.java", >- "org\\eclipse\\jdt\\internal\\core\\search\\indexing\\IndexManager.java", >- "org\\eclipse\\team\\internal\\ccvs\\ui\\AnnotateView.java", >- "org\\eclipse\\team\\internal\\ccvs\\ui\\HistoryView.java", >- "org\\eclipse\\team\\internal\\ccvs\\ui\\wizards\\UpdateWizard.java", >+ private final static String[] EXPECTED_FAILURES = DIR.indexOf("ganymede") < 0 >+ ? new String[] { >+ "org\\eclipse\\jdt\\internal\\compiler\\ast\\QualifiedNameReference.java", >+ "org\\eclipse\\jdt\\internal\\eval\\CodeSnippetSingleNameReference.java", >+ "org\\eclipse\\jdt\\internal\\core\\DeltaProcessor.java", >+ "org\\eclipse\\jdt\\internal\\core\\JavaProject.java", >+ "org\\eclipse\\jdt\\internal\\core\\search\\indexing\\IndexManager.java", >+ "org\\eclipse\\team\\internal\\ccvs\\ui\\AnnotateView.java", >+ "org\\eclipse\\team\\internal\\ccvs\\ui\\HistoryView.java", >+ "org\\eclipse\\team\\internal\\ccvs\\ui\\wizards\\UpdateWizard.java", >+ } >+ : new String[] { >+ "org\\eclipse\\jdt\\core\\JavaCore.java", >+ "org\\eclipse\\jdt\\internal\\codeassist\\CompletionEngine.java", >+ "org\\eclipse\\jdt\\internal\\codeassist\\SelectionEngine.java", >+ "org\\eclipse\\jdt\\internal\\compiler\\ast\\QualifiedNameReference.java", >+ "org\\eclipse\\jdt\\internal\\compiler\\ast\\SingleNameReference.java", >+ "org\\eclipse\\jdt\\internal\\eval\\CodeSnippetSingleNameReference.java", >+ "org\\eclipse\\jdt\\internal\\compiler\\batch\\Main.java", >+ "org\\eclipse\\jdt\\internal\\compiler\\lookup\\ParameterizedMethodBinding.java", >+ "org\\eclipse\\jdt\\internal\\core\\CompilationUnit.java", >+ "org\\eclipse\\jdt\\internal\\core\\ExternalJavaProject.java", >+ "org\\eclipse\\jdt\\internal\\core\\hierarchy\\HierarchyResolver.java", >+ "org\\eclipse\\jdt\\internal\\core\\hierarchy\\TypeHierarchy.java", >+ "org\\eclipse\\jdt\\internal\\core\\search\\indexing\\IndexAllProject.java", >+ "org\\eclipse\\jdt\\internal\\core\\search\\JavaSearchScope.java", >+ "org\\eclipse\\jdt\\internal\\eval\\EvaluationContext.java", >+ "org\\eclipse\\jdt\\internal\\ui\\text\\javadoc\\JavadocContentAccess2.java", >+ "org\\eclipse\\team\\internal\\ccvs\\ui\\mappings\\WorkspaceSubscriberContext.java", > }; > static { > // Sort expected failures to allow binary search >@@ -304,22 +347,45 @@ > } > } > catch (ComparisonFailure cf) { >- if (IGNORE_WHITESPACES) { >- String trimmedExpected = ModelTestsUtil.removeWhiteSpace(expected); >- String trimmedActual= ModelTestsUtil.removeWhiteSpace(actual); >- if (trimmedExpected.equals(trimmedActual)) { >- this.whitespacesFailures.add(this.path); >- return; >+ if (COMPARE) { >+ String trimmedExpected; >+ String trimmedActual; >+ switch (IGNORE_SPACES) { >+ case ALL_SPACES: >+ trimmedExpected = ModelTestsUtil.removeWhiteSpace(expected); >+ trimmedActual= ModelTestsUtil.removeWhiteSpace(actual); >+ if (trimmedExpected.equals(trimmedActual)) { >+ this.whitespacesFailures.add(this.path); >+ return; >+ } >+ break; >+ case LINES_LEADING_SPACES: >+ trimmedExpected = ModelTestsUtil.trimLinesLeadingWhitespaces(expected); >+ trimmedActual= ModelTestsUtil.trimLinesLeadingWhitespaces(actual); >+ if (trimmedExpected.equals(trimmedActual)) { >+ this.leadingWhitespacesFailures.add(this.path); >+ return; >+ } >+ trimmedExpected = ModelTestsUtil.removeWhiteSpace(expected); >+ trimmedActual= ModelTestsUtil.removeWhiteSpace(actual); >+ if (trimmedExpected.equals(trimmedActual)) { >+ this.whitespacesFailures.add(this.path); >+ return; >+ } >+ break; >+ default: >+ trimmedExpected = filterFormattingInComments(expected); >+ trimmedActual= filterFormattingInComments(actual); >+ if (trimmedExpected.equals(trimmedActual)) { >+ this.whitespacesFailures.add(this.path); >+ return; >+ } >+ break; > } >- } else if (IGNORE_LINES_LEADING_WHITESPACES) { >- String trimmedExpected = ModelTestsUtil.trimLinesLeadingWhitespaces(expected); >- String trimmedActual= ModelTestsUtil.trimLinesLeadingWhitespaces(actual); >- if (trimmedExpected.equals(trimmedActual)) { >- this.leadingWhitespacesFailures.add(this.path); >- return; >+ if (DEBUG_TESTS && ASSERT_EQUALS_STRINGS) { >+ assertEquals(message, trimmedExpected, trimmedActual); > } > } >- if (isExpectedFailure()) return; > this.failures.add(this.path); > ASSERT_EQUALS_STRINGS = this.failures.size() < MAX_FAILURES; > throw cf; >@@ -360,6 +426,8 @@ > Scanner scanner = new Scanner(true, true, false/*nls*/, ClassFileConstants.JDK1_4/*sourceLevel*/, null/*taskTags*/, null/*taskPriorities*/, true/*taskCaseSensitive*/); > CodeSnippetParsingUtil codeSnippetParsingUtil = new CodeSnippetParsingUtil(); > CompilationUnitDeclaration compilationUnitDeclaration = codeSnippetParsingUtil.parseCompilationUnit(source.toCharArray(), getDefaultCompilerOptions(), true); >+ final TypeDeclaration[] types = compilationUnitDeclaration.types; >+ int headerEndPosition = types == null ? compilationUnitDeclaration.sourceEnd : types[0].declarationSourceStart; > scanner.setSource(source.toCharArray()); > scanner.lineEnds = codeSnippetParsingUtil.recordedParsingInformation.lineEnds; > int[][] commentsPositions = compilationUnitDeclaration.comments; >@@ -379,8 +447,10 @@ > commentKind = CodeFormatter.K_SINGLE_LINE_COMMENT; > } > } >- int indentationLevel = getIndentationLevel(scanner, commentStart); >- formattedComments[i] = runFormatter(codeFormatter, source.substring(commentStart, commentEnd), commentKind, indentationLevel, 0, commentEnd - commentStart, LINE_SEPARATOR); >+ if (commentStart >= headerEndPosition) { >+ int indentationLevel = getIndentationLevel(scanner, commentStart); >+ formattedComments[i] = runFormatter(codeFormatter, source.substring(commentStart, commentEnd), commentKind, indentationLevel, 0, commentEnd - commentStart, LINE_SEPARATOR); >+ } > } > SimpleDocument document = new SimpleDocument(source); > for (int i=length-1; i>=0; i--) { >@@ -405,6 +475,170 @@ > DefaultCodeFormatter.ENABLE_NEW_COMMENTS_FORMAT = enableNewCommentFormatter; > } > } >+private String filterFormattingInComments(String input) { >+ StringTokenizer tokenizer = new StringTokenizer(input, "\r\n\f"); >+ StringBuffer buffer = new StringBuffer(); >+ boolean skipToken = false; >+ String line = null; >+ lineLoop: while (tokenizer.hasMoreTokens()) { >+ if (!skipToken) { >+ line = tokenizer.nextToken(); >+ } >+ skipToken = false; >+ int length = line.length(); >+ int lineStart = 0; >+ if (length > 0) { >+ // Trim leading whitespaces >+ if (IGNORE_SPACES > 0) { >+ while (lineStart < length && ScannerHelper.isWhitespace(line.charAt(lineStart))) { >+ lineStart++; >+ } >+ } >+ // Search if a comment starts >+ int commentKind = 0; >+ int idx = line.indexOf('/', lineStart); >+ if (idx >= 0 && (idx+1) < length) { >+ idx++; >+ char ch = line.charAt(idx++); >+ switch (ch) { >+ case '/': >+ commentKind = 1; // line comment >+ break; >+ case '*': >+ commentKind = 2; // block comment >+ if (idx < length && line.charAt(idx) == '*') { >+ commentKind = 3; // javadoc comment >+ idx++; >+ } >+ break; >+ } >+ if (commentKind != 0) { >+ // Enter a comment >+ switch (IGNORE_SPACES) { >+ case ALL_COMMENTS_SPACES: >+ switch (commentKind) { >+ case 1: >+ int start = idx; >+ buffer.append(line.substring(0, start).trim()); >+ while (true) { >+ if (start < length) { >+ while (start < length && ScannerHelper.isWhitespace(line.charAt(start))) { >+ start++; >+ } >+ buffer.append(ModelTestsUtil.removeWhiteSpace(line.substring(start))); >+ } >+ line = tokenizer.nextToken(); >+ length = line.length(); >+ start = 0; >+ while (start < length && ScannerHelper.isWhitespace(line.charAt(start))) { >+ start++; >+ } >+ if (start > length+1 || line.charAt(start) != '/' || line.charAt(start+1) != '/') { >+ buffer.append('\n'); >+ skipToken = true; >+ // only gate to break the loop >+ continue lineLoop; >+ } >+ start += 2; >+ } >+ case 2: >+ case 3: >+ buffer.append(line.substring(0, idx).trim()); >+ int endComment = line.indexOf("*/"); >+ if (endComment > 0) { >+ buffer.append(ModelTestsUtil.removeWhiteSpace(line.substring(0, endComment + 2))); >+ line = line.substring(endComment+2); >+ skipToken = true; >+ continue lineLoop; >+ } >+ while (endComment < 0) { >+ buffer.append(ModelTestsUtil.removeWhiteSpace(line)); >+ line = tokenizer.nextToken(); >+ endComment = line.indexOf("*/"); >+ } >+ buffer.append(ModelTestsUtil.removeWhiteSpace(line.substring(0, endComment + 2))); >+ buffer.append('\n'); >+ continue; >+ } >+ break; >+ case ALL_COMMENTS_LINES_LEADING_SPACES: >+ switch (commentKind) { >+ case 1: >+ int start = idx; >+ buffer.append(line.substring(0, start).trim()); >+ while (true) { >+ if (start < length) { >+ while (start < length && ScannerHelper.isWhitespace(line.charAt(start))) { >+ start++; >+ } >+ if (start < length) { >+ buffer.append(line.substring(start)); >+ } >+ } >+ line = tokenizer.nextToken(); >+ length = line.length(); >+ start = 0; >+ while (start < length && ScannerHelper.isWhitespace(line.charAt(start))) { >+ start++; >+ } >+ if (start < length && (line.charAt(start) != '/' || line.charAt(start+1) != '/')) { >+ buffer.append('\n'); >+ skipToken = true; >+ // only gate to break the loop >+ continue lineLoop; >+ } >+ buffer.append(' '); >+ start += 2; // skip next line starting comment >+ } >+ case 3: >+ case 2: >+ start = idx; >+ int endComment = line.indexOf("*/"); >+ if (endComment > 0) { >+ buffer.append(line.substring(0, endComment + 2)); >+ line = line.substring(endComment+2); >+ skipToken = true; >+ continue lineLoop; >+ } >+ buffer.append(line.substring(0, start).trim()); >+ while (endComment < 0) { >+ if (start < length) { >+ while (start < length && ScannerHelper.isWhitespace(line.charAt(start))) { >+ start++; >+ } >+ if (start < length && ch == '*') { >+ start++; >+ while (start < length && ScannerHelper.isWhitespace(line.charAt(start))) { >+ start++; >+ } >+ } >+ if (start < length) { >+ buffer.append(line.substring(start)); >+ } >+ } >+ line = tokenizer.nextToken(); >+ length = line.length(); >+ endComment = line.indexOf("*/"); >+ start = 0; >+ buffer.append(' '); >+ } >+ buffer.append(line.substring(0, endComment + 2)); >+ buffer.append('\n'); >+ continue; >+ } >+ } >+ } >+ } >+ } >+ if (length > 0 && lineStart > 0 && lineStart < length) { >+ buffer.append(line.substring(lineStart).trim()); >+ } else { >+ buffer.append(line); >+ } >+ buffer.append('\n'); >+ } >+ return buffer.toString(); >+} > > private int getIndentationLevel(Scanner scanner, int position) { > int indentationLevel = 0; >@@ -524,39 +758,48 @@ > String result = org.eclipse.jdt.internal.core.util.Util.editedString(source, edit); > > int count = 1; >- if (length == source.length()) { >+ if (!COMPARE && length == source.length()) { > while (count++ < FORMAT_REPEAT) { > edit = codeFormatter.format(kind, result, 0, result.length(), indentationLevel, lineSeparator);//$NON-NLS-1$ > if (edit == null) return null; > String newResult = org.eclipse.jdt.internal.core.util.Util.editedString(result, edit); > if (!result.equals(newResult)) { >- String counterString = counterString(count); >- if (IGNORE_WHITESPACES) { >- String trimmedResult = ModelTestsUtil.removeWhiteSpace(result); >- String trimmedNewResult = ModelTestsUtil.removeWhiteSpace(newResult); >- if (trimmedResult.equals(trimmedNewResult)) { >- this.whitespacesFailures.add(this.path); >- this.hasSpaceFailure = true; >- return result; >- } >- } else if (IGNORE_LINES_LEADING_WHITESPACES) { >- String trimmedResult = ModelTestsUtil.trimLinesLeadingWhitespaces(result); >- String trimmedNewResult = ModelTestsUtil.trimLinesLeadingWhitespaces(newResult); >- if (trimmedResult.equals(trimmedNewResult)) { >- this.leadingWhitespacesFailures.add(this.path); >- this.hasSpaceFailure = true; >- return result; >- } >- String compressedResult = ModelTestsUtil.removeWhiteSpace(result); >- String compressedNewResult = ModelTestsUtil.removeWhiteSpace(newResult); >- if (compressedResult.equals(compressedNewResult)) { >- this.whitespacesFailures.add(this.path); >- this.hasSpaceFailure = true; >- return result; >- } >+ switch (IGNORE_SPACES) { >+ case ALL_SPACES: >+ String trimmedExpected = ModelTestsUtil.removeWhiteSpace(result); >+ String trimmedActual= ModelTestsUtil.removeWhiteSpace(newResult); >+ if (trimmedExpected.equals(trimmedActual)) { >+ this.whitespacesFailures.add(this.path); >+ this.hasSpaceFailure = true; >+ return result; >+ } >+ break; >+ case LINES_LEADING_SPACES: >+ trimmedExpected = ModelTestsUtil.trimLinesLeadingWhitespaces(result); >+ trimmedActual= ModelTestsUtil.trimLinesLeadingWhitespaces(newResult); >+ if (trimmedExpected.equals(trimmedActual)) { >+ this.leadingWhitespacesFailures.add(this.path); >+ this.hasSpaceFailure = true; >+ return result; >+ } >+ if (ModelTestsUtil.removeWhiteSpace(result).equals(ModelTestsUtil.removeWhiteSpace(newResult))) { >+ this.whitespacesFailures.add(this.path); >+ this.hasSpaceFailure = true; >+ return result; >+ } >+ break; >+ default: >+ trimmedExpected = filterFormattingInComments(result); >+ trimmedActual= filterFormattingInComments(newResult); >+ if (trimmedExpected.equals(trimmedActual)) { >+ this.whitespacesFailures.add(this.path); >+ this.hasSpaceFailure = true; >+ return result; >+ } >+ break; > } > if (!isExpectedFailure()) { >- assertSourceEquals(counterString+" formatting is different from first one!", Util.convertToIndependantLineDelimiter(result), Util.convertToIndependantLineDelimiter(newResult)); >+ assertSourceEquals("2nd formatting is different from first one!", Util.convertToIndependantLineDelimiter(result), Util.convertToIndependantLineDelimiter(newResult)); > } > } > } >@@ -564,27 +807,6 @@ > return result; > } > >-private String counterString(int count) { >- int reminder = count%10; >- StringBuffer buffer = new StringBuffer(); >- buffer.append(count); >- switch (reminder) { >- case 1: >- buffer.append("st"); >- break; >- case 2: >- buffer.append("nd"); >- break; >- case 3: >- buffer.append("rd"); >- break; >- default: >- buffer.append("th"); >- break; >- } >- return buffer.toString(); >-} >- > public void testCompare() throws IOException, Exception { > compareFormattedSource(); > } >Index: src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsTests.java,v >retrieving revision 1.11 >diff -u -r1.11 FormatterCommentsTests.java >--- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsTests.java 30 Apr 2008 14:50:13 -0000 1.11 >+++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsTests.java 5 May 2008 16:01:55 -0000 >@@ -767,6 +767,18 @@ > public void testLineComments06() throws JavaModelException { > formatUnit("comments.line", "X06.java"); > } >+public void _testLineComments07() throws JavaModelException { >+ formatUnit("comments.line", "X07.java"); >+} >+public void testLineComments08() throws JavaModelException { >+ formatUnit("comments.line", "X08.java"); >+} >+public void testLineComments09() throws JavaModelException { >+ formatUnit("comments.line", "X09.java"); >+} >+public void testLineComments10() throws JavaModelException { >+ formatUnit("comments.line", "X10.java"); >+} > > /* > * Test formatter block lines >@@ -953,6 +965,27 @@ > public void testWkspEclipse26() throws JavaModelException { > formatUnit("wksp.eclipse", "X26.java"); > } >+public void testWkspEclipse27() throws JavaModelException { >+ formatUnit("wksp.eclipse", "X27.java"); >+} >+public void testWkspEclipse28() throws JavaModelException { >+ formatUnit("wksp.eclipse", "X28.java"); >+} >+public void testWkspEclipse28b() throws JavaModelException { >+ formatUnit("wksp.eclipse", "X28b.java"); >+} >+public void _testWkspEclipse28c() throws JavaModelException { >+ formatUnit("wksp.eclipse", "X28c.java"); >+} >+public void testWkspEclipse28d() throws JavaModelException { >+ formatUnit("wksp.eclipse", "X28d.java"); >+} >+public void _testWkspEclipse29() throws JavaModelException { >+ formatUnit("wksp.eclipse", "X29.java"); >+} >+public void _testWkspEclipse30() throws JavaModelException { >+ formatUnit("wksp.eclipse", "X30.java"); >+} > // Ganymede > // TODO pass this test > public void _testWkspGanymede01() throws JavaModelException { >@@ -961,6 +994,12 @@ > public void testWkspGanymede02() throws JavaModelException { > formatUnit("wksp.ganymede", "X02.java"); > } >+public void testWkspGanymede03() throws JavaModelException { >+ formatUnit("wksp.ganymede", "X03.java"); >+} >+public void testWkspGanymede04() throws JavaModelException { >+ formatUnit("wksp.ganymede", "X04.java"); >+} > // JUnit 3.8.2 > public void testWkspJUnit01() throws JavaModelException { > formatUnit("wksp.junit", "X01.java"); >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.3 >diff -u -r1.3 X18.java >--- workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X18.java 28 Apr 2008 16:29:56 -0000 1.3 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X18.java 5 May 2008 16:01:55 -0000 >@@ -28,8 +28,8 @@ > * <ul> > * <li>{@linkplain CompilationUnit#lineNumber(int) Line number map}. Line > * numbers start at 1 and only cover the subrange scanned ( >- * <code>source[offset]</code> through <code>source[offset+length-1]</code>). >- * </li> >+ * <code>source[offset]</code> through <code>source[offset+length-1]</code> >+ * ).</li> > * <li>{@linkplain CompilationUnit#getMessages() Compiler messages} and > * {@linkplain CompilationUnit#getProblems() detailed problem reports}. > * Character positions are relative to the start of <code>source</code>; >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X16.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X16.java,v >retrieving revision 1.1 >diff -u -r1.1 X16.java >--- workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X16.java 27 Apr 2008 10:01:23 -0000 1.1 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X16.java 5 May 2008 16:01:55 -0000 >@@ -8,7 +8,8 @@ > * constructor. > * > * @param methodBinding >- * org.eclipse.jdt.internal.compiler.nameloopkup.SyntheticAccessMethodBinding >+ * org.eclipse.jdt.internal.compiler.nameloopkup. >+ * SyntheticAccessMethodBinding > */ > void foo(Object methodBinding) { > } >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X06.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X06.java,v >retrieving revision 1.1 >diff -u -r1.1 X06.java >--- workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X06.java 23 Apr 2008 22:29:05 -0000 1.1 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X06.java 5 May 2008 16:01:55 -0000 >@@ -7,8 +7,7 @@ > * > * @param projectGroup > * the parent composite >- * @param boolean >- * - the initial enabled state of the widgets created >+ * @param boolean - the initial enabled state of the widgets created > */ > void foo(Object projectGroup, boolean enabled) { > } >Index: workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X04.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X04.java >diff -N workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X04.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X04.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,18 @@ >+package test.wksp.ganymede; >+ >+/** >+ * <!-- begin-user-doc --> A representation of the model object ' >+ * <em><b>Feature Value Spec</b></em>'. <!-- end-user-doc --> <!-- >+ * begin-model-doc --> Value specification associated with a specific feature >+ * <!-- end-model-doc --> >+ * >+ * @see org.eclipse.gmf.mappings.GMFMapPackage#getFeatureValueSpec() >+ * @model annotation= >+ * "http://www.eclipse.org/gmf/2005/constraints/meta def='ValueSpec'" >+ * annotation= >+ * "http://www.eclipse.org/gmf/2005/constraints/meta def='type' ocl='feature'" >+ * @generated >+ */ >+public class X04 { >+ >+} >Index: workspace/FormatterJavadoc/test/comments/line/X10.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/comments/line/X10.java >diff -N workspace/FormatterJavadoc/test/comments/line/X10.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/comments/line/X10.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,8 @@ >+package test.comments.line; >+ >+public class X10 { >+ >+void foo() { >+ // 1EX5I8Z - accessing outer fields within a constructor call is permitted >+} >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X28d.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X28d.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X28d.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X28d.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,14 @@ >+package test.wksp.eclipse; >+ >+public class X28d { >+ >+ /** >+ * Returns a complete node containing the contents of the subtree rooted at @key >+ * in the receiver. Uses the public API. >+ * >+ * @param key >+ * key of subtree whose contents we want to copy. >+ */ >+ public void foo(String key) { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X04.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X04.java >diff -N workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X04.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X04.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,20 @@ >+package test.wksp.ganymede; >+ >+/** >+ * <!-- begin-user-doc --> A representation of the model object ' >+ * <em><b>Feature Value Spec</b></em>'. <!-- end-user-doc --> >+ * >+ * <!-- begin-model-doc --> Value specification associated with a specific >+ * feature <!-- end-model-doc --> >+ * >+ * >+ * @see org.eclipse.gmf.mappings.GMFMapPackage#getFeatureValueSpec() >+ * @model annotation= >+ * "http://www.eclipse.org/gmf/2005/constraints/meta def='ValueSpec'" >+ * annotation= >+ * "http://www.eclipse.org/gmf/2005/constraints/meta def='type' ocl='feature'" >+ * @generated >+ */ >+public class X04 { >+ >+} >Index: workspace/FormatterJavadoc/test/comments/line/out/default/X10.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/comments/line/out/default/X10.java >diff -N workspace/FormatterJavadoc/test/comments/line/out/default/X10.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/comments/line/out/default/X10.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,9 @@ >+package test.comments.line; >+ >+public class X10 { >+ >+ void foo() { >+ // 1EX5I8Z - accessing outer fields within a constructor call is >+ // permitted >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X30.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X30.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X30.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X30.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,18 @@ >+package test.wksp.eclipse; >+ >+public class X30 { >+ >+ /** >+ * Tells whether the given resource (or its children) have compile errors. >+ * The method acts on the current build state and does not recompile. >+ * >+ * @param resource >+ * the resource to check for errors >+ * @return <code>true</code> if the resource (and its children) are error >+ * free >+ * @throws import org.eclipse.core.runtime.CoreException if there's a marker >+ * problem >+ */ >+ void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X28.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X28.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X28.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X28.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,14 @@ >+package test.wksp.eclipse; >+ >+public class X28 { >+ >+ /** >+ * Shutdown the HCR mgr and the Java debug targets. >+ * >+ * @see >+ * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundlContext)@see >+ * org.eclipse.core.runtime.Plugin#shutdown() >+ */ >+ public void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X04.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X04.java >diff -N workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X04.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X04.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,20 @@ >+package test.wksp.ganymede; >+ >+/** >+ * <!-- begin-user-doc --> A representation of the model object ' >+ * <em><b>Feature Value Spec</b></em>'. <!-- end-user-doc --> >+ * >+ * <!-- begin-model-doc --> Value specification associated with a specific >+ * feature <!-- end-model-doc --> >+ * >+ * >+ * @see org.eclipse.gmf.mappings.GMFMapPackage#getFeatureValueSpec() >+ * @model annotation= >+ * "http://www.eclipse.org/gmf/2005/constraints/meta def='ValueSpec'" >+ * annotation= >+ * "http://www.eclipse.org/gmf/2005/constraints/meta def='type' ocl='feature'" >+ * @generated >+ */ >+public class X04 { >+ >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/X28d.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/X28d.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/X28d.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/X28d.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,14 @@ >+package test.wksp.eclipse; >+ >+public class X28d { >+ >+ /** >+ * Returns a complete node containing the contents of the subtree >+ * rooted at @key in the receiver. Uses the public API. >+ * >+ * @param key >+ * key of subtree whose contents we want to copy. >+ */ >+ public void foo(String key) { >+ } >+} >Index: workspace/FormatterJavadoc/test/comments/line/out/default/X09.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/comments/line/out/default/X09.java >diff -N workspace/FormatterJavadoc/test/comments/line/out/default/X09.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/comments/line/out/default/X09.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,27 @@ >+package test.comments.line; >+ >+public class X09 { >+ >+ void foo() { >+ if (true) { >+ if (true) { >+ if (true) { >+ if (true) { >+ if (true) { >+ if (true) { >+ if (true) { >+ if (true) { >+ // if a valid field was found, complain >+ // when another is found in an >+ // 'immediate' enclosing type (that is, >+ // not inherited) >+ } >+ } >+ } >+ } >+ } >+ } >+ } >+ } >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/X28c.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/X28c.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/X28c.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/X28c.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,12 @@ >+package test.wksp.eclipse; >+ >+public class X28c { >+ >+ /** >+ * Shutdown the HCR mgr and the Java debug targets. >+ * >+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundlContext) @see org.eclipse.core.runtime.Plugin#shutdown() >+ */ >+ public void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X30.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X30.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X30.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X30.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,18 @@ >+package test.wksp.eclipse; >+ >+public class X30 { >+ >+ /** >+ * Tells whether the given resource (or its children) have compile errors. >+ * The method acts on the current build state and does not recompile. >+ * >+ * @param resource >+ * the resource to check for errors >+ * @return <code>true</code> if the resource (and its children) are error >+ * free >+ * @throws import org.eclipse.core.runtime.CoreException if there's a marker >+ * problem >+ */ >+ void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/ganymede/X03.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/ganymede/X03.java >diff -N workspace/FormatterJavadoc/test/wksp/ganymede/X03.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/ganymede/X03.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,25 @@ >+package test.wksp.ganymede; >+ >+/** >+ * <!-- begin-user-doc --> >+ * A representation of the model object '<em><b>Audited Metric Target</b></em>'. >+ * <!-- end-user-doc --> >+ * >+ * <!-- begin-model-doc --> >+ * Target metric which can be evaluated by audit rule. The target context here is the metric rule resulting type classifier >+ * <!-- end-model-doc --> >+ * >+ * <p> >+ * The following features are supported: >+ * <ul> >+ * <li>{@link org.eclipse.gmf.mappings.AuditedMetricTarget#getMetric <em>Metric</em>}</li> >+ * </ul> >+ * </p> >+ * >+ * @see org.eclipse.gmf.mappings.GMFMapPackage#getAuditedMetricTarget() >+ * @model annotation="http://www.eclipse.org/gmf/2005/constraints/meta def='context' ocl='\'ecore::EDoubleObject\''" >+ * @generated >+ */ >+public class X03 { >+ >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/X28.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/X28.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/X28.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/X28.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,12 @@ >+package test.wksp.eclipse; >+ >+public class X28 { >+ >+ /** >+ * Shutdown the HCR mgr and the Java debug targets. >+ * >+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundlContext)@see org.eclipse.core.runtime.Plugin#shutdown() >+ */ >+ public void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/X28b.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/X28b.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/X28b.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/X28b.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,12 @@ >+package test.wksp.eclipse; >+ >+public class X28b { >+ >+ /** >+ * Shutdown the HCR mgr and the Java debug targets. >+ * >+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)@see org.eclipse.core.runtime.Plugin#shutdown() >+ */ >+ public void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/X29.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/X29.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/X29.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/X29.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,15 @@ >+package test.wksp.eclipse; >+ >+public class X29 { >+ >+ /** >+ * @param <code>text</code>, the string to match >+ * @param <code>start</code>, the starting index in the text for search, inclusive >+ * @param <code>end</code>, the stopping point of search, exclusive >+ * @param code>p</code>, a string that has no wildcard >+ * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> is case sensitive >+ * @return the starting index in the text of the pattern , or -1 if not found >+ */ >+ void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/ganymede/X04.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/ganymede/X04.java >diff -N workspace/FormatterJavadoc/test/wksp/ganymede/X04.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/ganymede/X04.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,20 @@ >+package test.wksp.ganymede; >+ >+/** >+ * <!-- begin-user-doc --> >+ * A representation of the model object '<em><b>Feature Value Spec</b></em>'. >+ * <!-- end-user-doc --> >+ * >+ * <!-- begin-model-doc --> >+ * Value specification associated with a specific feature >+ * <!-- end-model-doc --> >+ * >+ * >+ * @see org.eclipse.gmf.mappings.GMFMapPackage#getFeatureValueSpec() >+ * @model annotation="http://www.eclipse.org/gmf/2005/constraints/meta def='ValueSpec'" >+ * annotation="http://www.eclipse.org/gmf/2005/constraints/meta def='type' ocl='feature'" >+ * @generated >+ */ >+public class X04 { >+ >+} >Index: workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X03.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X03.java >diff -N workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X03.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/ganymede/out/default/X03.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,26 @@ >+package test.wksp.ganymede; >+ >+/** >+ * <!-- begin-user-doc --> A representation of the model object ' >+ * <em><b>Audited Metric Target</b></em>'. <!-- end-user-doc --> >+ * >+ * <!-- begin-model-doc --> Target metric which can be evaluated by audit rule. >+ * The target context here is the metric rule resulting type classifier <!-- >+ * end-model-doc --> >+ * >+ * <p> >+ * The following features are supported: >+ * <ul> >+ * <li>{@link org.eclipse.gmf.mappings.AuditedMetricTarget#getMetric <em>Metric >+ * </em>}</li> >+ * </ul> >+ * </p> >+ * >+ * @see org.eclipse.gmf.mappings.GMFMapPackage#getAuditedMetricTarget() >+ * @model annotation= >+ * "http://www.eclipse.org/gmf/2005/constraints/meta def='context' ocl='\'ecore::EDoubleObject\''" >+ * @generated >+ */ >+public class X03 { >+ >+} >Index: workspace/FormatterJavadoc/test/comments/line/X08.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/comments/line/X08.java >diff -N workspace/FormatterJavadoc/test/comments/line/X08.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/comments/line/X08.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,15 @@ >+package test.comments.line; >+ >+public class X08 { >+ >+ void foo() { >+ try { >+ if (true) { >+ //BUILD FAILED: C:\Darins\Debugger\20021213\eclipse\runtime-workspace\Mine\build.xml:4: Following error occured while executing this line >+ //C:\Darins\Debugger\20021213\eclipse\runtime-workspace\Mine\subbuild.xml:4: srcdir attribute must be set! >+ } >+ } >+ finally { >+ } >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X29.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X29.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X29.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X29.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,19 @@ >+package test.wksp.eclipse; >+ >+public class X29 { >+ >+ /** >+ * @param <code>text</code>, the string to match >+ * @param <code>start</code>, the starting index in the text for search, >+ * inclusive >+ * @param <code>end</code>, the stopping point of search, exclusive >+ * @param code >+ * >p</code>, a string that has no wildcard >+ * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> >+ * is case sensitive >+ * @return the starting index in the text of the pattern , or -1 if not >+ * found >+ */ >+ void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X28b.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X28b.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X28b.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X28b.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,14 @@ >+package test.wksp.eclipse; >+ >+public class X28b { >+ >+ /** >+ * Shutdown the HCR mgr and the Java debug targets. >+ * >+ * @see >+ * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext >+ * )@see org.eclipse.core.runtime.Plugin#shutdown() >+ */ >+ public void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/comments/line/out/default/X08.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/comments/line/out/default/X08.java >diff -N workspace/FormatterJavadoc/test/comments/line/out/default/X08.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/comments/line/out/default/X08.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,18 @@ >+package test.comments.line; >+ >+public class X08 { >+ >+ void foo() { >+ try { >+ if (true) { >+ // BUILD FAILED: >+ // C:\Darins\Debugger\20021213\eclipse\runtime-workspace >+ // \Mine\build.xml:4: Following error occured while executing >+ // this line >+ // C:\Darins\Debugger\20021213\eclipse\runtime-workspace\Mine\ >+ // subbuild.xml:4: srcdir attribute must be set! >+ } >+ } finally { >+ } >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X28d.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X28d.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X28d.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X28d.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,14 @@ >+package test.wksp.eclipse; >+ >+public class X28d { >+ >+ /** >+ * Returns a complete node containing the contents of the subtree rooted at @key >+ * in the receiver. Uses the public API. >+ * >+ * @param key >+ * key of subtree whose contents we want to copy. >+ */ >+ public void foo(String key) { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X27.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X27.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X27.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X27.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,14 @@ >+package test.wksp.eclipse; >+ >+public class X27 { >+ >+ /** >+ * Shutdown the HCR mgr and the Java debug targets. >+ * >+ * @see >+ * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext >+ * ) text >+ */ >+ public void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X28d.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X28d.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X28d.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X28d.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,14 @@ >+package test.wksp.eclipse; >+ >+public class X28d { >+ >+ /** >+ * Returns a complete node containing the contents of the subtree rooted at @key >+ * in the receiver. Uses the public API. >+ * >+ * @param key >+ * key of subtree whose contents we want to copy. >+ */ >+ public void foo(String key) { >+ } >+} >Index: workspace/FormatterJavadoc/test/comments/line/X07.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/comments/line/X07.java >diff -N workspace/FormatterJavadoc/test/comments/line/X07.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/comments/line/X07.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+package test.comments.line; >+ >+public class X07 { >+ >+boolean inTitle; >+boolean inMetaTag; >+boolean inStyle; >+boolean inImg; >+ >+void foo(String tagName) { >+ inTitle = tagName.equalsIgnoreCase("<title"); // keep track if in <TITLE> >+ inMetaTag = tagName.equalsIgnoreCase("<META"); // keep track if in <META> >+ inStyle = tagName.equalsIgnoreCase("<STYLE"); // keep track if in <STYLE> >+ inImg = tagName.equalsIgnoreCase("<img"); // keep track if in <IMG> >+} >+} >Index: workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X03.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X03.java >diff -N workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X03.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/ganymede/out/clear_blank_lines/X03.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,24 @@ >+package test.wksp.ganymede; >+ >+/** >+ * <!-- begin-user-doc --> A representation of the model object ' >+ * <em><b>Audited Metric Target</b></em>'. <!-- end-user-doc --> <!-- >+ * begin-model-doc --> Target metric which can be evaluated by audit rule. The >+ * target context here is the metric rule resulting type classifier <!-- >+ * end-model-doc --> >+ * <p> >+ * The following features are supported: >+ * <ul> >+ * <li>{@link org.eclipse.gmf.mappings.AuditedMetricTarget#getMetric <em>Metric >+ * </em>}</li> >+ * </ul> >+ * </p> >+ * >+ * @see org.eclipse.gmf.mappings.GMFMapPackage#getAuditedMetricTarget() >+ * @model annotation= >+ * "http://www.eclipse.org/gmf/2005/constraints/meta def='context' ocl='\'ecore::EDoubleObject\''" >+ * @generated >+ */ >+public class X03 { >+ >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X27.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X27.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X27.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X27.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,14 @@ >+package test.wksp.eclipse; >+ >+public class X27 { >+ >+ /** >+ * Shutdown the HCR mgr and the Java debug targets. >+ * >+ * @see >+ * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) >+ * text >+ */ >+ public void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X03.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X03.java >diff -N workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X03.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/ganymede/out/dont_indent_tags/X03.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,26 @@ >+package test.wksp.ganymede; >+ >+/** >+ * <!-- begin-user-doc --> A representation of the model object ' >+ * <em><b>Audited Metric Target</b></em>'. <!-- end-user-doc --> >+ * >+ * <!-- begin-model-doc --> Target metric which can be evaluated by audit rule. >+ * The target context here is the metric rule resulting type classifier <!-- >+ * end-model-doc --> >+ * >+ * <p> >+ * The following features are supported: >+ * <ul> >+ * <li>{@link org.eclipse.gmf.mappings.AuditedMetricTarget#getMetric <em>Metric >+ * </em>}</li> >+ * </ul> >+ * </p> >+ * >+ * @see org.eclipse.gmf.mappings.GMFMapPackage#getAuditedMetricTarget() >+ * @model annotation= >+ * "http://www.eclipse.org/gmf/2005/constraints/meta def='context' ocl='\'ecore::EDoubleObject\''" >+ * @generated >+ */ >+public class X03 { >+ >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/X30.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/X30.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/X30.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/X30.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,15 @@ >+package test.wksp.eclipse; >+ >+public class X30 { >+ >+ /** >+ * Tells whether the given resource (or its children) have compile errors. >+ * The method acts on the current build state and does not recompile. >+ * >+ * @param resource the resource to check for errors >+ * @return <code>true</code> if the resource (and its children) are error free >+ * @throws import org.eclipse.core.runtime.CoreException if there's a marker problem >+ */ >+ void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X30.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X30.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X30.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X30.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,18 @@ >+package test.wksp.eclipse; >+ >+public class X30 { >+ >+ /** >+ * Tells whether the given resource (or its children) have compile errors. >+ * The method acts on the current build state and does not recompile. >+ * >+ * @param resource >+ * the resource to check for errors >+ * @return <code>true</code> if the resource (and its children) are error >+ * free >+ * @throws import org.eclipse.core.runtime.CoreException if there's a marker >+ * problem >+ */ >+ void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/comments/line/out/default/X07.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/comments/line/out/default/X07.java >diff -N workspace/FormatterJavadoc/test/comments/line/out/default/X07.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/comments/line/out/default/X07.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,19 @@ >+package test.comments.line; >+ >+public class X07 { >+ >+ boolean inTitle; >+ boolean inMetaTag; >+ boolean inStyle; >+ boolean inImg; >+ >+ void foo(String tagName) { >+ inTitle = tagName.equalsIgnoreCase("<title"); // keep track if in >+ // <TITLE> >+ inMetaTag = tagName.equalsIgnoreCase("<META"); // keep track if in >+ // <META> >+ inStyle = tagName.equalsIgnoreCase("<STYLE"); // keep track if in >+ // <STYLE> >+ inImg = tagName.equalsIgnoreCase("<img"); // keep track if in <IMG> >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X29.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X29.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X29.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X29.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,19 @@ >+package test.wksp.eclipse; >+ >+public class X29 { >+ >+ /** >+ * @param <code>text</code>, the string to match >+ * @param <code>start</code>, the starting index in the text for search, >+ * inclusive >+ * @param <code>end</code>, the stopping point of search, exclusive >+ * @param code >+ * >p</code>, a string that has no wildcard >+ * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> >+ * is case sensitive >+ * @return the starting index in the text of the pattern , or -1 if not >+ * found >+ */ >+ void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/X27.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/X27.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/X27.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/X27.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,12 @@ >+package test.wksp.eclipse; >+ >+public class X27 { >+ >+ /** >+ * Shutdown the HCR mgr and the Java debug targets. >+ * >+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) text >+ */ >+ public void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X28b.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X28b.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X28b.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X28b.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,14 @@ >+package test.wksp.eclipse; >+ >+public class X28b { >+ >+ /** >+ * Shutdown the HCR mgr and the Java debug targets. >+ * >+ * @see >+ * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)@see >+ * org.eclipse.core.runtime.Plugin#shutdown() >+ */ >+ public void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X29.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X29.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X29.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X29.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,19 @@ >+package test.wksp.eclipse; >+ >+public class X29 { >+ >+ /** >+ * @param <code>text</code>, the string to match >+ * @param <code>start</code>, the starting index in the text for search, >+ * inclusive >+ * @param <code>end</code>, the stopping point of search, exclusive >+ * @param code >+ * >p</code>, a string that has no wildcard >+ * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> >+ * is case sensitive >+ * @return the starting index in the text of the pattern , or -1 if not >+ * found >+ */ >+ void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X28.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X28.java >diff -N workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X28.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X28.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,14 @@ >+package test.wksp.eclipse; >+ >+public class X28 { >+ >+ /** >+ * Shutdown the HCR mgr and the Java debug targets. >+ * >+ * @see >+ * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundlContext)@see >+ * org.eclipse.core.runtime.Plugin#shutdown() >+ */ >+ public void foo() { >+ } >+} >Index: workspace/FormatterJavadoc/test/comments/line/X09.java >=================================================================== >RCS file: workspace/FormatterJavadoc/test/comments/line/X09.java >diff -N workspace/FormatterJavadoc/test/comments/line/X09.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/FormatterJavadoc/test/comments/line/X09.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,24 @@ >+package test.comments.line; >+ >+public class X09 { >+ >+ void foo() { >+ if (true) { >+ if (true) { >+ if (true) { >+ if (true) { >+ if (true) { >+ if (true) { >+ if (true) { >+ if (true){ >+ // if a valid field was found, complain when another is found in an 'immediate' enclosing type (that is, not inherited) >+ } >+ } >+ } >+ } >+ } >+ } >+ } >+ } >+ } >+} >#P org.eclipse.jdt.core >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.9 >diff -u -r1.9 FormatterCommentParser.java >--- formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java 30 Apr 2008 14:50:17 -0000 1.9 >+++ formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java 5 May 2008 16:01:57 -0000 >@@ -315,15 +315,20 @@ > this.scanner.resetTo(this.tagSourceEnd+1, this.javadocEnd); > this.index = this.tagSourceEnd+1; > char ch = peekChar(); >- if (ch != ' ' && !ScannerHelper.isWhitespace(ch)) { >- // no space after the tag, just create a normal tag >- return false; >- } >- this.scanner.getNextToken(); // consume first token >- pushIdentifier(true, false); // force the identifier even if invalid >- pushParamName(false); >- this.index = this.scanner.currentPosition; >- valid = true; >+ // Try to push an identifier in the stack, otherwise restart from the end tag position >+ if (ch == ' ' || ScannerHelper.isWhitespace(ch)) { >+ int token = this.scanner.getNextToken(); >+ if (token == TerminalTokens.TokenNameIdentifier) { >+ ch = peekChar(); >+ if (ch == ' ' || ScannerHelper.isWhitespace(ch)) { >+ pushIdentifier(true, false); >+ pushParamName(false); >+ this.index = this.scanner.currentPosition; >+ valid = true; >+ } >+ } >+ this.scanner.resetTo(this.tagSourceEnd+1, this.javadocEnd); >+ } > } > return valid; > } >@@ -367,12 +372,26 @@ > } else if (this.invalidTagName) { > this.textStart = previousPosition; > } else if (this.astPtr == ptr) { >+ this.tagValue = TAG_OTHERS_VALUE; // tag is invalid, do not keep the parsed tag value > createTag(); > } > return true; > } > > /* (non-Javadoc) >+ * @see org.eclipse.jdt.internal.compiler.parser.JavadocParser#parseThrows() >+ */ >+protected boolean parseThrows() { >+ boolean valid = super.parseThrows(); >+ if (!valid) { >+ // If invalid, restart from the end tag position >+ this.scanner.resetTo(this.tagSourceEnd+1, this.javadocEnd); >+ this.index = this.tagSourceEnd+1; >+ } >+ return valid; >+} >+ >+/* (non-Javadoc) > * @see org.eclipse.jdt.internal.compiler.parser.JavadocParser#pushParamName(boolean) > */ > protected boolean pushParamName(boolean isTypeParam) { >@@ -562,4 +581,9 @@ > System.out.println(toDebugString()); > } > } >+ >+protected boolean verifySpaceOrEndComment() { >+ // Don't care if there's no spaces after a reference... >+ return true; >+} > } >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.132 >diff -u -r1.132 Scribe.java >--- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 30 Apr 2008 14:50:17 -0000 1.132 >+++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 5 May 2008 16:01:58 -0000 >@@ -1860,7 +1860,7 @@ > int firstColumn = this.column; > int indentLevel = this.indentationLevel; > int indentations = this.numberOfIndentations; >- this.indentationLevel = getNextIndentationLevel(firstColumn); >+ this.indentationLevel = (this.column / this.tabLength) * this.tabLength; > this.numberOfIndentations = this.indentationLevel / this.indentationSize; > > // Consume the comment prefix >@@ -1871,6 +1871,8 @@ > this.scanner.getNextChar(); > buffer.append(this.scanner.currentCharacter); > this.column += 2; >+ StringBuffer tokensBuffer = new StringBuffer(); >+ boolean bufferHasTokens = false; > > // Scan the text token per token to compact it and size it the max line length > int maxColumn = this.formatter.preferences.comment_line_length + 1; >@@ -1886,23 +1888,31 @@ > try { > token = this.scanner.getNextToken(); > } catch (InvalidInputException iie) { >- String msg = iie.getMessage(); >- if (msg == Scanner.INVALID_CHARACTER_CONSTANT) { >- buffer.append('\''); >- } else if (msg == Scanner.INVALID_CHAR_IN_STRING) { >- buffer.append('"'); >- } else { >- // skip failure >- } >- // Need to retrieve correct position >+ if (previousToken == -1 || previousToken == TerminalTokens.TokenNameWHITESPACE) { >+ tokensBuffer.append(' '); >+ } > this.scanner.resetTo(this.scanner.startPosition, commentEnd); >- this.scanner.getNextChar(); >- this.column++; >+ char ch = (char) this.scanner.getNextChar(); >+ previousToken = TerminalTokens.TokenNameWHITESPACE; >+ while (!ScannerHelper.isWhitespace(ch)) { >+ tokensBuffer.append(ch); >+ if (this.scanner.atEnd()) { >+ previousToken = TerminalTokens.TokenNameEOF; >+ break; >+ } >+ ch = (char) this.scanner.getNextChar(); >+ } > continue; > } > switch (token) { > case TerminalTokens.TokenNameWHITESPACE: > previousToken = token; >+ if (tokensBuffer.length() > 0) { >+ buffer.append(tokensBuffer); >+ this.column += tokensBuffer.length(); >+ tokensBuffer.setLength(0); >+ bufferHasTokens = true; >+ } > previousPosition = this.scanner.currentPosition; > previousChar = this.scanner.currentCharacter; > continue; >@@ -1911,26 +1921,51 @@ > } > int tokenStart = this.scanner.getCurrentTokenStartPosition(); > int tokenLength = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - tokenStart; >- boolean insertSpace = previousToken == TerminalTokens.TokenNameWHITESPACE; >- this.column += tokenLength; >- if (previousToken == -1 || insertSpace) this.column++; >- int col = column; >- if (!firstWord && col > maxColumn) { >+ boolean insertSpace = previousToken == -1 || previousToken == TerminalTokens.TokenNameWHITESPACE; >+ int lastColumn = this.column + tokensBuffer.length() + tokenLength; >+ if (insertSpace) lastColumn++; >+ if (!firstWord && lastColumn > maxColumn) { > // not enough space on the line > this.line++; >- buffer.append(this.lineSeparator); >- this.column = 1; >- printIndentationIfNecessary(buffer); >- buffer.append(LINE_COMMENT_PREFIX); >- this.column = firstColumn + LINE_COMMENT_PREFIX_LENGTH; >+ if ((firstColumn+tokensBuffer.length()+tokenLength) > maxColumn) { >+ // there won't be enough room even if we break the line before the buffered tokens >+ // So add the buffered tokens now >+ buffer.append(tokensBuffer); >+ this.column += tokensBuffer.length(); >+ tokensBuffer.setLength(0); >+ bufferHasTokens = true; >+ } >+ if (bufferHasTokens) { >+ buffer.append(this.lineSeparator); >+ this.column = 1; >+ printIndentationIfNecessary(buffer); >+ buffer.append(LINE_COMMENT_PREFIX); >+ this.column += LINE_COMMENT_PREFIX_LENGTH; >+ } >+ if (tokensBuffer.length() > 0) { >+ if (ScannerHelper.isWhitespace(tokensBuffer.charAt(0))) { >+ buffer.append(tokensBuffer.substring(1)); >+ this.column += tokensBuffer.length() - 1; >+ } else { >+ buffer.append(tokensBuffer); >+ this.column += tokensBuffer.length(); >+ } >+ tokensBuffer.setLength(0); >+ if (insertSpace) { >+ buffer.append(' '); >+ this.column++; >+ } >+ } > buffer.append(this.scanner.source, tokenStart, tokenLength); >+ bufferHasTokens = true; > this.column += tokenLength; >+ firstColumn = this.indentationLevel + LINE_COMMENT_PREFIX_LENGTH; > } else { > // append token to the line >- if (previousToken == -1 || insertSpace) { >- buffer.append(' '); >+ if (insertSpace) { >+ tokensBuffer.append(' '); > } >- buffer.append(this.scanner.source, tokenStart, tokenLength); >+ tokensBuffer.append(this.scanner.source, tokenStart, tokenLength); > } > previousToken = token; > previousPosition = this.scanner.currentPosition; >@@ -1938,6 +1973,12 @@ > firstWord = false; > } > >+ // Add remaining buffered tokens >+ if (tokensBuffer.length() > 0) { >+ buffer.append(tokensBuffer); >+ this.column += tokensBuffer.length(); >+ } >+ > // Append separator if the comment is not at the end of file > this.indentationLevel = indentLevel; > this.numberOfIndentations = indentations; >@@ -2223,19 +2264,19 @@ > try { > this.scanner.resetTo(nodeStart , node.sourceEnd); > int token = this.scanner.getNextToken(); >- int tokenLength = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition; >+ int length = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition; > int newLines = 0; > boolean newLine = false; > boolean headerLine = block.isHeaderLine() && this.lastNumberOfNewLines == 0; > if (node.isText()) { > FormatJavadocText text = (FormatJavadocText)node; >+ int firstColumn = 1 + this.indentationLevel + BLOCK_LINE_PREFIX_LENGTH; >+ if (headerLine) firstColumn++; > if (text.isImmutableHtmlTag()) { >- int firstColumn = 1 + this.indentationLevel + BLOCK_LINE_PREFIX_LENGTH; >- if (headerLine) firstColumn++; > if (nodeStart > (previousEnd+1)) { >- tokenLength++; // include space between nodes >+ length++; // include space between nodes > } >- int col = this.column + tokenLength; >+ int col = this.column + length; > while (!this.scanner.atEnd()) { > token = this.scanner.getNextToken(); > switch (token) { >@@ -2243,20 +2284,20 @@ > if (CharOperation.indexOf('\n', this.scanner.source, this.scanner.startPosition, this.scanner.currentPosition) >= 0) { > return newLines; > } >- tokenLength = 1; >+ length = 1; > break; > case TerminalTokens.TokenNameMULTIPLY: > if (newLine) { > newLine = false; > continue; > } >- tokenLength = 1; >+ length = 1; > break; > default: >- tokenLength = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition; >+ length = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition; > break; > } >- col += tokenLength; >+ col += length; > if (headerLine) { // special case when text is on the same line of the javadoc's header > if ((col-1) > maxColumn) { > newLines++; >@@ -2274,27 +2315,31 @@ > if (text.isHtmlTag()) { > // read the html tag > if (this.scanner.getNextToken() == TerminalTokens.TokenNameDIVIDE) { >- tokenLength++; >+ length++; > this.scanner.getNextToken(); > } >- tokenLength += (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition; >+ length += (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition; > this.scanner.getNextToken(); // '>' >- tokenLength++; >+ length++; > } else { > while (true) { > token = this.scanner.getNextToken(); > if (token == TerminalTokens.TokenNameWHITESPACE || token == TerminalTokens.TokenNameEOF) break; >- tokenLength += (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition; >+ int tokenLength = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition; >+ if ((firstColumn + length + tokenLength) >= maxColumn) { >+ break; >+ } >+ length += tokenLength; > } > } > } else { > FormatJavadocBlock inlinedBlock = (FormatJavadocBlock) node; >- tokenLength += inlinedBlock.tagEnd - inlinedBlock.sourceStart + 1; >+ length += inlinedBlock.tagEnd - inlinedBlock.sourceStart + 1; > } > if (nodeStart > (previousEnd+1)) { >- tokenLength++; // include space between nodes >+ length++; // include space between nodes > } >- if ((this.column + tokenLength) > maxColumn) { >+ if ((this.column + length) > maxColumn) { > return 1; > } > } catch (InvalidInputException iie) { >@@ -3113,7 +3158,7 @@ > this.scanner.skipComments = true; > int previousToken = -1; > boolean openedString =false; >- boolean hasTokens = false; >+ boolean textOnNewLine = needIndentation; > > // Consume text token per token > while (!this.scanner.atEnd()) { >@@ -3147,13 +3192,16 @@ > previousToken = 1; > continue; > } >+ int tokensBufferLength = tokensBuffer.length(); > switch (token) { > case TerminalTokens.TokenNameWHITESPACE: > previousToken = token; >- buffer.append(tokensBuffer); >- this.column += tokensBuffer.length(); >- tokensBuffer.setLength(0); >- hasTokens = true; >+ if (tokensBufferLength > 0) { >+ buffer.append(tokensBuffer); >+ this.column += tokensBufferLength; >+ tokensBuffer.setLength(0); >+ } >+ textOnNewLine = false; > continue; > case TerminalTokens.TokenNameStringLiteral: > if (this.scanner.currentPosition > this.scanner.eofPosition) { >@@ -3173,21 +3221,29 @@ > int tokenStart = this.scanner.getCurrentTokenStartPosition(); > int tokenLength = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - tokenStart; > boolean insertSpace = previousToken == TerminalTokens.TokenNameWHITESPACE || (tokenStart == textStart && this.column > firstColumn && !(firstText || isHtmlTag)); >- int lastColumn = this.column + tokensBuffer.length() + tokenLength; >+ int lastColumn = this.column + tokensBufferLength + tokenLength; > if (insertSpace) lastColumn++; > if (headerLine) { > // special case when text is on the same line of the javadoc's header > if (lastColumn > maxColumn) { > lastColumn--; // new line gives an extra character >- this.lastNumberOfNewLines++; // in case we leave just after >+ this.lastNumberOfNewLines++; // the javadoc will become multi lines > this.line++; > } > } >- if (lastColumn > maxColumn) { >+ if (lastColumn > maxColumn && token != TerminalTokens.TokenNameAT && (tokensBufferLength == 0 || tokensBuffer.charAt(tokensBufferLength-1) != '@')) { > // not enough space on the line >- boolean alreadyHasNewLine = !hasTokens && tokensBuffer.length() > 0 && firstText && !isHtmlTag && this.lastNumberOfNewLines > 0; >- if (!alreadyHasNewLine) { >- if (lastColumn == this.column) { >+ if (!isHtmlTag && (firstColumn+tokensBufferLength+tokenLength) >= maxColumn) { >+ // there won't be enough room even if we break the line before the buffered tokens >+ // So add the buffered tokens now >+ buffer.append(tokensBuffer); >+ this.column += tokensBufferLength; >+ tokensBuffer.setLength(0); >+ tokensBufferLength = 0; >+ textOnNewLine = false; >+ } >+ if (!textOnNewLine) { >+ if (headerLine && lastColumn == this.column) { > this.lastNumberOfNewLines++; > this.line++; > } >@@ -3200,15 +3256,16 @@ > buffer.append(indentationBuffer); > } > } >- if (tokensBuffer.length() > 0) { >+ if (tokensBufferLength > 0) { > String tokensString = tokensBuffer.toString().trim(); > buffer.append(tokensString); > this.column += tokensString.length(); > tokensBuffer.setLength(0); >+ tokensBufferLength = 0; > } > buffer.append(this.scanner.source, tokenStart, tokenLength); >- hasTokens = true; > this.column += tokenLength; >+ textOnNewLine = false; > if (headerLine) { > firstColumn--; > headerLine = false; >Index: compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java,v >retrieving revision 1.72 >diff -u -r1.72 AbstractCommentParser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java 27 Apr 2008 16:28:45 -0000 1.72 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java 5 May 2008 16:01:57 -0000 >@@ -252,6 +252,8 @@ > } > } else if (verifText && this.tagValue == TAG_RETURN_VALUE && this.returnStatement != null) { > refreshReturnStatement(); >+ } else if (isFormatterParser) { >+ if (this.textStart == -1) this.textStart = previousPosition; > } > this.lineStarted = true; > break;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 230230
: 98655