Computer Science ›› 2023, Vol. 50 ›› Issue (3): 65-71.doi: 10.11896/jsjkx.220700240

• Special Issue of Knowledge Engineering Enabled By Knowledge Graph: Theory, Technology and System • Previous Articles     Next Articles

Method of Java Redundant Code Detection Based on Static Analysis and Knowledge Graph

LIU Xinwei1, TAO Chuanqi1,2,3,4   

  1. 1 College of Computer Science and Technology,Nanjing University of Aeronautics and Astronautics,Nanjing 210016,China
    2 Ministry Key Laboratory for Safety-Critical Software Development and Verification,Nanjing 210016,China
    3 State Key Laboratory for Novel Software Technology,Nanjing 210023,China
    4 Collaborative Innovation Center of Novel Software Technology and Industrialization,Nanjing 210016,China
  • Received:2022-07-24 Revised:2022-12-14 Online:2023-03-15 Published:2023-03-15
  • About author:LIU Xinwei,born in 1995,postgra-duate.His main research interests include redundant code detection and so on.
    TAO Chuanqi,Ph.D,associate professor.His mian research interests include intelligent software testing,regression testing,cloud-based mobile testing as a service,and quality assurance for big data applications.

Abstract: 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%.

Key words: Redundant code detection, Call graph construction, Static analysis, Knowledge graph

CLC Number: 

  • TP311
[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] MA Tinghuai, SUN Shengjie, RONG Huan, QIAN Minfeng. Knowledge Graph-to-Text Model Based on Dynamic Memory and Two-layer Reconstruction Reinforcement [J]. Computer Science, 2023, 50(3): 12-22.
[2] WANG Jingbin, LAI Xiaolian, LIN Xinyu, YANG Xinyi. Context-aware Temporal Knowledge Graph Completion Based on Relation Constraints [J]. Computer Science, 2023, 50(3): 23-33.
[3] CHEN Fuqiang, KOU Jiamin, SU Limin, LI Ke. Multi-information Optimized Entity Alignment Model Based on Graph Neural Network [J]. Computer Science, 2023, 50(3): 34-41.
[4] CHEN Shurui, LIANG Ziran, RAO Yanghui. Fine-grained Semantic Knowledge Graph Enhanced Chinese OOV Word Embedding Learning [J]. Computer Science, 2023, 50(3): 72-82.
[5] JIANG Chuanyu, HAN Xiangyu, YANG Wenrui, LYU Bohan, HUANG Xiaoou, XIE Xia, GU Yang. Survey of Medical Knowledge Graph Research and Application [J]. Computer Science, 2023, 50(3): 83-93.
[6] LI Zhifei, ZHAO Yue, ZHANG Yan. Survey of Knowledge Graph Reasoning Based on Representation Learning [J]. Computer Science, 2023, 50(3): 94-113.
[7] LIU Zejing, WU Nan, HUANG Fuqun, SONG You. Hybrid Programming Task Recommendation Model Based on Knowledge Graph and Collaborative Filtering for Online Judge [J]. Computer Science, 2023, 50(2): 106-114.
[8] SHAN Zhongyuan, YANG Kai, ZHAO Junfeng, WANG Yasha, XU Yongxin. Ontology-Schema Mapping Based Incremental Entity Model Construction and Evolution Approach of Knowledge Graph [J]. Computer Science, 2023, 50(1): 18-24.
[9] RONG Huan, QIAN Minfeng, MA Tinghuai, SUN Shengjie. Novel Class Reasoning Model Towards Covered Area in Given Image Based on InformedKnowledge Graph Reasoning and Multi-agent Collaboration [J]. Computer Science, 2023, 50(1): 243-252.
[10] XU Yong-xin, ZHAO Jun-feng, WANG Ya-sha, XIE Bing, YANG Kai. Temporal Knowledge Graph Representation Learning [J]. Computer Science, 2022, 49(9): 162-171.
[11] RAO Zhi-shuang, JIA Zhen, ZHANG Fan, LI Tian-rui. Key-Value Relational Memory Networks for Question Answering over Knowledge Graph [J]. Computer Science, 2022, 49(9): 202-207.
[12] WU Zi-yi, LI Shao-mei, JIANG Meng-han, ZHANG Jian-peng. Ontology Alignment Method Based on Self-attention [J]. Computer Science, 2022, 49(9): 215-220.
[13] KONG Shi-ming, FENG Yong, ZHANG Jia-yun. Multi-level Inheritance Influence Calculation and Generalization Based on Knowledge Graph [J]. Computer Science, 2022, 49(9): 221-227.
[14] QIN Qi-qi, ZHANG Yue-qin, WANG Run-ze, ZHANG Ze-hua. Hierarchical Granulation Recommendation Method Based on Knowledge Graph [J]. Computer Science, 2022, 49(8): 64-69.
[15] ZHANG Guang-hua, GAO Tian-jiao, CHEN Zhen-guo, YU Nai-wen. Study on Malware Classification Based on N-Gram Static Analysis Technology [J]. Computer Science, 2022, 49(8): 336-343.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!