计算机科学
工作流程
源代码
编码(集合论)
一般化
语法
程序设计语言
推论
钥匙(锁)
数据挖掘
数据库
人工智能
集合(抽象数据类型)
操作系统
数学分析
数学
作者
Daniel Ramos,Hailie Mitchell,Inês Lynce,Vasco Manquinho,Ruben Martins,Claire Le Goues
标识
DOI:10.1109/ase56229.2023.00117
摘要
Software developers often struggle to update APIs, leading to manual, time-consuming, and error-prone processes. We introduce Melt, a new approach that generates lightweight API migration rules directly from pull requests in popular library repositories. Our key insight is that pull requests merged into open-source libraries are a rich source of information sufficient to mine API migration rules. By leveraging code examples mined from the library source and automatically generated code examples based on the pull requests, we infer transformation rules in Comby, a language for structural code search and replace. Since inferred rules from single code examples may be too specific, we propose a generalization procedure to make the rules more applicable to client projects. Melt rules are syntax-driven, interpretable, and easily adaptable. Moreover, unlike previous work, our approach enables rule inference to seamlessly integrate into the library workflow, removing the need to wait for client code migrations. We evaluated Melt on pull requests from four popular libraries, successfully mining 461 migration rules from code examples in pull requests and 114 rules from auto-generated code examples. Our generalization procedure increases the number of matches for mined rules by 9×. We applied these rules to client projects and ran their tests, which led to an overall decrease in the number of warnings and fixing some test cases demonstrating MELT's effectiveness in real-world scenarios.
科研通智能强力驱动
Strongly Powered by AbleSci AI