arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2601.20160cs.SE
收藏

智能体如何重构:一项实证研究

How do Agents Refactor: An Empirical Study

University of Alberta(阿尔伯塔大学)

Lukas Ottenhof, Daniel Penner, Abram Hindle, Thibaud Lutellier

AI总结:

通过对比86个Java项目中智能体与开发者的重构拉取请求,发现智能体重构以注释修改为主,而Cursor是唯一显著增加代码味道的模型。

摘要:

诸如Claude Code、GitHub Copilot、Cursor Agent、Devin和OpenAI Codex等软件开发智能体正越来越多地集成到开发者工作流中。虽然先前的工作评估了智能体在代码补全和任务自动化方面的能力,但很少有工作研究这些智能体在实践中如何执行Java重构、它们所做的更改类型及其对代码质量的影响。在本研究中,我们首次分析了Java中智能体重构拉取请求,将每个组的86个项目中的智能体重构与开发者重构进行比较。使用RefactoringMiner和DesigniteJava 3.0,我们识别重构类型并检测重构提交前后的代码味道。我们的结果表明,智能体重构以注释修改为主(智能体最常做的5种重构类型都与注释相关),而开发者则典型地进行多样化的结构改进。尽管重构类型存在这些差异,我们发现Cursor是唯一一个在重构味道上显示出统计显著增加的模型。

英文摘要:

Software development agents such as Claude Code, GitHub Copilot, Cursor Agent, Devin, and OpenAI Codex are being increasingly integrated into developer workflows. While prior work has evaluated agent capabilities for code completion and task automation, there is little work investigating how these agents perform Java refactoring in practice, the types of changes they make, and their impact on code quality. In this study, we present the first analysis of agentic refactoring pull requests in Java, comparing them to developer refactorings across 86 projects per group. Using RefactoringMiner and DesigniteJava 3.0, we identify refactoring types and detect code smells before and after refactoring commits. Our results show that agent refactorings are dominated by annotation changes (the 5 most common refactoring types done by agents are annotation related), in contrast to the diverse structural improvements typical of developers. Despite these differences in refactoring types, we find Cursor to be the only model to show a statistically significant increase in refactoring smells.

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

↑