ABSTRACT Software defect prediction (SDP) is an active area of research in software engineering, with numerous approaches proposed over the years to assist practitioners in identifying potential software defects. However, most existing SDP approaches predict software defects at a coarse‐grained level. Practitioners must still invest considerable time and effort to manually inspect large code segments. Another critical issue lies in the contextual understanding affected by code structures. Some SDP approaches attempt to learn the context from consecutive lines of code, which may not always constitute a meaningful semantic unit. Furthermore, the data preprocessing techniques employed in many SDP studies raise concerns about preserving code semantics. In this study, we propose bidirectional program dependency–guided attention for defect prediction (BiPDG‐DP), a hierarchical Transformer‐based language model that learns the contextual information of a method‐level PDG considering both the control and data dependencies in the directions of both source‐to‐target and target‐to‐source for method‐level SDP. Based on the comparative experimental results on the 32 releases of nine Java projects, our proposed approach outperforms other baseline approaches with significant relative improvements of 11.8%–35.7% in terms of the non‐effort‐aware evaluation metrics and 14.2%–218.5% in terms of the effort‐aware evaluation metrics, respectively.
Lin et al. (Fri,) studied this question.