Deep Just-In-Time Inconsistency Detection Between Comments and Source Code

Authors

  • Sheena Panthaplackel The University of Texas at Austin
  • Junyi Jessy Li The University of Texas at Austin
  • Milos Gligoric The University of Texas at Austin
  • Raymond J. Mooney The University of Texas at Austin

DOI:

https://doi.org/10.1609/aaai.v35i1.16119

Keywords:

Software Engineering

Abstract

Natural language comments convey key aspects of source code such as implementation, usage, and pre- and post-conditions. Failure to update comments accordingly when the corresponding code is modified introduces inconsistencies, which is known to lead to confusion and software bugs. In this paper, we aim to detect whether a comment becomes inconsistent as a result of changes to the corresponding body of code, in order to catch potential inconsistencies just-in-time, i.e., before they are committed to a code base. To achieve this, we develop a deep-learning approach that learns to correlate a comment with code changes. By evaluating on a large corpus of comment/code pairs spanning various comment types, we show that our model outperforms multiple baselines by significant margins. For extrinsic evaluation, we show the usefulness of our approach by combining it with a comment update model to build a more comprehensive automatic comment maintenance system which can both detect and resolve inconsistent comments based on code changes.

Downloads

Published

2021-05-18

How to Cite

Panthaplackel, S., Li, J. J., Gligoric, M., & Mooney, R. J. (2021). Deep Just-In-Time Inconsistency Detection Between Comments and Source Code. Proceedings of the AAAI Conference on Artificial Intelligence, 35(1), 427-435. https://doi.org/10.1609/aaai.v35i1.16119

Issue

Section

AAAI Technical Track on Application Domains