Neural Exception Handling Recommender
Open Access
- 14 April 2024
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 316-317
Abstract
Practical code reuse often leads to the incorporation of code fragments from developer forums into applications. However, these fragments, being incomplete, frequently lack details on exception handling. Integrating exception handling into a codebase is not a straightforward task, requiring developers to understand and remember which API methods may trigger exceptions and which exceptions should be handled. To address that, we introduce EHBlock, a learning-based exception handling recommender for Java code snippets. EHBlock analyzes a given code snippet and suggests whether a try-catch block is necessary. It employs a Relational Graph Convolutional Network (R-GCN) to learn exception handling from complete code. R-GCN considers program dependencies in the surrounding context, allowing EHBlock to learn the identities of APIs and their relations with corresponding exception types that need to be handled. Our empirical evaluation shows that EHBlock achieves a 12.3% improvement in F-score compared to the state-of-the-art approach in determining the need of try-catch blocks.Keywords
Funding Information
- National Science Foundation (CNS-2120386)
- National Security Agency (NCAE-C-002-2021)
This publication has 7 references indexed in Scilit:
- (Partial) Program Dependence Learning2023
- Code recommendation for exception handling2020
- Analyzing and Supporting Adaptation of Online Code Examples2019
- Modeling Relational Data with Graph Convolutional Networks2018
- Improved Semantic Representations From Tree-Structured Long Short-Term Memory Networks2015
- Glove: Global Vectors for Word Representation2014
- Enabling static analysis for partial java programs2008