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

量化代码提示对重构已弃用Java API的益处

Quantifying the benefits of code hints for refactoring deprecated Java APIs

Cristina David, Pascal Kesseli, Daniel Kroening, Hanliang Zhang

AI总结:

本研究量化了Javadoc代码提示对自动重构已弃用Java API的益处,构建符号与神经引擎,实验显示代码提示显著提升重构成功率,从无提示的14%提升至有提示的71%。

摘要:

手动重构遗留代码以消除对已弃用API的使用,是一个容易出错且耗时的过程。在本文中,我们研究了已弃用Java API的重构在多大程度上可以自动化,并量化了Javadoc代码提示对此任务的益处。为此,我们构建了一个符号引擎和一个神经引擎,用于自动重构已弃用的API。前者基于类型导向和基于组件的程序合成,而后者使用LLM。我们将我们的引擎应用于重构Oracle JDK 15中的已弃用方法。我们的实验表明,代码提示对于此任务的自动化至关重要:即使是最差的引擎,在有代码提示的情况下也能正确重构71%的任务,而在没有代码提示的情况下,这一比例最多降至14%。因此,向Javadoc添加更多代码提示可以促进使用已弃用API的代码的重构。

英文摘要:

When done manually, refactoring legacy code in order to eliminate uses of deprecated APIs is an error-prone and time-consuming process. In this paper, we investigate to which degree refactorings for deprecated Java APIs can be automated, and quantify the benefit of Javadoc code hints for this task. To this end, we build a symbolic and a neural engine for the automatic refactoring of deprecated APIs. The former is based on type-directed and component-based program synthesis, whereas the latter uses LLMs. We applied our engines to refactor the deprecated methods in the Oracle JDK 15. Our experiments show that code hints are enabling for the automation of this task: even the worst engine correctly refactors 71% of the tasks with code hints, which drops to at best 14% on tasks without. Adding more code hints to Javadoc can hence boost the refactoring of code that uses deprecated APIs.

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

↑