How to use ASTRewrite split one field declaration into two?

Posted by user307598 on Stack Overflow See other posts from Stack Overflow or by user307598
Published on 2010-04-02T10:20:49Z Indexed on 2010/04/02 10:23 UTC
Read the original article Hit count: 182

Filed under:
|

For example:

private long p, q, g, h;

I want to split this field declaration as:

private long p;
private long q, g, h;

How can I use ASTRewrite to do it? I tried to use ASTNode copyFd = rewriter.createCopyTarget(fd) to copy the field declaration, modify it, then add to field declaration list, but my modification on copyFd is not seen. It's just the same to fd. Why? Anybody can help?

© Stack Overflow or respective owner

Related posts about java

Related posts about jdt