期刊文献+

使用抽象语法树和静态分析的克隆代码自动重构方法 被引量:14

Automatic Refactoring Method of Cloned Code Using Abstract Syntax Tree and Static Analysis
下载PDF
导出
摘要 单个软件系统中以及若干个相似系统之间的代码克隆给软件维护增加了很大困难.本文针对运用克隆侦测发现的相似代码片断,提出一种基于抽象语法树和静态分析的代码自动重构方法.该方法首先为克隆代码分别构造抽象语法树,然后运用语句差异度指标建立起语法树之间流程控制语句的对应关系.在此基础上,该方法根据控制流程和基本语句块两个层次上的差异性分析,最终通过代码可变点提取实现克隆代码的自动合并.针对Java代码开发了克隆代码重构支持工具原型,并分别针对JDK1.5和一个业务系统进行了自动重构实验.初步的结果表明,该方法能够准确、有效地辅助开发者实现克隆代码的自动重构. 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.
出处 《小型微型计算机系统》 CSCD 北大核心 2009年第9期1752-1760,共9页 Journal of Chinese Computer Systems
基金 国家自然科学基金项目(60703092)资助 国家"八六三"高技术研究发展计划项目(2006AA01Z189 2007AA01Z125)资助
关键词 可变点提取 代码克隆 抽象语法树 再工程 逆向工程 variation point extraction code clone abstract syntax tree reengineering reverse engineering
  • 相关文献

参考文献9

  • 1Toshihiro Kamiya, Shinji Kusumoto, Katsuro Inoue. CCFinder: a multilinguistic token-based code clone detection system for large scale source c.ode[ J]. IEEE Transactions on Software Engineering, 2002, 28(7) : 654-670. 被引量:1
  • 2Ira D Baxter, Andrew Yahin, Leonardo Moura, et al. Clone detection using abstract syntax trees[ C]. Proceedings of the Internation- al Conference on Software Maintenance, 1998, 368-377. 被引量:1
  • 3Komondoor R, Horwitz S. Using slicing to identify duplication in source code[ C]. Proceedings of the 8th International Symposium on Static Analysis, 2001, 40 - 56. 被引量:1
  • 4Higo Y, Kamiya T, Kusumoto S, et al. Refactoring support based on code clone analysis[ C]. Proceedings of 5th International Conference on Product Focused Software Process Improvement, April 2004, 220-233. 被引量:1
  • 5Bas Comelissen, Bas Graaf, Leon Moonen. Identification of variation points using dynamic analysis[ C]. Proceedings of First International Workshop on Reengineering Towards Product Lines, November 2005, 9-13. 被引量:1
  • 6Simian [ EB/OL]. http://www, redhillconsulting, com. au/products/simian/, Accessed October 2007. 被引量:1
  • 7JTB [ EB/OL]. http ://compilers. cs. ucla. edu/jtb/, Accessed October 2007. 被引量:1
  • 8JavaCC[ EB/OL]. https://javacc, dev. java. net/, Accessed October 2007. 被引量:1
  • 9JDK1.5 [ EB/OL]. http://java, sun. com/javase/downloads/index. jsp, Accessed March 2008. 被引量:1

同被引文献120

  • 1曹羽中,金茂忠,刘超.克隆代码检测技术综述[J].计算机工程与科学,2006,28(z2):9-13. 被引量:6
  • 2廖兴,尹俊文,蔡放.基于Java语言的抽象语法树的创建与遍历[J].长沙大学学报,2004,18(4):50-53. 被引量:5
  • 3单永明.一种源程序到控制流图的自动生成方法[J].小型微型计算机系统,1996,17(10):45-49. 被引量:7
  • 4高传平,谈利群,宫云战.基于抽象语法树的代码静态自动测试方法研究[J].北京化工大学学报(自然科学版),2007,34(A01):25-29. 被引量:10
  • 5JDK1.5 [ CP/OL ]. http://java, sun. com/javase/downloads/ index, j sp, 2008 -03 - 01. 被引量:1
  • 6Toshihiro Kamiya, Shinji Kusumoto, Katsuro Inoue. CCFinder: a multilinguistic token-based code clone detection system for large scale source code[J].IEEE Transactions on Software Engineering, 2002,28 (7) : 654 - 670. 被引量:1
  • 7Ira D Baxter, Andrew Yahin, Leonardo Moura, et al. Clone detection using abstract syntax trees [ A ]. In: Proceedings of the International Conference on Software Maintenance[ C ]. Maryland, USA: IEEE CS, 1998.368 - 377. 被引量:1
  • 8Raghavan Komondoor, Susan Horwitz. Using slicing to identify duplication in source code[ A]. In: Proceedings of the 8th International Symposium on Static Analysis (LNCS 2126)[C]. Germany: Springer, 2001.40 - 56. 被引量:1
  • 9Jens Krinke. Identifying similar code with program dependence graphs[ A ]. In:Proceedings of the 8th Working Conference on Reverse Engineering [ C ]. Germany: ACM Press, 2001. 301 - 309. 被引量:1
  • 10Chao Liu, Chen Chen, Jiawei Han, Philip S Yu. GPLAG: Detection of software plagiarism by program dependence graph analysis[ A] .In:Proceedings of the 12th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining [ C ]. Philadelphia, USA: ACM Press. 2006. 872 - 881. 被引量:1

引证文献14

二级引证文献39

相关作者

内容加载中请稍等...

相关机构

内容加载中请稍等...

相关主题

内容加载中请稍等...

浏览历史

内容加载中请稍等...
;
使用帮助 返回顶部