CReN: a tool for tracking copy-and-paste code clones and renaming identifiers consistently in the IDE

  • Authors:
  • Patricia Jablonski;Daqing Hou

  • Affiliations:
  • Clarkson University, Potsdam, NY;Clarkson University, Potsdam, NY

  • Venue:
  • Proceedings of the 2007 OOPSLA workshop on eclipse technology eXchange
  • Year:
  • 2007

Quantified Score

Hi-index 0.00

Visualization

Abstract

Programmers often copy and paste code so that they can reuse the existing code to complete a similar task. Many times, modifications to the newly pasted code include renaming all instances of an identifier, such as a variable name, consistently throughout the fragment. When these modifications are done manually, undetected inconsistencies and errors can result in the code, for example, a single instance can be missed and mistakenly not renamed. To help programmers avoid making this type of copy-paste error, we created a tool, named CReN, to provide tracking and identifier renaming support within copy-and-paste clones in an integrated development environment (IDE). CReN tracks the code clones involved when copying and pasting occurs in the IDE and infers a set of rules based on the relationships between the identifiers in these code fragments. These rules capture the programmer's intentions, for example, that a particular group of identifiers should be renamed consistently together. Programmers can also provide feedback to improve the accuracy of the inferred rules by specifying that a particular instance of an identifier is to be renamed separately. We introduce our CReN tool, which is implemented as an Eclipse plug-in in Java.