Similar source code fragments, known as code clones, may involve similar defects caused by the same mistake. However, code clone detection tools cannot detect certain code fragments (e.g. modified after copy-and-pasted). To support developers who would like to detect such defects, we propose a method to retrieve similar code fragments in source code based on the similarity of identifiers between a query and a target code fragment. We present two case studies of similar defects in open source systems.
N. Yoshida et al. REF proposed a method based on identifiers similarity between a query and a target source code fragment to obtain similar code fragments.
Retrieving similar code fragments based on identifier similarity for defect detection
DEFECTS '08
Computer Science