A Documentation-based Constraint Generation Method for Java APIs

As the efficiency of constraint solvers increases, constraint solving has been widely used in many applications of software engineering, such as test case generation, program synthesis and code search. However, encoding source code into constraints is not an easy task. Particularly, when it comes to complex data structures of library functions, existing work cannot generate effective constraints. In this paper, we propose a documentation-based method to generate constraint for Java APIs. It mainly uses Natural Language Processing (NLP) techniques to construct syntactic trees by extracting the specifications of methods. Then it uses predefined constraint templates to generate constraint models by traversing the syntactic trees. Our approach successfully models 228 methods for 11 Java container classes and string-related classes. We summarize 12 functional behavior and formulate 21 constraint templates for these classes. Compared with other tools, our approach models most of methods about string-related classes, and more importantly, generates constraint models for Java container classes that other tools cannot. In order to evaluate the effectiveness of our constraint models, we apply them into test case generation. The experimental result shows that constraint models we generate have practical use.

[1]  Isil Dillig,et al.  Component-based synthesis for complex APIs , 2017, POPL.

[2]  Leonardo Mariani,et al.  Automatic generation of software behavioral models , 2008, 2008 ACM/IEEE 30th International Conference on Software Engineering.

[3]  Emina Torlak,et al.  Growing solver-aided languages with rosette , 2013, Onward!.

[4]  Corina S. Pasareanu,et al.  Symbolic PathFinder: symbolic execution of Java bytecode , 2010, ASE.

[5]  Armando Solar-Lezama,et al.  Program synthesis by sketching , 2008 .

[6]  Patrice Godefroid,et al.  SAGE: Whitebox Fuzzing for Security Testing , 2012, ACM Queue.

[7]  Kathryn T. Stolee,et al.  Solving the Search for Source Code , 2014, ACM Trans. Softw. Eng. Methodol..

[8]  D ErnstMichael,et al.  Automatic generation of program specifications , 2002 .

[9]  Guoqing Xu,et al.  Improving efficiency of dynamic analysis with dynamic dependence summaries , 2013, 2013 28th IEEE/ACM International Conference on Automated Software Engineering (ASE).

[10]  Westley Weimer,et al.  A decision procedure for subset constraints over regular languages , 2009, PLDI '09.

[11]  Michael D. Ernst,et al.  HAMPI: a solver for string constraints , 2009, ISSTA.

[12]  Matteo Ceccarello,et al.  Tools to generate and check consistency of model classes for Java PathFinder , 2012, SOEN.

[13]  Alexander Aiken,et al.  Modelgen: mining explicit information flow specifications from concrete executions , 2015, ISSTA.

[14]  Matteo Ceccarello,et al.  Automated generation of model classes for Java PathFinder , 2014, SOEN.

[15]  Xiangyu Zhang,et al.  Modeling Software Execution Environment , 2012, 2012 19th Working Conference on Reverse Engineering.

[16]  Michael D. Ernst,et al.  Automatic generation of program specifications , 2002, ISSTA '02.

[17]  Sumit Gulwani,et al.  Oracle-guided component-based program synthesis , 2010, 2010 ACM/IEEE 32nd International Conference on Software Engineering.

[18]  Zhendong Su,et al.  Combining Symbolic Execution and Model Checking for Data Flow Testing , 2015, 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering.

[19]  Emina Torlak,et al.  A lightweight symbolic virtual machine for solver-aided host languages , 2014, PLDI.

[20]  M. Veanes,et al.  An SMT-LIB Format for Sequences and Regular Expressions , 2012 .

[21]  Thomas W. Reps,et al.  Low-Level Library Analysis and Summarization , 2007, CAV.

[22]  Xiangyu Zhang,et al.  Z3-str: a z3-based string solver for web application analysis , 2013, ESEC/FSE 2013.

[23]  Joseph P. Near,et al.  Rubicon: bounded verification of web applications , 2012, SIGSOFT FSE.

[24]  Nikolai Tillmann,et al.  Pex-White Box Test Generation for .NET , 2008, TAP.

[25]  Margus Veanes,et al.  Rex: Symbolic Regular Expression Explorer , 2010, 2010 Third International Conference on Software Testing, Verification and Validation.

[26]  Xiangyu Zhang,et al.  Automatic Model Generation from Documentation for Java API Functions , 2016, 2016 IEEE/ACM 38th International Conference on Software Engineering (ICSE).

[27]  Gideon Redelinghuys,et al.  Symbolic string execution , 2012 .

[28]  Viktor Kuncak,et al.  On Verification by Translation to Recursive Functions , 2013 .