当前位置: X-MOL 学术Sci. China Inf. Sci. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Identifying change patterns of API misuses from code changes
Science China Information Sciences ( IF 8.8 ) Pub Date : 2021-02-07 , DOI: 10.1007/s11432-019-2745-5
Wenjian Liu , Bihuan Chen , Xin Peng , Qinghao Sun , Wenyun Zhao

Library or framework APIs are difficult to learn and use, leading to unexpected software behaviors or bugs. Hence, various API mining techniques have been introduced to mine API usage patterns about the co-occurring of API calls or pre-conditions of API calls. However, they fail to mine patterns about an API call itself (e.g., whether the arguments of the API call are correctly set and whether the API is suitably chosen over other similar APIs). To bridge this gap, we propose Cpam to identify change patterns (in the form of a pair of APIs before and after code changes) to fix API misuses, using historical code changes. Given a set of target APIs and a corpus of open-source projects, Cpam first selects the commits that potentially fix API misuses from the corpus, then extracts changes to API misuses in each selected commit, and finally identifies change patterns of API misuses. We implement Cpam for Java, and conduct large-scale evaluation, targeting Java SE APIs and using a corpus of 1162 Java projects. Our experimental results demonstrate Cpam’s effectiveness and efficiency. By applying identified change patterns to bug detection, we find 44 new bugs, and 18 of them have been confirmed and fixed.



中文翻译:

从代码更改中识别API滥用的更改模式

库或框架API很难学习和使用,从而导致意外的软件行为或错误。因此,已经引入了各种API挖掘技术来挖掘关于API调用或API调用的前提条件同时出现的API使用模式。然而,他们未能矿图案关于API调用本身(例如,是否该API调用的参数设置是否正确以及是否该API在其他类似的API适当地选择)。为了弥合这种差距,我们建议C pam使用历史代码更改来识别更改模式(在代码更改之前和之后以一对API的形式),以解决API的滥用问题。给定一组目标API和一系列开源项目,C pam首先从语料库中选择可能修复API滥用的提交,然后在每个选定的提交中提取对API滥用的更改,最后确定API滥用的更改模式。我们为Java实现C pam,并针对Java SE API并使用1162个Java项目集进行大规模评估。我们的实验结果证明了C pam的有效性和效率。通过将确定的更改模式应用于错误检测,我们发现了44个新错误,其中18个已被确认并修复。

更新日期:2021-02-15
down
wechat
bug