Automatic Refactoring Method of Cloned Code Using Abstract Syntax Tree and Static Analysis

于冬琦,彭鑫,赵文耘
2009-01-01
Abstract:Code clone in single software system or several similar systems makes software maintenance very difficult.This paper offers an automatic refactoring method of detected cloned code based on abstract syntax tree and static analysis.At first,this method builds abstract syntax trees for cloned code separately.Then the difference between statements is used to establish the relationship between flow control statements in abstract syntax trees.Based on these steps,this method analyses the difference between flow control statements and the difference between simple statement blocks,and finally combines the cloned code through extracting the variation points in source code.We have developed a prototype tool which supports refatoring of cloned code of Java.And experiments on automatic refactoring are taken on JDK1.5 and a business system.The initial result shows that this method can assist developer achieve the goal of automatically refatoring of cloned code both accurately and effectively.
What problem does this paper attempt to address?