Bug 503029 - ASTRewrite#rewriteAST(...) is adding an InsertEdit with one space before what was actually added
Summary: ASTRewrite#rewriteAST(...) is adding an InsertEdit with one space before what...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.5.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-03 00:49 EDT by Zane Ralston CLA
Modified: 2022-10-09 08:33 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zane Ralston CLA 2016-10-03 00:49:07 EDT
I'm trying to update Javadoc and I'm noticing an extra InsertEdit with one space before the InsertEdit that was actually made.

Here's a method in the compilation unit:

    /**
     * Creates a {@link Integer}
     */
     public Integer create(){}

What I'm trying to do is add a period at the end of the summary (after the Integer link tag).

Simplified code example:

    ListRewrite listRewrite = astRewrite.getListRewrite(tagElement, TagElement.FRAGMENTS_PROPERTY);
    ASTNode astNode = astRewrite.createStringPlaceholder(".", ASTNode.TEXT_ELEMENT);
    listRewrite.insertLast(astNode, (TextEditGroup) null);
    return astRewrite.rewriteAST(...);

The TextEdit that's returned from ASTRewrite#rewriteAST(...) is:

    {MultiTextEdit} [949,0] [undefined]
      {InsertEdit} [949,0] << 
      {InsertEdit} [949,0] <<.

The first InsertEdit has a space. Applying it to the compilation unit results in:

    /**
     * Creates a {@link Integer} .
     */
     public Integer create(){}

That's not what I was expecting at all. Can someone verify if this isn't working as intended? If anyone needs more information, let me know. Thanks.
Comment 1 Eclipse Genie CLA 2020-06-16 13:46:57 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 2 Eclipse Genie CLA 2022-10-09 08:33:59 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.