Abstract

Automatic program repair (APR) is crucial to improve software quality. Recently, neural machine translation (NMT) based modeling for bug fixes has demonstrated great potential. However, these approaches still have two major challenges. One is that their search space is limited due to the out-of-vocabulary (OOV) problem. The other is that the NMT-based APR models tend to ignore past translation information, which often leads to over-translation and under-translation. To address the above challenges, we propose MNRepair, a new NMT-based APR approach that combines multiple mechanisms to fix bugs in source code. Specifically, we devise an encoder-decoder NMT framework with the attention mechanism. Our framework combines the copy mechanism to overcome the OOV problem that occurs with source code. To deal with the over-translation and under-translation, we utilize a coverage mechanism to record past translation information. MNRepair is able to capture a wide range of repair operators and fix 26 bugs in Defects4J. Our evaluation shows the effectiveness of multiple mechanisms in the repair process.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call