Dynamic Package Interfaces - Extended Version

A hallmark of object-oriented programming is the ability to perform computation through a set of interacting objects. A common manifestation of this style is the notion of a package, which groups a set of commonly used classes together. A challenge in using a package is to ensure that a client follows the implicit protocol of the package when calling its methods. Violations of the protocol can cause a runtime error or latent invariant violations. These protocols can extend across different, potentially unboundedly many, objects, and are specified informally in the documentation. As a result, ensuring that a client does not violate the protocol is hard. We introduce dynamic package interfaces (DPI), a formalism to explicitly capture the protocol of a package. The DPI of a package is a finite set of rules that together specify how any set of interacting objects of the package can evolve through method calls and under what conditions an error can happen. We have developed a dynamic tool that automatically computes an approximation of the DPI of a package, given a set of abstraction predicates. A key property of DPI is that the unbounded number of configurations of objects of a package are summarized finitely in an abstract domain. This uses the observation that many packages behave monotonically: the semantics of a method call over a configuration does not essentially change if more objects are added to the configuration. We have exploited monotonicity and have devised heuristics to obtain succinct yet general DPIs. We have used our tool to compute DPIs for several commonly used Java packages with complex protocols, such as JDBC, HashSet, and ArrayList.

[1]  Thomas A. Henzinger,et al.  Forward Analysis of Depth-Bounded Processes , 2010, FoSSaCS.

[2]  Rupak Majumdar,et al.  A Notion of Dynamic Interface for Depth-Bounded Object-Oriented Packages , 2013, ArXiv.

[3]  Andreas Zeller,et al.  Generating test cases for specification mining , 2010, ISSTA '10.

[4]  Andreas Zeller,et al.  Mining temporal specifications from object usage , 2011, Automated Software Engineering.

[5]  Andreas Zeller,et al.  Mining temporal specifications from object usage , 2009, 2009 IEEE/ACM International Conference on Automated Software Engineering.

[6]  Carlo Ghezzi,et al.  Synthesizing intensional behavior models by graph transformation , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[7]  Thomas R. Gross,et al.  Statically checking API protocol conformance with mined multi-object specifications , 2012, 2012 34th International Conference on Software Engineering (ICSE).

[8]  Pavol Cerný,et al.  Synthesis of interface specifications for Java classes , 2005, POPL '05.

[9]  Thomas A. Henzinger,et al.  Permissive interfaces , 2005, ESEC/FSE-13.

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

[11]  David Harel,et al.  LSCs: Breathing Life into Message Sequence Charts , 1999, Formal Methods Syst. Des..

[12]  Thomas R. Gross,et al.  Statically checking API protocol conformance with mined multi-object specifications: companion report , 2012 .

[13]  Mangala Gowri Nanda,et al.  Deriving object typestates in the presence of inter-object references , 2005, OOPSLA '05.

[14]  Thomas R. Gross,et al.  Automatic Generation of Object Usage Specifications from Large Method Traces , 2009, 2009 IEEE/ACM International Conference on Automated Software Engineering.

[15]  Robert E. Strom,et al.  Typestate: A programming language concept for enhancing software reliability , 1986, IEEE Transactions on Software Engineering.

[16]  Hoan Anh Nguyen,et al.  Graph-based mining of multiple object usage patterns , 2009, ESEC/FSE '09.

[17]  Parosh Aziz Abdulla,et al.  General decidability theorems for infinite-state systems , 1996, Proceedings 11th Annual IEEE Symposium on Logic in Computer Science.

[18]  Amer Diwan,et al.  Discovering Documentation for Java Container Classes , 2007, IEEE Transactions on Software Engineering.