Abstract

Today's software developer depends on automated refactoring tools. While implementing such refactoring tools based on the Eclipse platform for a variety of languages, we faced the problem that carefully crafted formatting and comments can disappear when refactoring source code. This is annoying. Therefore, a useful refactoring tool should keep comments and move them along with the source code they belong to. We present different approaches on how to retain comments when refactoring source code. Usually comments are not present in an abstract syntax tree (AST) used by an integrated development environment (IDE). We achieve comment retention by associating them with nodes in an AST. The different attempts on gathering comments and implementing that association are shown and evaluated. Details of comment handling in different refactoring plug-ins that we have implemented for Eclipse, are given as well as a brief comparison with comment handling when refactoring with the Eclipse Java Development Tools (JDT). We hope, that this paper enables others to implement comment-preserving refactoring tools for more languages and IDEs. Every programmer, language and IDE deserves good refactoring support or they might become endangered.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.