计算机科学 ›› 2023, Vol. 50 ›› Issue (3): 65-71.doi: 10.11896/jsjkx.220700240
• 知识图谱赋能的知识工程:理论、技术与系统专题 • 上一篇 下一篇
刘昕炜1, 陶传奇1,2,3,4
LIU Xinwei1, TAO Chuanqi1,2,3,4
摘要: 冗余代码普遍存在于商业和开源软件中,它的存在可能会增加内存占用,影响代码可维护性,增加维护成本。快速类型分析算法是当前Java冗余代码检测中常用的静态分析方法,该算法在虚方法分析方面还存在一些不足。XTA是一种调用图构造算法,在处理虚方法的调用方面具有较高的精度和效率。文中提出了一种基于XTA调用图构建算法的方法来检测Java代码中的冗余代码,在一个名为“RCD”(Redundant Code Detection)的工具原型中实现了这种方法,并通过构建知识图谱辅助人工审查,以提高人工审查的效率以及冗余代码检测的可信度。通过在4个开源Java应用程序上的实验对RCD与其他3个冗余代码检测工具进行了比较。实验结果表明,RCD在检测冗余代码的准确性方面相比其他工具提高了1%~30%,同时在检测冗余虚方法的完整性方面提升了4%左右。
中图分类号:
[1]BROWN W J,MALVEAU R C,MCCORMICK H W,et al.AntiPatterns:Refactoring Software,Architectures,and Projects in Crisis[M].New York:John Wiley & Sons,Inc.,1998. [2]BOOMSMA H,GROSS H G.Dead code elimination for websystems written in PHP:Lessons learned from an industry case[C]//IEEE International Conference on Software Mainte-nance.IEEE,2013:511-515. [3]ROMANO S,SCANNIELLO G,SARTIANI C,et al.A graph-based approach to detect unreachabl-e methods in Java software[C]//Acm Symposium on Applied Computing.ACM,2016:1538-1541. [4]YAMASHITA A,MOONEN L.Do developers car-e about code smells? An exploratory survey[C]//Reverse Engineering.IEEE,2013:242-251. [5]MÄNTYLÄ M,VANHANEN J,LASSENIUS C.A Taxonomy and an Initial Empirical Study of Bad Smells in Code[C]//International Conference on Software Maintenance.IEEE,2003:381-384. [6]FARD A M,MESBAH A.JSNOSE:Detecting JavaScript Code Smells[C]//IEEE International Working Conference on Source Code Analysis & Manipulation.IEEE Computer Society,2013:116-125. [7]ROMANO S,VENDOME C,SCANNIELLO G,et al.A Multi-study Investigation Into Dead Code[J].IEEE Transactions on Software Engineering,2018,46(1):71-99. [8]EDER S,JUNKER M,JURGENS E,et al.How much does unused code matter for maintenance?[C]//2012 34th International Conference on Software Engineering(ICSE).Switzerland:IEEE,2012:1102-1111. [9]CHEN K R,VÁCLAV R.Case study of feature location using dependence graph[C]//8th International Workshop on Program Comprehension(IWPC).Limerick:IEEE,2000:241-247. [10]ROMANO S,SCANNIELLO G.DUM-Tool[C]//2015 IEEE International Conference on Software Maintenance and Evolution.Bremen:IEEE,2015:339-341. [11]WANG W.Research on C redundant code and related defect detection methods[D].Harbin:Harbin Institute of technology,2010. [12]GONG D D,WANG T T,SU X H,et al.Redund-ant code defect detection method[J].Journal of Harbin Institute of technology,2012,44(7):58-63. [13]GONG D,WANG T,SU X,et al.RCfinder:redundancy detection for largescale source code[C]//2012 second International Conference on Instrumentation,Measurement,Computer,Communication and Control.Harbin:IEEE,2012:243-248. [14]SHOU N,ZHAO F Y.Research on redundancy detection and defect based on nrefactory[J].Small microcomputer system,2015,36(9):1973-1976. [15]LEITAO A M.Detection of redundant code using R2D2[J].Software Quality Journal,2004,12(4):361-382. [16]ALABWAINI N,ALDAAJE A,JABER T.Using Program Slicing to Detect the Dead Code[C]//2018 8th International Conference on Computer Science and Information Technology.2018:230-233. [17]SCANNIELLO G.Source code survival with the Kaplan Meier[C]//IEEE International Conference on Software Maintenance.IEEE,2011:524-527. [18]SCANNIELLO G.An Investigation of Object-Oriented andCode-Size Metrics as Dead Code Predictors[C]//IEEE Compu-ter Society.2014:392-397. [19]WANG X,ZHANG Y,ZHAO L,et al.Dead code detectionmethod based on program slicing[C]//2017 International Conference on Cyber-enabled Distributed Computing and Know-ledge Discovery(CyberC).Guilin:IEEE,2017. [20]OBBINK N G,MALAVOLTA I,LUCA G,et al.An extensible approach for taming the challenges of JavaScript dead code eli-mination[C]//IEEE International Conference on Software Analysis,Evolution and Reengineering.Antwerp,Belgium:IEEE,2018:291-401. [21]TIP F,PALSBERG J.Scalable propagation-based call graphconstruction algorithms[C]//Proceedings of the 2000 ACM Conference on Object-Oriented Programming Systems,Languages and Applications.Minnesota:ACM,2000:281-293. [22]LIN Z Q,XIE B,ZOU Y Z,et al.IntelligentDevelopment Environment and Software Kno-wledge Graph[J].Journal of Computer Science and Technology,2017,32(2):242-249. [23]LIU Q,LI Y,DUAN H.Knowledge graph costruction tech-niques[J].Journal of Computer Research and Development,2016,32(2):242-249. [24]ZHANG X,LIU X,LI X,et al.An approach to generate metallic materials knowledge graph based on DBpedia and Wikipedia[J].Computer Physics Communications,2017,211(1):98-112. [25]SUN X B,WANG L,WANG J W,et al.Construct Knowledge Graph for Exploratory Bug Issue Searching[J].Acta Electronica Sinica,2018,46(7):1578-1583. [26]LIN X,LIANG Y,GIUNCHIGLIA F,et al.Relation path embedding in knowledge graphs[J].Neural Computing and Applications,2018,31(9):5629-5639. |
[1] | 马廷淮, 孙圣杰, 荣欢, 钱敏峰. 基于动态记忆和双层重构强化的知识图谱至文本转译模型 Knowledge Graph-to-Text Model Based on Dynamic Memory and Two-layer Reconstruction Reinforcement 计算机科学, 2023, 50(3): 12-22. https://doi.org/10.11896/jsjkx.220700111 |
[2] | 汪璟玢, 赖晓连, 林新宇, 杨心逸. 基于关系约束的上下文感知时态知识图谱补全 Context-aware Temporal Knowledge Graph Completion Based on Relation Constraints 计算机科学, 2023, 50(3): 23-33. https://doi.org/10.11896/jsjkx.220400255 |
[3] | 陈富强, 寇嘉敏, 苏利敏, 李克. 基于图神经网络的多信息优化实体对齐模型 Multi-information Optimized Entity Alignment Model Based on Graph Neural Network 计算机科学, 2023, 50(3): 34-41. https://doi.org/10.11896/jsjkx.220700242 |
[4] | 陈姝睿, 梁子然, 饶洋辉. 细粒度语义知识图谱增强的中文OOV词嵌入学习 Fine-grained Semantic Knowledge Graph Enhanced Chinese OOV Word Embedding Learning 计算机科学, 2023, 50(3): 72-82. https://doi.org/10.11896/jsjkx.220700249 |
[5] | 蒋川宇, 韩翔宇, 杨文蕊, 吕博涵, 黄小欧, 谢夏, 谷阳. 医学知识图谱研究与应用综述 Survey of Medical Knowledge Graph Research and Application 计算机科学, 2023, 50(3): 83-93. https://doi.org/10.11896/jsjkx.220700241 |
[6] | 李志飞, 赵月, 张龑. 基于表示学习的知识图谱推理研究综述 Survey of Knowledge Graph Reasoning Based on Representation Learning 计算机科学, 2023, 50(3): 94-113. https://doi.org/10.11896/jsjkx.220900136 |
[7] | 刘泽京, 邬楠, 黄抚群, 宋友. 基于知识图谱与协同过滤混合策略的在线编程评测系统题目推荐模型 Hybrid Programming Task Recommendation Model Based on Knowledge Graph and Collaborative Filtering for Online Judge 计算机科学, 2023, 50(2): 106-114. https://doi.org/10.11896/jsjkx.211200105 |
[8] | 单中原, 杨恺, 赵俊峰, 王亚沙, 徐涌鑫. 一种增量式本体模型与数据模式映射的图谱实例模型构建演化方法 Ontology-Schema Mapping Based Incremental Entity Model Construction and Evolution Approach of Knowledge Graph 计算机科学, 2023, 50(1): 18-24. https://doi.org/10.11896/jsjkx.220500205 |
[9] | 荣欢, 钱敏峰, 马廷淮, 孙圣杰. 基于先验知识图谱的多代理被遮挡目标类别推理模型 Novel Class Reasoning Model Towards Covered Area in Given Image Based on InformedKnowledge Graph Reasoning and Multi-agent Collaboration 计算机科学, 2023, 50(1): 243-252. https://doi.org/10.11896/jsjkx.220700112 |
[10] | 徐涌鑫, 赵俊峰, 王亚沙, 谢冰, 杨恺. 时序知识图谱表示学习 Temporal Knowledge Graph Representation Learning 计算机科学, 2022, 49(9): 162-171. https://doi.org/10.11896/jsjkx.220500204 |
[11] | 饶志双, 贾真, 张凡, 李天瑞. 基于Key-Value关联记忆网络的知识图谱问答方法 Key-Value Relational Memory Networks for Question Answering over Knowledge Graph 计算机科学, 2022, 49(9): 202-207. https://doi.org/10.11896/jsjkx.220300277 |
[12] | 吴子仪, 李邵梅, 姜梦函, 张建朋. 基于自注意力模型的本体对齐方法 Ontology Alignment Method Based on Self-attention 计算机科学, 2022, 49(9): 215-220. https://doi.org/10.11896/jsjkx.210700190 |
[13] | 孔世明, 冯永, 张嘉云. 融合知识图谱的多层次传承影响力计算与泛化研究 Multi-level Inheritance Influence Calculation and Generalization Based on Knowledge Graph 计算机科学, 2022, 49(9): 221-227. https://doi.org/10.11896/jsjkx.210700144 |
[14] | 秦琪琦, 张月琴, 王润泽, 张泽华. 基于知识图谱的层次粒化推荐方法 Hierarchical Granulation Recommendation Method Based on Knowledge Graph 计算机科学, 2022, 49(8): 64-69. https://doi.org/10.11896/jsjkx.210600111 |
[15] | 张光华, 高天娇, 陈振国, 于乃文. 基于N-Gram静态分析技术的恶意软件分类研究 Study on Malware Classification Based on N-Gram Static Analysis Technology 计算机科学, 2022, 49(8): 336-343. https://doi.org/10.11896/jsjkx.210900203 |
|