Detecting Differences across Multiple Instances of Code Clones

被引:28
|
作者
Lin, Yun [1 ,2 ]
Xing, Zhenchang [3 ]
Xue, Yinxing [4 ]
Liu, Yang [3 ]
Peng, Xin [1 ,2 ]
Sun, Jun [5 ]
Zhao, Wenyun [1 ,2 ]
机构
[1] Fudan Univ, Sch Comp Sci, Shanghai, Peoples R China
[2] Fudan Univ, Shanghai Key Lab Data Sci, Shanghai, Peoples R China
[3] Nanyang Technol Univ, Sch Comp Engn, Singapore, Singapore
[4] Natl Univ Singapore, Sch Comp, Singapore, Singapore
[5] Singapore Univ Technol & Design, Singapore, Singapore
关键词
Code clone; Program differencing; Human study;
D O I
10.1145/2568225.2568298
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Clone detectors find similar code fragments (i.e., instances of code clones) and report large numbers of them for industrial systems. To maintain or manage code clones, developers often have to investigate differences of multiple cloned code fragments. However, existing program differencing techniques compare only two code fragments at a time. Developers then have to manually combine several pairwise differencing results. In this paper, we present an approach to automatically detecting differences across multiple clone instances. We have implemented our approach as an Eclipse plugin and evaluated its accuracy with three Java software systems. Our evaluation shows that our algorithm has precision over 97.66% and recall over 95.63% in three open source Java projects. We also conducted a user study of 18 developers to evaluate the usefulness of our approach for eight clone-related refactoring tasks. Our study shows that our approach can significantly improve developers' performance in refactoring decisions, refactoring details, and task completion time on clone-related refactoring tasks. Automatically detecting differences across multiple clone instances also opens opportunities for building practical applications of code clones in software maintenance, such as auto-generation of application skeleton, intelligent simultaneous code editing.
引用
收藏
页码:164 / 174
页数:11
相关论文
共 50 条
  • [1] Detecting and Analyzing Code Clones in HDL
    Uemura, Kyohei
    Mori, Akira
    Fujiwara, Kenji
    Choi, Eunjong
    Iida, Hajimu
    2017 IEEE 11TH INTERNATIONAL WORKSHOP ON SOFTWARE CLONES (IWSC), 2017, : 1 - 7
  • [2] Detecting Code Clones in Binary Executables
    Saebjornsen, Andreas
    Willcock, Jeremiah
    Panas, Thomas
    Quinlan, Daniel
    Su, Zhendong
    ISSTA 2009: INTERNATIONAL SYMPOSIUM ON SOFTWARE TESTING AND ANALYSIS, 2009, : 117 - 127
  • [3] BinClone: Detecting Code Clones in Malware
    Farhadi, Mohammad Reza
    Fung, Benjamin C. M.
    Charland, Philippe
    2014 EIGHTH INTERNATIONAL CONFERENCE ON SOFTWARE SECURITY AND RELIABILITY, 2014, : 78 - 87
  • [4] Code Clone Graph Metrics for Detecting Diffused Code Clones
    Fukushima, Yoshihiko
    Kula, Raula
    Kawaguchi, Shinji
    Fushida, Kyohei
    Nagura, Masataka
    Iida, Hajimu
    APSEC 09: SIXTEENTH ASIA-PACIFIC SOFTWARE ENGINEERING CONFERENCE, PROCEEDINGS, 2009, : 373 - 380
  • [5] Detecting Code Clones with Gaps by Function Applications
    Matsushita, Tsubasa
    Sasano, Isao
    PROCEEDINGS OF THE 2017 ACM SIGPLAN WORKSHOP ON PARTIAL EVALUATION AND PROGRAM MANIPULATION (PEPM'17), 2017, : 12 - 22
  • [6] srcClone: Detecting Code Clones via Decompositional Slicing
    Alomari, Hakam W.
    Stephan, Matthew
    2020 IEEE/ACM 28TH INTERNATIONAL CONFERENCE ON PROGRAM COMPREHENSION, ICPC, 2020, : 274 - 284
  • [7] Selecting a Set of Appropriate Metrics for Detecting Code Clones
    Bansal, Geetika
    Tekchandani, Rajkumar
    2014 SEVENTH INTERNATIONAL CONFERENCE ON CONTEMPORARY COMPUTING (IC3), 2014, : 484 - 488
  • [8] Generating Code for Associations Supporting Operations on Multiple Instances
    Goldberg, Mayer
    Wiener, Guy
    EVALUATION OF NOVEL APPROACHES TO SOFTWARE ENGINEERING, 2011, 230 : 163 - 177
  • [9] Multiple Instances and Multiple 'Instances'
    Davies, David
    BRITISH JOURNAL OF AESTHETICS, 2010, 50 (04): : 411 - 426
  • [10] DroidClone: Detecting Android Malware Variants by Exposing Code Clones
    Alam, Shahid
    Riley, Ryan
    Sogukpinar, Ibrahim
    Carkaci, Necmeddin
    2016 SIXTH INTERNATIONAL CONFERENCE ON DIGITAL INFORMATION AND COMMUNICATION TECHNOLOGY AND ITS APPLICATIONS (DICTAP), 2016, : 79 - 84