Discovering Likely Method Specifications

Software specifications are of great use for more rigorous software development. They are useful for formal verification and automated testing, and they improve program understanding. In practice, specifications often do not exist and developers write software in an ad-hoc fashion. We describe a new way to automatically infer specifications from code. Our approach infers a likely specification for any method such that the method’s behavior, i.e., its effect on the state and possible result values, is summarized and expressed in terms of some other methods. We use symbolic execution to analyze and relate the behaviors of the considered methods. In our experiences, the resulting likely specifications are compact and human-understandable. They can be examined by the user, used as input to program verification systems, or as input for test generation tools for validation. We implemented the technique for .NET programs in a tool called Axiom Meister. It inferred concise specifications for base classes of the .NET platform and found flaws in the design of a new library.

[1]  David Notkin,et al.  Tool-assisted unit-test generation and selection based on operational abstractions , 2006, Automated Software Engineering.

[2]  Andreas Podelski,et al.  Abstraction Refinement for Termination , 2005, SAS.

[3]  Betty H. C. Cheng,et al.  A specification matching based approach to reverse engineering , 1999, Proceedings of the 1999 International Conference on Software Engineering (IEEE Cat. No.99CB37002).

[4]  Nikolai Tillmann,et al.  XRT- Exploring Runtime for .NET Architecture and Applications , 2006, Electron. Notes Theor. Comput. Sci..

[5]  Amer Diwan,et al.  Discovering Algebraic Specifications from Java Classes , 2003, ECOOP.

[6]  Klaus Havelund,et al.  Model checking programs , 2000, Proceedings ASE 2000. Fifteenth IEEE International Conference on Automated Software Engineering.

[7]  Nikolai Tillmann,et al.  Parameterized unit tests , 2005, ESEC/FSE-13.

[8]  Mana Taghdiri Inferring Specifications to Detect Errors in Code , 2004, ASE.

[9]  K. Rustan M. Leino,et al.  The Spec# Programming System: An Overview , 2004, CASSIS.

[10]  James R. Larus,et al.  Mining specifications , 2002, POPL '02.

[11]  K. Rustan M. Leino,et al.  Houdini, an Annotation Assistant for ESC/Java , 2001, FME.

[12]  Betty H. C. Cheng,et al.  Strongest postcondition semantics as the formal basis for reverse engineering , 2004, Automated Software Engineering.

[13]  Zhenmin Li,et al.  PR-Miner: automatically extracting implicit programming rules and detecting violations in large software code , 2005, ESEC/FSE-13.

[14]  Nikolai Tillmann,et al.  Parameterized unit tests with unit meister , 2005, ESEC/FSE-13.

[15]  David Evans,et al.  Dynamically inferring temporal properties , 2004, PASTE.

[16]  James C. King,et al.  Symbolic execution and program testing , 1976, CACM.

[17]  Mike Barnett,et al.  99 . 44 % pure : Useful Abstractions in Specifications , 2004 .

[18]  William G. Griswold,et al.  Dynamically discovering likely program invariants to support program evolution , 1999, Proceedings of the 1999 International Conference on Software Engineering (IEEE Cat. No.99CB37002).

[19]  Robert Richards,et al.  Document Object Model (DOM) , 2006 .

[20]  David Notkin,et al.  Automatically identifying special and common unit tests for object-oriented programs , 2005, 16th IEEE International Symposium on Software Reliability Engineering (ISSRE'05).

[21]  Reinhard Wilhelm,et al.  Parametric shape analysis via 3-valued logic , 1999, POPL '99.

[22]  Hartmut Ehrig,et al.  Fundamentals of Algebraic Specification 1: Equations and Initial Semantics , 1985 .

[23]  Michael D. Ernst,et al.  An overview of JML tools and applications , 2003, Electron. Notes Theor. Comput. Sci..

[24]  Francesco Logozzo,et al.  Automatic Inference of Class Invariants , 2004, VMCAI.

[25]  David Detlefs,et al.  Simplify: a theorem prover for program checking , 2005, JACM.

[26]  Alex Groce,et al.  What Went Wrong: Explaining Counterexamples , 2003, SPIN.

[27]  Robert O'Callahan,et al.  Lackwit: A Program Understanding Tool Based on Type Inference , 1997, Proceedings of the (19th) International Conference on Software Engineering.

[28]  Monica S. Lam,et al.  Automatic extraction of object-oriented component interfaces , 2002, ISSTA '02.

[29]  Shuvendu K. Lahiri,et al.  Zap: Automated Theorem Proving for Software Analysis , 2005, LPAR.