期刊文献+

面向异常处理的代码智能化推荐

Intelligent Code Recommendation for Exception Handling
下载PDF
导出
摘要 为了保证软件的健壮性以及系统的可靠性,异常处理被广泛应用于软件开发过程中。开发者们希望选择合适的异常处理代码以防止出现程序崩溃或者内存泄漏等问题。然而开发者,尤其是新手,由于缺乏经验很难编写出正确或规范的异常处理代码。为了协助开发者编写正确的异常处理代码,提出了面向异常处理的代码智能化推荐方法,即DeepEHCR。该方法通过构建API调用树来表示异常发生位置的上下文信息,然后根据上下文信息,利用自注意力网络推荐相应的异常处理策略。针对处理异常这一具体策略,利用Transformer模型进一步推荐处理异常相关的API序列。实验表明DeepEHCR在异常处理策略推荐和API序列推荐上都有较高的性能。在异常处理策略推荐方面,Accuracy、Precision、Recall以及F1-score的值分别达到了89.78%、89.98%、89.34%以及89.59%。在API序列推荐方面,Hit@1/3/5的值分别达到了57.83%、69.73%、74.79%。除此之外,DeepEHCR在修复真实的异常漏洞方面也优于现有研究工作。 Exception handling is widely used in program development to ensure software robustness and system reliability.Users want to select the right exception handling code to prevent program crashes or memory leaks.However,it is difficult for users,especially novices,to write proper exception handling code due to lack of experience.In order to assist developers to write correct exception handling code,this paper proposes DeepEHCR,an intelligent code recommendation approach for exception handling.It constructs API call tree to represent the context code information of the location where the exception occurs,and uses the self-attention network to recommend the exception handling strategy that the context code needs to take.For the strategy of HANDLE,the Transformer model is employed to further recommend related API sequence to handle exceptions.Experimental results show that DeepEHCR has high performance in both exception handling strategy recommendation and API sequence recommendation.In terms of exception handling strategy recommendation,the values of Accuracy,Precision,Recall and F1-score reach89.78%,89.98%,89.34%and 89.59%,respectively.In terms of API sequence recommendation,the values of Hit@1/3/5reach 57.83%,69.73%and 74.79%,respectively.In addition,DeepEHCR outperforms baselines on fixing real exception bugs.
作者 林锴 陶传奇 黄志球 LIN Kai;TAO Chuanqi;HUANG Zhiqiu(College of Computer Science and Technology,Nanjing University of Aeronautics and Astronautics,Nanjing 211106,China;Ministry Key Laboratory for Safety-Critical Software Development and Verification,Nanjing University of Aeronautics and Astronautics,Nanjing 211106,China;State Key Laboratory for Novel Software Technology,Nanjing University,Nanjing 210023,China;Collaborative Innovation Center of Novel Software Technology and Industrialization,Nanjing 210093,China)
出处 《计算机科学与探索》 CSCD 北大核心 2023年第3期667-677,共11页 Journal of Frontiers of Computer Science and Technology
基金 国家重点研发计划(2018YFB1003900) 国家自然科学基金(61602267,61402229) 计算机软件新技术国家重点实验室基金(KFKT2018B19) 中央高校基本科研业务费专项资金(NS2019058)。
关键词 异常处理 代码推荐 自注意力网络 上下文代码 exception handling code recommendation self-attention network context code
  • 相关文献

相关作者

内容加载中请稍等...

相关机构

内容加载中请稍等...

相关主题

内容加载中请稍等...

浏览历史

内容加载中请稍等...
;
使用帮助 返回顶部