Semantics-based code search using input/output examples

Renhe Jiang, zhengzhao Chen, Zejun Zhang, Yu Pei, Minxue Pan, Tian Zhang

Research output: Chapter in book / Conference proceedingConference article published in proceeding or bookAcademic researchpeer-review

3 Citations (Scopus)

Abstract

As the quality and quantity of open source code increase, semantics-based code search has become an emerging need for software developers to retrieve and reuse existing source code. We present an approach of semantics-based code search using input/output examples for the Java language. Our approach encodes Java methods in code repositories into path constraints via symbolic analysis and leverages SMT solvers to find the methods whose path constraints can satisfy the given input/output examples. Our approach extends the applicability of the semantics-based search technology to more general Java code compared with existing methods. To evaluate our approach, we encoded 1228 methods from GitHub and applied semantics-based code search on 35 queries extracted from Stack Overflow. Correct method code for 29 queries was obtained during the search and the average search time was just about 48 seconds.

Original languageEnglish
Title of host publicationProceedings - 18th IEEE International Working Conference on Source Code Analysis and Manipulation, SCAM 2018
PublisherInstitute of Electrical and Electronics Engineers Inc.
Pages92-102
Number of pages11
ISBN (Electronic)9781538682906
DOIs
Publication statusPublished - 9 Nov 2018
Event18th IEEE International Working Conference on Source Code Analysis and Manipulation, SCAM 2018 - Madrid, Spain
Duration: 23 Sep 201824 Sep 2018

Publication series

NameProceedings - 18th IEEE International Working Conference on Source Code Analysis and Manipulation, SCAM 2018

Conference

Conference18th IEEE International Working Conference on Source Code Analysis and Manipulation, SCAM 2018
Country/TerritorySpain
CityMadrid
Period23/09/1824/09/18

Keywords

  • Code query
  • SMT solver
  • Symbolic analysis

ASJC Scopus subject areas

  • Software
  • Safety, Risk, Reliability and Quality

Cite this