发表机构
SnT, University of Luxembourg; RIADI, ENSI, University of Manouba; Concordia University(卢森堡大学SnT分校; 突尼斯曼努巴大学RIADI与ENSI分校; 康科德大学)
机构由 AI 辅助整理,请以论文原文为准。AI 中文总结
研究软件仓库挖掘中区分语义保留与变化提交的问题,提出SemaDiff方法,通过行为分析、生成额外调用方法及依赖类等,实现对提交的语义判断,实验表明该方法能较准确地区分,语义变化提交检测精度高。
AI 中文摘要
在软件仓库挖掘中,区分语义保留提交和变化提交仍是一个开放挑战。现有方法虽能准确检测重构提交,但无法确保提交纯粹语义保留。为此提出SemaDiff,通过基于行为的分析识别语义保留提交,比较提交前后版本的相似测试执行情况。因重构影响的代码难测试且版本间不同,故生成额外调用方法作测试目标。给定提交,SemaDiff分析差异识别修改代码并提取调用它的未变依赖代码,用大语言模型生成额外依赖类来测试变化代码并自动生成测试。仅当所有生成测试在两版本产生相同结果时,提交才被分类为语义保留。通过183个提交的数据集评估,结果表明SemaDiff在约76%的情况中能准确区分,语义变化提交检测精度达100%。
英文摘要
Distinguishing semantic-preserving commits from changing ones remains an open challenge in software repository mining. While existing approaches detect refactoring commits accurately, they cannot ensure that a commit is purely semantic-preserving, without any interleaving behaviour-changing modification. This limitation can impact several tasks, such as debugging, fault localisation, bug dataset construction, rollback analysis, and bug fixes backporting. To fill this gap, we propose SemaDiff, a novel approach for identifying semantic-preserving commits through behaviour-based analysis; comparison of similar test execution on pre- and post-commit versions. As code impacted by the refactoring is often hard to test and different accross both versions, we propose generating additional calling methods to that code, which serve as testing target. Given a commit, SemaDiff analyses the diff to identify modified code and extracts unchanged dependent code that calls it. It then generates an additional dependent class using a large language model to exercise the changed code in both versions, and automatically generates tests for the dependent code. This way, we obtain the same tests for the different code versions, enabling the behavioural-difference detection. The commit is classified as semantic-preserving only if all generated tests produce identical outcomes across the two versions. To evaluate SemaDiff, we construct and annotate manually a dataset of 183 commits, gathered from well-known open-source Java projects. The obtained results show that SemaDiff distinguishes accurately semantic-preserving from -- changing commits in about 76% of the cases, with a 100% precision in semantic-changing commit detection.