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 106845 Details for
Bug 239719
[formatter] Code formatter destroys pre formatted javadoc comments
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), 4.79 KB, created by
Frederic Fusier
on 2008-07-08 12:41:52 EDT
(
hide
)
Description:
Proposed patch for R3_4_maintenance stream
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2008-07-08 12:41:52 EDT
Size:
4.79 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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.7 >diff -u -r1.11.2.7 FormatterCommentsBugsTest.java >--- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 3 Jul 2008 09:19:59 -0000 1.11.2.7 >+++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 8 Jul 2008 16:12:37 -0000 >@@ -1722,4 +1722,91 @@ > "}\n" > ); > } >+ >+/** >+ * @bug 239719: [formatter] Code formatter destroys pre formatted javadoc comments >+ * @test Ensure that annotations inside <pre>...</pre> tags are not considered as javadoc tags >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=239719" >+ */ >+public void testBug239719() throws JavaModelException { >+ String source = >+ "/**\n" + >+ " * <pre>\n" + >+ " * public class Test implements Runnable\n" + >+ " * {\n" + >+ " * @Override\n" + >+ " * public void run()\n" + >+ " * { \n" + >+ " * // Hello really bad Ganymede formatter !!!\n" + >+ " * // Shit happens when somebody tries to change a running system\n" + >+ " * System.out.println(\"Press Shift+Ctrl+F to format\");\n" + >+ " * }\n" + >+ " * }</pre>\n" + >+ " */\n" + >+ " public class Test \n" + >+ " {\n" + >+ " }\n"; >+ formatSource(source, >+ "/**\n" + >+ " * <pre>\n" + >+ " * public class Test implements Runnable {\n" + >+ " * @Override\n" + >+ " * public void run() {\n" + >+ " * // Hello really bad Ganymede formatter !!!\n" + >+ " * // Shit happens when somebody tries to change a running system\n" + >+ " * System.out.println("Press Shift+Ctrl+F to format");\n" + >+ " * }\n" + >+ " * }\n" + >+ " * </pre>\n" + >+ " */\n" + >+ "public class Test {\n" + >+ "}\n" >+ ); >+} >+public void testBug239719b() throws JavaModelException { >+ String source = >+ "public class X01 {\n" + >+ " \n" + >+ " private int fLength;\n" + >+ " private int fOffset;\n" + >+ "\n" + >+ " /**\n" + >+ " * Returns the inclusive end position of this edit. The inclusive end\n" + >+ " * position denotes the last character of the region manipulated by\n" + >+ " * this edit. The returned value is the result of the following\n" + >+ " * calculation:\n" + >+ " * <pre>\n" + >+ " * getOffset() + getLength() - 1;\n" + >+ " * <pre>\n" + >+ " * \n" + >+ " * @return the inclusive end position\n" + >+ " */\n" + >+ " public final int getInclusiveEnd() {\n" + >+ " return fOffset + fLength - 1;\n" + >+ " }\n" + >+ "}\n"; >+ formatSource(source, >+ "public class X01 {\n" + >+ "\n" + >+ " private int fLength;\n" + >+ " private int fOffset;\n" + >+ "\n" + >+ " /**\n" + >+ " * Returns the inclusive end position of this edit. The inclusive end\n" + >+ " * position denotes the last character of the region manipulated by this\n" + >+ " * edit. The returned value is the result of the following calculation:\n" + >+ " * \n" + >+ " * <pre>\n" + >+ " * getOffset() + getLength() - 1;\n" + >+ " * \n" + >+ " * <pre>\n" + >+ " * \n" + >+ " * @return the inclusive end position\n" + >+ " */\n" + >+ " public final int getInclusiveEnd() {\n" + >+ " return fOffset + fLength - 1;\n" + >+ " }\n" + >+ "}\n" >+ ); >+} > } >#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.13.2.5 >diff -u -r1.13.2.5 FormatterCommentParser.java >--- formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java 3 Jul 2008 09:19:57 -0000 1.13.2.5 >+++ formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java 8 Jul 2008 16:12:38 -0000 >@@ -371,9 +371,20 @@ > * @see org.eclipse.jdt.internal.compiler.parser.JavadocParser#parseTag(int) > */ > protected boolean parseTag(int previousPosition) throws InvalidInputException { >- int ptr = this.astPtr; >- >+ >+ // Do not parse javadoc tag inside <pre>...</pre> tags >+ if (this.htmlTagsPtr >= 0) { >+ int ptr = this.htmlTagsPtr; >+ while (ptr >= 0) { >+ if (getHtmlTagIndex(this.htmlTags[ptr--]) == JAVADOC_CODE_TAGS_ID) { >+ if (this.textStart == -1) this.textStart = previousPosition; >+ return true; >+ } >+ } >+ } >+ > // Read tag name >+ int ptr = this.astPtr; > this.tagSourceStart = previousPosition; > this.scanner.startPosition = this.index; > this.scanner.currentCharacter = readChar();
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 239719
:
106803
| 106845