一句话:提出基于模糊逻辑的 FuzzyCatch 工具,预测运行时异常并推荐捕获与处理方法。
异常处理是避免运行时错误的有效机制,但新手程序员常无法正确处理异常,导致系统崩溃或资源泄漏。本文提出 FuzzyCatch——一个异常处理代码推荐工具。它基于模糊逻辑,对给定代码片段预测是否会发生运行时异常,并推荐应捕获的异常类型以及异常发生后应调用的方法。FuzzyCatch 被实现为 Android Studio 插件。实证评估表明其效果显著:在 try-catch 块中推荐捕获何种异常的 top-1 准确率为 77%,推荐应调用何种方法的 top-1 准确率为 70%;在检测与修复真实异常缺陷任务上,FuzzyCatch 也取得较高准确率并显著优于基线方法。
Exception handling is an effective mechanism to avoid unexpected runtime errors. However, novice programmers might fail to handle exceptions properly, causing serious errors like system crashing or resource leaking. In this paper, we introduce FuzzyCatch, a code recommendation tool for handling exceptions. Based on fuzzy logic, FuzzyCatch can predict if a runtime exception would occur in a given code snippet and recommend code to handle that exception. FuzzyCatch is implemented as a plugin for Android Studio. The empirical evaluation suggests that FuzzyCatch is highly effective. For example, it has top-1 accuracy of 77% on recommending what exception to catch in a try catch block and of 70% on recommending what method should be called when such an exception occurs. FuzzyCatch also achieves a high level of accuracy and outperforms baselines significantly on detecting and fixing real exception bugs.
DOI 原文 ·
@inproceedings{paperbot5821,
title = {Code recommendation for exception handling},
author = {Tam Nguyen and Phong Vu and Tung Nguyen},
booktitle = {FSE},
year = {2020},
doi = {10.1145/3368089.3409690}
}