paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Learning to handle exceptions

学习处理异常
ASE Proceedings of the 35th IEEE/ACM International Conference on Automated Software Engineering2020匹配度 2/10 · 该论文属于机器学习与程序语言交叉,但聚焦于自动预测 try 块位置并生成 catch 块的异常处理代码生成,不涉及静态分析、Agentic 程序、LLM/Agent 改进程序分析、浮点程序分析或贝叶斯程序分析,与用户核心研究方向相距较远。引用 19 inbox
Jian Zhang, Xu Wang, Hongyu Zhang, Hailong Sun, Yanjun Pu, Xudong Liu
crossref: 2026-09-12

AI 速览

一句话:提出神经方法自动预测 try 块位置并生成完整 catch 块,实现 Java 异常处理的自动化。

异常处理是 Java 等语言的内置特性,但开发者常忽视或难以正确实现,现有推荐工具仅提供代码示例和异常类型,仍需人工定位 try 块并改写 catch 代码。本文提出一种神经方法实现自动化异常处理:从 GitHub 收集大量 Java 方法,训练模型预测 try 块插入位置并生成完整的 catch 块代码。实验包括定量指标与人工评估,结果表明该方法显著优于所有基线,向自动化异常处理迈进一步。

问题
开发者常忽略或难以正确实现异常处理,现有推荐仍需人工定位 try 块并编写 catch 代码。
方法
收集大量 GitHub Java 方法,用神经网络预测 try 块位置并自动生成完整 catch 块。
评估
通过定量指标和人工评估验证,方法显著优于所有基线。
原文摘要(Abstract)

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 that may occur at runtime in advance by using try-catch blocks. 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 to 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.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot5893,
  title = {Learning to handle exceptions},
  author = {Jian Zhang and Xu Wang and Hongyu Zhang and Hailong Sun and Yanjun Pu and Xudong Liu},
  booktitle = {ASE},
  year = {2020},
  doi = {10.1145/3324884.3416568}
}