Token Comparison Approach to Detect Code Clone-related Bugs
YongLee Yii, Yasuhiro Hayase, Makoto Matsushita, Katsuro Inoue · OUKA (Osaka University Knowledge Archive) (Osaka University) · 2008
Large software tends to have a significant amount of similar code, commonly known as code clones. Often the code clones are introduced through copy-and-paste process for code reuse purpose where the pasted code usually will go through some modifications such as renaming of identifiers and changing of parameters. In this paper, we propose a method using token comparison approach to detect bugs caused by abovementioned modifications. Our method tokenizas detected clones and performs a comparison to find out inconsistencies between them. The inconsistencies are then ranked based on predefined metrics to produce a bug candidate list. We implemented our method and tested on open source software. Our tool has found real bugs from the test subject. We believe our tool is suitable to serve the purpose of detecting code clone-related bugs in large software.