Context-Adaptation Bugs in Micro-Clones

Whenever we copy a code fragment from one place of a code-base and paste it to another place, the pasted fragment might appear to be a buggy fragment if it is not properly adapted to its surrounding code. In such a situation, the bug that is contained in the pasted fragment because of not adapting i...

Full description

Saved in:
Bibliographic Details
Published inProceedings / Asia Pacific Software Engineering Conference pp. 239 - 248
Main Authors Mottakin, Sayeedi, Zaman, Maliha Bintay, Mondal, Manishankar, Shome, Atanu
Format Conference Proceeding
LanguageEnglish
Published IEEE 04.12.2023
Subjects
Online AccessGet full text

Cover

Loading…
More Information
Summary:Whenever we copy a code fragment from one place of a code-base and paste it to another place, the pasted fragment might appear to be a buggy fragment if it is not properly adapted to its surrounding code. In such a situation, the bug that is contained in the pasted fragment because of not adapting it to its context is known as a context-adaptation bug (simply, context bug). In this research, we investigate the context adaptation bugs in micro-clones (code clones of at most 4LOC) through analyzing their evolutionary history from thousands of revisions of our subject systems. An existing study has investigated such bugs in regular code clones (code clones of at least 5LOC). However, context bugs in micro-clones have never been studied. If microclones also contain context bugs, automatic support for repairing such bugs in micro-clones is important as well. We automatically identify patterns that indicate fixes of context bugs in microclones, and then analyze and compare the intensity of such bugs in regular and micro-clones. We also identify the vulnerable coding patterns that introduce context-bugs in micro-clones. According to our study on thousands of revisions of five subject systems written in three different programming languages, micro-clones generally have a higher possibility of containing context bugs during evolution compared to regular clones. Making microclones through copy/pasting across different files has a significantly higher tendency of introducing context bugs compared to cloning within the same file. We also realize that Type 1 and Type 3 micro-clones are generally more vulnerable than Type 2 micro-clones. Our findings are important for devising automatic mechanisms for fixing context bugs. We have also identified risky cloning patterns so that programmers can avoid those patterns during coding to minimize context-bugs in micro-clones.
ISSN:2640-0715
DOI:10.1109/APSEC60848.2023.00034