journal article·2023-08-24Open access

SJBCD: A Java Code Clone Detection Method Based on Bytecode Using Siamese Neural Network

Bangrui Wan, Shuang Dong, Jianjun Zhou, Ying Qian

Applied Sciences· Volume 13· Issue 17

Abstract

Code clone detection is an important research topic in the field of software engineering. It is significant in developing software and solving software infringement disputes to discover code clone phenomenon effectively in and between software systems. In practical engineering applications, clone detection can usually only be performed on the compiled code due to the unavailability of the source code. Additionally, there is room for improvement in the detection effect of existing methods based on bytecode. Based on the above reasons, this paper proposes a novel code clone detection method for Java bytecode: SJBCD. SJBCD extracts opcode sequences from byte code files, use GloVe to vectorize opcodes, and builds a Siamese neural network based on GRU to perform supervised training. Then the trained network is used to detect code clones. In order to prove the effectiveness of SJBCD, this paper conducts validation experiments using the BigCloneBench dataset and provides a comparative analysis with four other methods. Experimental results show the effectiveness of the SJBCD method.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Software Engineering Research · Advanced Malware Detection Techniques · Software Reliability and Analysis Research

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

School of Software Engineering, Chongqing University of Posts and Telecommunications, Chongqing 400065, China

Chongqing Engineering Research Center of Software Quality Assurance, Testing and Assessment, Chongqing 400065, China

Funding

Chongqing Construction Science and technology plan project of Chongqing Housing and Urban-Rural Development Commission

References (34)

Show source-provided references
1. A Systematic Review on Code Clone Detection10.1109/ACCESS.2019.2918202 ↗
2. Definition, approaches, and analysis of code duplication detection (2006–2020): A critical review10.1007/s00521-022-07707-2 ↗
3. Dang, Y., Zhang, D., Ge, S., Huang, R., Chu, C., and Xie, T. (2017, January 20–28). Transferring Code-Clone Detection and Analysis to Practice. Proceedings of the 2017 IEEE/ACM 39th International Conference on Software Engineering: Software Engineering in Practice Track (ICSE-SEIP), Buenos Aires, Argentina.10.1109/ICSE-SEIP.2017.6 ↗
4. A Survey of Software Clone Detection from Security Perspective10.1109/ACCESS.2021.3065872 ↗
5. Comparison and Evaluation of Clone Detection Tools10.1109/TSE.2007.70725 ↗
6. Svajlenko, J., and Roy, C.K. (October, January 29). Evaluating clone detection tools with BigCloneBench. Proceedings of the 2015 IEEE International Conference on Software Maintenance and Evolution (ICSME), Bremen, Germany.10.1109/ICSM.2015.7332459 ↗
7. Keivanloo, I., Roy, C.K., and Rilling, J. (2012, January 11–13). SeByte: A semantic clone detection tool for intermediate languages. Proceedings of the 2012 20th IEEE International Conference on Program Comprehension (ICPC), Passau, Germany.10.1109/ICPC.2012.6240495 ↗
8. Yu, D., Wang, J., Wu, Q., Yang, J., Wang, J., Yang, W., and Yan, W. (2017, January 4–8). Detecting Java Code Clones with Multi-granularities Based on Bytecode. Proceedings of the 2017 IEEE 41st Annual Computer Software and Applications Conference (COMPSAC).10.1109/COMPSAC.2017.104 ↗
9. Detecting Java Code Clones Based on Bytecode Sequence Alignment10.1109/ACCESS.2019.2898411 ↗
10. Lindholm, T., Yellin, F., and Bracha, G. (2014). The Java Virtual Machine Specification, Pearson Education Inc.. Java SE 8 ed.
11. Signature verification using a “siamese” time delay neural network
12. Svajlenko, J., Islam, J.F., Keivanloo, I., Roy, C.K., and Mia, M.M. (October, January 28). Towards a Big Data Curated Benchmark of Inter-project Code Clones. Proceedings of the 2014 IEEE International Conference on Software Maintenance and Evolution, Victoria, BC, Canada.10.1109/ICSME.2014.77 ↗
13. Roy, C.K., and Cordy, J.R. (2008, January 10–13). NICAD: Accurate Detection of Near-Miss Intentional Clones Using Flexible Pretty-Printing and Code Normalization. Proceedings of the 2008 16th IEEE International Conference on Program Comprehension, Amsterdam, The Netherlands.10.1109/ICPC.2008.41 ↗
14. Ducasse, S., Rieger, M., and Demeyer, S. (September, January 30). A language independent approach for detecting duplicated code. Proceedings of the IEEE International Conference on Software Maintenance—1999 (ICSM’99), Oxford, UK.10.1109/ICSM.1999.792593 ↗
15. Lee, S., and Jeong, I. (2005, January 16–20). SDD: High performance code clone detection system for large scale source code. Proceedings of the 20th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA ′05), New York, NY, USA.
16. Wang, P., Svajlenko, J., Wu, Y., Xu, Y., and Roy, C.K. (June, January 27). CCAligner: A Token Based Large-Gap Clone Detector. Proceedings of the 2018 IEEE/ACM 40th International Conference on Software Engineering (ICSE), Gothenburg, Sweden.10.1145/3180155.3180179 ↗
17. Li, L., Feng, H., Zhuang, W., Meng, N., and Ryder, B. (2017, January 17–22). CCLearner: A Deep Learning-Based Clone Detection Approach. Proceedings of the 2017 IEEE International Conference on Software Maintenance and Evolution (ICSME), Shanghai, China.10.1109/ICSME.2017.46 ↗
18. Yu, H., Lam, W., Chen, L., Li, G., Xie, T., and Wang, Q. (2019, January 25–26). Neural Detection of Semantic Code Clones Via Tree-Based Convolution. Proceedings of the IEEE/ACM 27th International Conference on Program Comprehension (ICPC), Montreal, QC, Canada.10.1109/ICPC.2019.00021 ↗
19. Modeling functional similarity in source code with graph-based Siamese networks10.1109/TSE.2021.3105556 ↗
20. Raheja, K., and Rajkumar, T. (2013). An Emerging Approach towards Code Clone Detection: Metric Based Approach on Byte Code. Int. J. Adv. Res. Comput. Sci. Softw. Eng., 3.
21. Lam, P., Bodden, E., Lhoták, O., and Hendren, L.J. (2011, January 10). The Soot framework for Java program analysis: A retrospective. Proceedings of the Cetus Users and Compiler Infastructure Workshop (CETUS 2011), Galveston Island, TX, USA.
22. Clone Detection Algorithm for Binary Executable Code with Suffix Tree
23. Survey of Research Progress of Code Clone Detection
24. Zhao, G., and Huang, J. (2018, January 4–9). DeepSim: Deep learning code functional similarity. Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE 2018), New York, NY, USA.10.1145/3236024.3236068 ↗
25. Xue, Z.P., Jiang, Z.J., Huang, C.L., Xu, R.L., Huang, X.B., and Hu, L.M. (2022, January 15–17). SEED: Semantic Graph Based Deep Detection for Type-4 Clone. Proceedings of the Reuse and Software Quality: 20th International Conference on Software and Systems Reuse (ICSR 2022), Montpellier, France.10.1007/978-3-031-08129-3_8 ↗
26. Zhang, J., Wang, X., Zhang, H., Sun, H., Wang, K., and Liu, X. (2019, January 25–31). A Novel Neural Source Code Representation Based on Abstract Syntax Tree. Proceedings of the 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE), Montreal, QC, Canada.10.1109/ICSE.2019.00086 ↗
27. Wang, W., Li, G., Ma, B., Xia, X., and Jin, Z. (2020, January 18–21). Detecting Code Clones with Graph Neural Network and Flow-Augmented Abstract Syntax Tree. Proceedings of the 2020 IEEE 27th International Conference on Software Analysis, Evolution and Reengineering (SANER), London, ON, Canada.10.1109/SANER48275.2020.9054857 ↗
28. Efficient transformer with code token learner for code clone detection10.1016/j.jss.2022.111557 ↗
29. Geoff, W. (1988). Plague: Plagiarism Detection Using Program Structure, School of Electrical Engineering and Computer Science, University of New South Wales.
30. Pennington, J., Socher, R., and Manning, C. (2014, January 25–29). GloVe: Global Vectors for Word Representation. Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), Doha, Qatar.10.3115/v1/D14-1162 ↗
31. Wu, Y., Zou, D., Dou, S., Yang, S., Yang, W., Cheng, F., Liang, H., and Jin, H. (2020, January 21–25). SCDetector: Software functional clone detection based on semantic tokens analysis. Proceedings of the 35th IEEE/ACM International Conference on Automated Software Engineering, New York, NY, USA.10.1145/3324884.3416562 ↗
32. Gupta, P., Mehrotra, N., and Purandare, R. (October, January 27). JCoffee: Using Compiler Feedback to Make Partial Code Snippets Compilable. Proceedings of the 2020 IEEE International Conference on Software Maintenance and Evolution (ICSME), Adelaide, SA, Australia.10.1109/ICSME46990.2020.00099 ↗
33. Mikolov, T., Chen, K., Corrado, G.S., and Dean, J. (2013, January 2–4). Efficient Estimation of Word Representations in Vector Space. Proceedings of the International Conference on Learning Representations, Scottsdale, AZ, USA.
34. The Mutation and Injection Framework: Evaluating Clone Detection Tools with Mutation Analysis10.1109/TSE.2019.2912962 ↗