Software defect prediction aims to identify defect-prone code, aiding developers in optimizing testing resource allocation. Most defect prediction approaches primarily focus on coarse-grained, file-level defect prediction, which fails to provide developers with the precision required to locate defective code. Recently, some researchers have proposed fine-grained, line-level defect prediction methods. However, most of these approaches lack an in-depth consideration of the contextual semantics of code lines and neglect the local interaction information among code lines. To address the above issues, this paper presents a line-level defect prediction method grounded in a code bilinear attention fusion framework (BAFLineDP). This method discerns defective code files and lines by integrating source code line semantics, line-level context, and local interaction information between code lines and line-level context. Through an extensive analysis involving within- and cross-project defect prediction across 9 distinct projects encompassing 32 releases, our results demonstrate that BAFLineDP outperforms current advanced file-level and line-level defect prediction approaches.
翻译:软件缺陷预测旨在识别易缺陷代码,帮助开发者优化测试资源分配。大多数缺陷预测方法主要关注粗粒度的文件级缺陷预测,这无法为开发者提供定位缺陷代码所需的精度。近期,部分研究者提出了细粒度的行级缺陷预测方法。然而,这些方法大多缺乏对代码行上下文语义的深入考量,并忽略了代码行间的局部交互信息。针对上述问题,本文提出了一种基于代码双线性注意力融合框架的行级缺陷预测方法(BAFLineDP)。该方法通过整合源代码行语义、行级上下文以及代码行与行级上下文之间的局部交互信息,来识别缺陷代码文件和行。通过对涵盖9个不同项目32个版本的跨项目及项目内缺陷预测的广泛分析,我们的结果表明,BAFLineDP在性能上优于当前先进的文件级和行级缺陷预测方法。