Exception handling is an important built-in feature of many modern programming languages such as Java. It allows developers to deal with abnormal or unexpected conditions by try-catch blocks that may occur at runtime in advance. Missing or improper implementation of exception handling can cause catastrophic consequences such as system crash. However, previous studies reveal that developers are unwilling or feel it hard to adopt exception handling mechanism, and tend to ignore it until a system failure forces them to do so. To help developers with exception handling, existing work produces recommendations such as code examples and exception types, which still requires developers to localize the try blocks and modify the catch block code to fit the context. In this paper, we propose a novel neural approach for automated exception handling, which can predict locations of try blocks and automatically generate the complete catch blocks. We collect a large number of Java methods from GitHub and conduct experiments to evaluate our approach. The evaluation results, including quantitative measurement and human evaluation, show that our approach is highly effective and outperforms all baselines. Our work makes one step further towards automated exception handling.
Tue 22 SepDisplayed time zone: (UTC) Coordinated Universal Time change
02:20 - 03:20
|Learning to Handle Exceptions|
Jian Zhang Beihang University, Xu Wang Beihang University, Hongyu Zhang University of Newcastle, Australia, Hailong Sun Beihang University, Yanjun Pu Beihang University, Xudong Liu Beihang UniversityPre-print
|BuildFast: History-Aware Build Outcome Prediction for Fast Feedback and Reduced Cost in Continuous Integration|
|OSLDetector: Identifying Open-Source Libraries through Binary Analysis|
Dan Zhang Tsinghua University