A Hybrid Approach for Inference between Behavioral Exception API Documentation and Implementations, and Its Applications

Hoan Anh Nguyen, Hung Dang Phan, Samantha Syeda Khairunnesa, Son Nguyen, Aashish Yadavally, Shaohua Wang, Hridesh Rajan, Tien Nguyen

Research output: Chapter in Book/Report/Conference proceedingConference contribution

2 Scopus citations

Abstract

Automatically producing behavioral exception (BE) API documentation helps developers correctly use the libraries. The state-of-the-art approaches are either rule-based, which is too restrictive in its applicability, or deep learning (DL)-based, which requires large training dataset. To address that, we propose StatGen, a novel hybrid approach between statistical machine translation (SMT) and tree-structured translation to generate the BE documentation for any code and vice versa. We consider the documentation and source code of an API method as the two abstraction levels of the same intent. StatGen is specifically designed for this two-way inference, and takes advantage of their structures for higher accuracy. We conducted several experiments to evaluate StatGen. We show that it achieves high precision (75% and 75%), and recall (81% and 84%), in inferring BE documentation from source code and vice versa. StatGen achieves higher precision, recall, and BLEU score than the state-of-the-art, DL-based baseline models. We show StatGen's usefulness in two applications. First, we use it to generate the BE documentation for Apache APIs that lack of documentation by learning from the documentation of the equivalent APIs in JDK. 44% of the generated documentation were rated as useful and 42% as somewhat useful. In the second application, we use StatGen to detect the inconsistency between the BE documentation and corresponding implementations of several JDK8 packages.

Original languageEnglish (US)
Title of host publication37th IEEE/ACM International Conference on Automated Software Engineering, ASE 2022
EditorsMario Aehnelt, Thomas Kirste
PublisherAssociation for Computing Machinery
ISBN (Electronic)9781450396240
DOIs
StatePublished - Sep 19 2022
Event37th IEEE/ACM International Conference on Automated Software Engineering, ASE 2022 - Rochester, United States
Duration: Oct 10 2022Oct 14 2022

Publication series

NameACM International Conference Proceeding Series

Conference

Conference37th IEEE/ACM International Conference on Automated Software Engineering, ASE 2022
Country/TerritoryUnited States
CityRochester
Period10/10/2210/14/22

All Science Journal Classification (ASJC) codes

  • Software
  • Human-Computer Interaction
  • Computer Vision and Pattern Recognition
  • Computer Networks and Communications

Keywords

  • Behavioral Exception Specification
  • Hybrid Machine Translation
  • Inference between Documentation and Code

Fingerprint

Dive into the research topics of 'A Hybrid Approach for Inference between Behavioral Exception API Documentation and Implementations, and Its Applications'. Together they form a unique fingerprint.

Cite this