摘要
冗余代码普遍存在于商业和开源软件中,它的存在可能会增加内存占用,影响代码可维护性,增加维护成本。快速类型分析算法是当前Java冗余代码检测中常用的静态分析方法,该算法在虚方法分析方面还存在一些不足。XTA是一种调用图构造算法,在处理虚方法的调用方面具有较高的精度和效率。文中提出了一种基于XTA调用图构建算法的方法来检测Java代码中的冗余代码,在一个名为“RCD”(Redundant Code Detection)的工具原型中实现了这种方法,并通过构建知识图谱辅助人工审查,以提高人工审查的效率以及冗余代码检测的可信度。通过在4个开源Java应用程序上的实验对RCD与其他3个冗余代码检测工具进行了比较。实验结果表明,RCD在检测冗余代码的准确性方面相比其他工具提高了1%~30%,同时在检测冗余虚方法的完整性方面提升了4%左右。
Redundant code is common in commercial and open source software, and its presence can increase memory footprint, affect code maintainability, and increase maintenance costs.Rapid type analysis algorithm is a common static analysis method in Java redundant code detection, but it still has some shortcomings in virtual method analysis.XTA is a call graph construction algorithm with high precision and efficiency in handling virtual method calls.A method based on XTA call graph construction algorithm is proposed to detect redundant code in Java code.This method is implemented in a prototype tool called redundant code Detection(RCD),and the knowledge graph is constructed to assist manual review to improve the efficiency of manual review and the reliability of redundant code detection.RCD is compared with three other redundant code detection tools by experiments on four open source Java applications.Experimental results show that RCD improves the accuracy of detecting redundant codes by 1%~30% compared with other tools, and improves the integrity of detecting redundant virtual methods by about 4%.
作者
刘昕炜
陶传奇
LIU Xinwei;TAO Chuanqi(College of Computer Science and Technology,Nanjing University of Aeronautics and Astronautics,Nanjing 210016,China;Ministry Key Laboratory for Safety-Critical Software Development and Verification,Nanjing 210016,China;State Key Laboratory for Novel Software Technology,Nanjing 210023,China;Collaborative Innovation Center of Novel Software Technology and Industrialization,Nanjing 210016,China)
出处
《计算机科学》
CSCD
北大核心
2023年第3期65-71,共7页
Computer Science
关键词
冗余代码检测
调用图构建
静态分析
知识图谱
Redundant code detection
Call graph construction
Static analysis
Knowledge graph