Android apps rely on application programming interfaces (APIs) to access various functionalities of Android devices. These APIs however are regularly updated to incorporate new features while the old APIs get deprecated. Even though the importance of updating deprecated API usages with the recommended replacement APIs has been widely recognized, it is non-trivial to update the deprecated API usages. Therefore, the usages of deprecated APIs linger in Android apps and cause compatibility issues in practice. This paper introduces GUPPY, an automated approach that utilizes large language models (LLMs) to update Android deprecated API usages. By employing carefully crafted prompts, GUPPY leverages GPT-4, one of the most powerful LLMs, to update deprecated-API usages, ensuring compatibility in both the old and new API levels. Additionally, GUPPY uses GPT-4 to generate tests, identify incorrect updates, and refine the API usage through an iterative process until the tests pass or a specified limit is reached. Our evaluation, conducted on 360 benchmark API usages from 20 deprecated APIs and an additional 156 deprecated API usages from the latest API levels 33 and 34, demonstrates GUPPY's advantages over the state-of-the-art techniques.
翻译:Android应用程序依赖应用程序编程接口(API)来访问Android设备的各种功能。然而,这些API会定期更新以引入新功能,同时旧API会被废弃。尽管使用推荐替换API更新废弃API用法的重要性已得到广泛认可,但实际更新废弃API用法并非易事。因此,废弃API的使用在Android应用程序中持续存在,并在实践中引发兼容性问题。本文提出GUPPY,一种利用大语言模型(LLM)自动化更新Android废弃API使用的方法。通过精心设计的提示,GUPPY利用当前最强大的LLM之一GPT-4来更新废弃API的使用,确保在旧版和新版API级别上的兼容性。此外,GUPPY使用GPT-4生成测试用例、识别错误更新,并通过迭代过程优化API使用方式,直至测试通过或达到指定迭代上限。我们在来自20个废弃API的360个基准API用法,以及来自最新API级别33和34的额外156个废弃API用法上进行的评估表明,GUPPY相较于现有最先进技术具有显著优势。