arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2403.05939cs.SE
收藏

一种新颖的重构与语义感知的抽象语法树差异分析工具及用于评估Diff工具准确性的基准

A Novel Refactoring and Semantic Aware Abstract Syntax Tree Differencing Tool and a Benchmark for Evaluating the Accuracy of Diff Tools

Pouria Alikhanifard, Nikolaos Tsantalis

AI总结:

提出基于RefactoringMiner的新型AST差异分析工具,解决多重映射、重构感知等局限,并构建首个含988个提交的AST节点映射基准,验证其具有更高的精确率、召回率及可比的执行速度。

摘要:

软件不断经历变化,以支持新需求、修复缺陷、提升性能并确保可维护性。因此,开发者花费大量工作时间来理解和审查团队成员的代码变更。抽象语法树(AST)差异分析工具的开发旨在克服大多数开发者使用的基于行的差异分析工具的局限性。尽管AST差异分析工具在理解复杂变更方面带来了显著改进,但它们仍存在严重局限,例如:(1) 缺乏多重映射支持,(2) 匹配语义不兼容的AST节点,(3) 忽略语言线索来指导匹配过程,(4) 缺乏重构感知,以及 (5) 缺乏提交级别的差异分析支持。我们提出了一种基于RefactoringMiner的新型AST差异分析工具,解决了上述所有局限。首先,我们改进了RefactoringMiner以提高其语句映射准确性,然后我们开发了一种算法,该算法基于RefactoringMiner提供的重构实例和匹配的程序元素声明对,为给定的提交或拉取请求生成AST差异。为了评估我们工具的准确性并将其与最先进的工具进行比较,我们创建了首个AST节点映射基准,包含800个缺陷修复提交和188个重构提交。我们的评估表明,我们的工具实现了相当高的精确率和召回率,特别是对于重构提交,其执行时间与较快的工具相当。

英文摘要:

Software undergoes constant changes to support new requirements, address bugs, enhance performance, and ensure maintainability. Thus, developers spend a great portion of their workday trying to understand and review the code changes of their teammates. Abstract Syntax Tree (AST) diff tools were developed to overcome the limitations of line-based diff tools, which are used by the majority of developers. Despite the notable improvements brought by AST diff tools in understanding complex changes, they still suffer from serious limitations, such as (1) lacking multi-mapping support, (2) matching semantically incompatible AST nodes, (3) ignoring language clues to guide the matching process, (4) lacking refactoring awareness, and (5) lacking commit-level diff support. We propose a novel AST diff tool based on RefactoringMiner that resolves all aforementioned limitations. First, we improved RefactoringMiner to increase its statement mapping accuracy, and then we developed an algorithm that generates AST diff for a given commit or pull request based on the refactoring instances and pairs of matched program element declarations provided by RefactoringMiner. To evaluate the accuracy of our tool and compare it with the state-of-the-art tools, we created the first benchmark of AST node mappings, including 800 bug-fixing commits and 188 refactoring commits. Our evaluation showed that our tool achieved a considerably higher precision and recall, especially for refactoring commits, with an execution time that is comparable with that of the faster tools.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑