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 15599 Details for
Bug 77538
[dom] AST rewrite fails to generate the modified code
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
More complete fix
77538_v01.txt (text/plain), 3.57 KB, created by
Frederic Fusier
on 2004-11-03 09:02:19 EST
(
hide
)
Description:
More complete fix
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2004-11-03 09:02:19 EST
Size:
3.57 KB
patch
obsolete
>Index: dom/org/eclipse/jdt/core/dom/DefaultCommentMapper.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultCommentMapper.java,v >retrieving revision 1.19 >diff -u -r1.19 DefaultCommentMapper.java >--- dom/org/eclipse/jdt/core/dom/DefaultCommentMapper.java 6 Oct 2004 10:50:51 -0000 1.19 >+++ dom/org/eclipse/jdt/core/dom/DefaultCommentMapper.java 3 Nov 2004 12:58:07 -0000 >@@ -10,7 +10,10 @@ > *******************************************************************************/ > package org.eclipse.jdt.core.dom; > >+import java.util.ArrayList; > import java.util.HashMap; >+import java.util.Iterator; >+import java.util.List; > > import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.core.compiler.InvalidInputException; >@@ -367,8 +370,9 @@ > int nodeEnd = node.getStartPosition()+node.getLength()-1; > if (nodeEnd == nextStart) { > // special case for last child of its parent >- this.trailingComments.put(node, new int[] { -1, -1 }); >- return nodeEnd; >+// this.trailingComments.put(node, new int[] { -1, -1 }); >+// return nodeEnd; >+ return -1; > } > int extended = nodeEnd; > >@@ -453,7 +457,8 @@ > > class CommentMapperVisitor extends DefaultASTVisitor { > >- HashMap waitingSiblings = new HashMap(10); >+ HashMap waitingSiblings = new HashMap(); >+ HashMap unresolvedNodes = new HashMap(); > > protected boolean visitNode(ASTNode node) { > >@@ -462,11 +467,12 @@ > int previousEnd = parent.getStartPosition(); > > // Look for sibling node >- ASTNode sibling = (ASTNode) this.waitingSiblings.get(parent); >+ ASTNode sibling = (ASTNode) this.waitingSiblings.remove(parent); > if (sibling != null) { > // Found one previous sibling, so compute its trailing comments using current node start position > try { > previousEnd = storeTrailingComments(sibling, node.getStartPosition(), false); >+ if (previousEnd == -1) previousEnd = node.getStartPosition(); > } catch (Exception ex) { > // Give up extended ranges at this level if unexpected exception happens... > } >@@ -488,11 +494,33 @@ > > protected void endVisitNode(ASTNode node) { > >+ // Look for unresolved extended position at level n+2... >+ List list = (List) this.unresolvedNodes.remove(node); >+ if (list != null) { >+ Iterator grandChildren = list.listIterator(); >+ while (grandChildren.hasNext()) { >+ ASTNode grandChild = (ASTNode) grandChildren.next(); >+ int[] range = (int[]) trailingComments.get(grandChild.getParent()); >+ if (range != null) { >+ trailingComments.put(grandChild, range); >+ } >+ } >+ } >+ > // Look if a child node is waiting for trailing comments computing >- ASTNode sibling = (ASTNode) this.waitingSiblings.get(node); >+ ASTNode sibling = (ASTNode) this.waitingSiblings.remove(node); > if (sibling != null) { > try { >- storeTrailingComments(sibling, node.getStartPosition()+node.getLength()-1, true); >+ if (storeTrailingComments(sibling, node.getStartPosition()+node.getLength()-1, true) == -1) { >+ // Unable to resolve extended position for this node >+ ASTNode parent = node.getParent(); >+ if (parent != null) { >+ List grandChildren = (List) unresolvedNodes.get(parent); >+ if (grandChildren == null) >+ unresolvedNodes.put(parent, grandChildren = new ArrayList()); >+ grandChildren.add(sibling); >+ } >+ } > } catch (Exception ex) { > // Give up extended ranges at this level if unexpected exception happens... > }
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 77538
:
15577
|
15578
| 15599