The Repeat Offenders: Characterizing and Predicting Extremely Bug-Prone Source Methods
Abstract
Bug prediction has long been considered the "prince" of empirical software engineering research, and accordingly, a substantial body of work has focused on predicting bugs to enable early preventive actions. However, most existing studies operate at the class or file level, which practitioners have found to be of limited practical value. As a result, method-level bug prediction has gained increasing attention in recent years. Despite this shift, current method-level prediction models typically treat all buggy methods as equally fault-prone, regardless of whether a method has been associated with a bug once or repeatedly. We argue that methods involved in bugs multiple times-hereafter referred to as ExtremelyBuggy methods-are more harmful than methods that are buggy only once. In this study, we investigate the prevalence of ExtremelyBuggy methods, analyze their code quality metrics, and assess whether they can be predicted at the time of their introduction. In addition, we conduct a thematic analysis of 287 ExtremelyBuggy methods to gain deeper insights into their characteristics. Using a dataset of over 1.25 million methods extracted from 98 open-source Java projects, we find that only a small proportion of methods can be classified as ExtremelyBuggy, yet these methods account for a disproportionately large share of bugs within a project. Although we observe statistically significant differences between ExtremelyBuggy and other methods, ExtremelyBuggy methods remain difficult to predict at their inception. Nevertheless, our manual analysis reveals recurring characteristics among these methods. These findings can help practitioners avoid harmful patterns in practice and guide future research toward developing features and models that better capture the unique properties of such methods.