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 75133 Details for
Bug 109636
Comment formatter doesn't support "*/"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Second fix
109636_2.diff (text/plain), 4.74 KB, created by
Matt McCutchen
on 2007-08-01 12:50:46 EDT
(
hide
)
Description:
Second fix
Filename:
MIME Type:
Creator:
Matt McCutchen
Created:
2007-08-01 12:50:46 EDT
Size:
4.74 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: formatter/org/eclipse/jdt/internal/formatter/comment/Java2HTMLEntityReader.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/comment/Java2HTMLEntityReader.java,v >retrieving revision 1.6 >diff -u -r1.6 Java2HTMLEntityReader.java >--- formatter/org/eclipse/jdt/internal/formatter/comment/Java2HTMLEntityReader.java 31 Jul 2007 02:36:10 -0000 1.6 >+++ formatter/org/eclipse/jdt/internal/formatter/comment/Java2HTMLEntityReader.java 1 Aug 2007 16:46:55 -0000 >@@ -62,30 +62,49 @@ > * @see org.eclipse.jdt.internal.ui.text.SubstitutionTextReader#computeSubstitution(int) > */ > protected String computeSubstitution(int c) throws IOException { >- /* >- * When @ is first on a line, translate it to @ so it isn't >- * misinterpreted as a Javadoc tag. >- * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=197169 >- */ >- if (c == '@') { >- return (this.bits & BEGIN_LINE) != 0 ? "@" : null; //$NON-NLS-1$ >- } >- if (c == '*') { >+ StringBuffer buf = new StringBuffer(); >+ // Accumulate *s into the buffer until we see something other than *. >+ while (c == '*') { > this.bits &= ~BEGIN_LINE; >- int next = nextChar(); >- if (next == '/') { >- return "*/"; //$NON-NLS-1$ >- } >- if (next == -1) { >- return "*"; //$NON-NLS-1$ >- } >- return "*" + (char) next; //$NON-NLS-1$ >+ c = nextChar(); >+ buf.append('*'); >+ } >+ if (c == -1) >+ // Snippet must have ended with *s. Just return them. >+ return buf.toString(); >+ if (c == '/' && buf.length() > 0) { >+ /* >+ * Translate a * that precedes a / to * so it isn't >+ * misinterpreted as the end of the Javadoc comment that contains >+ * the code we are formatting. >+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=109636 >+ */ >+ buf.setLength(buf.length() - 1); >+ buf.append("*/"); //$NON-NLS-1$ >+ } else if (c == '@' && (this.bits & BEGIN_LINE) != 0) { >+ /* >+ * When @ is first on a line, translate it to @ so it isn't >+ * misinterpreted as a Javadoc tag. >+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=197169 >+ */ >+ buf.append("@"); //$NON-NLS-1$ >+ } else { >+ /* >+ * Ordinary processing. If the character needs an entity in HTML, >+ * add the entity, otherwise add the character. >+ */ >+ String entity = (String) fgEntityLookup.get(String.valueOf((char) c)); >+ if (entity != null) >+ buf.append(entity); >+ else >+ buf.append((char) c); > } >+ // Update bits for the benefit of the next character. > if (c == '\n' || c == '\r') { > this.bits |= BEGIN_LINE; > } else if (!ScannerHelper.isWhitespace((char) c)) { > this.bits &= ~BEGIN_LINE; > } >- return (String) fgEntityLookup.get(String.valueOf((char) c)); >+ return buf.toString(); > } > } >Index: formatter/org/eclipse/jdt/internal/formatter/comment/SubstitutionTextReader.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/comment/SubstitutionTextReader.java,v >retrieving revision 1.3 >diff -u -r1.3 SubstitutionTextReader.java >--- formatter/org/eclipse/jdt/internal/formatter/comment/SubstitutionTextReader.java 29 Mar 2006 03:00:05 -0000 1.3 >+++ formatter/org/eclipse/jdt/internal/formatter/comment/SubstitutionTextReader.java 1 Aug 2007 16:46:55 -0000 >@@ -113,7 +113,7 @@ > do { > > c= nextChar(); >- while (!fReadFromBuffer) { >+ while (!fReadFromBuffer && c != -1) { > String s= computeSubstitution(c); > if (s == null) > break; >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/formatter/comment/JavaDocTestCase.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/comment/JavaDocTestCase.java,v >retrieving revision 1.16 >diff -u -r1.16 JavaDocTestCase.java >--- src/org/eclipse/jdt/core/tests/formatter/comment/JavaDocTestCase.java 1 Aug 2007 15:46:05 -0000 1.16 >+++ src/org/eclipse/jdt/core/tests/formatter/comment/JavaDocTestCase.java 1 Aug 2007 16:46:57 -0000 >@@ -892,7 +892,7 @@ > assertEquals(expected, result); > } > >- public void _test109636_2() { >+ public void test109636_2() { > Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); > > String input = >@@ -907,7 +907,7 @@ > "/**" + DELIMITER + > " * <pre>" + DELIMITER + > " * /* Comment ending in multiple stars **/" + DELIMITER + >- " * /* Entity-needing character after a star *< */" + DELIMITER + >+ " * /* Entity-needing character after a star *< */" + DELIMITER + > " * </pre>" + DELIMITER + > " */"; > String result=testFormat(input, options);
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 109636
:
74987
|
74988
| 75133