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 122271 Details for
Bug 239607
[formatter] Incorrect removal of asterisk (*) within a block comment when formatting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch for R3_4_maintenance stream
v01.txt (text/plain), 6.96 KB, created by
Frederic Fusier
on 2009-01-12 10:29:58 EST
(
hide
)
Description:
Proposed patch for R3_4_maintenance stream
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2009-01-12 10:29:58 EST
Size:
6.96 KB
patch
obsolete
>### 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.143.2.5 >diff -u -r1.143.2.5 Scribe.java >--- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 21 Aug 2008 16:15:35 -0000 1.143.2.5 >+++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 9 Jan 2009 10:29:44 -0000 >@@ -1350,7 +1350,7 @@ > } else { > previousToken = token; > } >- lineNumber = Util.getLineNumber(this.scanner.getCurrentTokenEndPosition(), this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines); >+ lineNumber = Util.getLineNumber(this.scanner.currentPosition, this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines); > if (lineNumber > scannerLine) { > hasMultiLines = true; > newLine = true; >@@ -1359,7 +1359,7 @@ > continue; > case TerminalTokens.TokenNameMULTIPLY: > previousToken = token; >- lineNumber = Util.getLineNumber(this.scanner.getCurrentTokenEndPosition(), this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines); >+ lineNumber = Util.getLineNumber(this.scanner.currentPosition, this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines); > if (this.scanner.currentCharacter == '/') { > editEnd = this.scanner.startPosition - 1; > // Add remaining buffered tokens >@@ -1378,14 +1378,18 @@ > this.scanner.getNextChar(); // reach the end of scanner > continue; > } >- scannerLine = lineNumber; >- continue; >+ if (newLine) { >+ scannerLine = lineNumber; >+ newLine = false; >+ continue; >+ } >+ break; > case TerminalTokens.TokenNameMULTIPLY_EQUAL: > if (newLine) { > this.scanner.resetTo(this.scanner.startPosition, currentTokenEndPosition-1); > this.scanner.getNextChar(); // consume the multiply > previousToken = TerminalTokens.TokenNameMULTIPLY; >- scannerLine = Util.getLineNumber(this.scanner.getCurrentTokenEndPosition(), this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines); >+ scannerLine = Util.getLineNumber(this.scanner.currentPosition, this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines); > continue; > } > case TerminalTokens.TokenNameMINUS: >@@ -1406,7 +1410,7 @@ > // Look at gap and insert corresponding lines if necessary > int linesGap; > int max; >- lineNumber = Util.getLineNumber(this.scanner.getCurrentTokenEndPosition(), this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines); >+ lineNumber = Util.getLineNumber(this.scanner.currentPosition, this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines); > if (lastTextLine == -1) { > linesGap = lineNumber - firstLine; > max = 0; >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.75.2.3 >diff -u -r1.75.2.3 AbstractCommentParser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java 21 Aug 2008 08:44:19 -0000 1.75.2.3 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java 9 Jan 2009 10:29:43 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -326,9 +326,9 @@ > if (previousChar != '*') { > this.starPosition = previousPosition; > if (isDomParser || isFormatterParser) { >- if (lineHasStar && !this.lineStarted) { >+ if (lineHasStar) { > this.lineStarted = true; >- this.textStart = previousPosition; >+ if (this.textStart == -1) this.textStart = previousPosition; > } > if (!this.lineStarted) { > lineHasStar = true; >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java,v >retrieving revision 1.11.2.12 >diff -u -r1.11.2.12 FormatterCommentsBugsTest.java >--- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 21 Aug 2008 16:15:36 -0000 1.11.2.12 >+++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 9 Jan 2009 10:29:45 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -1966,4 +1966,64 @@ > " public native Object[] getSigners();\n" + > "}\n" > ); >-}} >+} >+ >+/** >+ * @bug 260274: [formatter] * character is removed while formatting block comments >+ * @test Ensure that the comment formatter keep '*' characters while formatting block comments >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=260274" >+ */ >+public void testBug260274() throws JavaModelException { >+ String source = >+ "class X {\n" + >+ "/*\n" + >+ " * The formatter should NOT remove * character\n" + >+ " * in block comments!\n" + >+ " */\n" + >+ "}\n"; >+ formatSource(source, >+ "class X {\n" + >+ " /*\n" + >+ " * The formatter should NOT remove * character in block comments!\n" + >+ " */\n" + >+ "}\n" >+ ); >+} >+public void testBug260274b() throws JavaModelException { >+ String source = >+ "class X {\n" + >+ "/*\n" + >+ " * The formatter should keep \'*\' characters\n" + >+ " * in block comments!\n" + >+ " */\n" + >+ "}\n"; >+ formatSource(source, >+ "class X {\n" + >+ " /*\n" + >+ " * The formatter should keep \'*\' characters in block comments!\n" + >+ " */\n" + >+ "}\n" >+ ); >+} >+public void testBug260274c() throws JavaModelException { >+ String source = >+ "class X {\n" + >+ " /**\n" + >+ " * @see #spacing(Point)\n" + >+ " * * @see #spacing(int, int)\n" + >+ " */\n" + >+ " public void foo() {\n" + >+ " }\n" + >+ "}\n"; >+ formatSource(source, >+ "class X {\n" + >+ " /**\n" + >+ " * @see #spacing(Point) * @see #spacing(int, int)\n" + >+ " */\n" + >+ " public void foo() {\n" + >+ " }\n" + >+ "}\n" >+ ); >+} >+ >+}
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 239607
: 122271