An Algorithm for Detecting and Removing Clones in Java Code

This paper proposes a new algorithm for automatically detecting and removing duplicated code in existing Java programs. Its purpose is to improve the structure of small code snippets (as in refactoring), rather than reducing the overall redundancy in huge legacy programs. As such, approaches that favor code clarity over efficiency are introduced. The skeleton of our algorithm is presented and illustrated on concrete examples of code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

[1]  Joe D. Warren,et al.  The program dependence graph and its use in optimization , 1987, TOPL.

[2]  William G. Griswold,et al.  Automated assistance for program restructuring , 1993, TSEM.

[3]  D. J. Wheeler,et al.  A Block-sorting Lossless Data Compression Algorithm , 1994 .

[4]  L. D. Moura,et al.  Clone detection using abstract syntax trees , 1998, Proceedings. International Conference on Software Maintenance (Cat. No. 98CB36272).

[5]  Susan Horwitz,et al.  Tool Demonstration: Finding Duplicated Code Using Program Dependences , 2001, ESOP.

[6]  Susan Horwitz,et al.  Effective, automatic procedure extraction , 2003, 11th IEEE International Workshop on Program Comprehension, 2003..

[7]  Serge Demeyer,et al.  Evaluating clone detection techniques , 2003 .

[8]  Tom Mens,et al.  A survey of software refactoring , 2004, IEEE Transactions on Software Engineering.

[9]  Sadam Fujioka,et al.  Code , 2021, SIGGRAPH Art Gallery.

[10]  Oege de Moor,et al.  JunGL: a scripting language for refactoring , 2006, ICSE.

[11]  Béat Hirsbrunner,et al.  FOOD: An Intermediate Model for Automated Refactoring , 2006, SoMeT.

[12]  J. W. Hunt,et al.  An Algorithm for Differential File Comparison , 2008 .