Abstract
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
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Abdulla, P.A., Cerans, K., Jonsson, B., Tsay, Y.K.: General decidability theorems for infinite-state systems. In: LICS 1996, pp. 313–321. IEEE (1996)
Alur, R., Černý, P., Madhusudan, P., Nam, W.: Synthesis of interface specifications for Java classes. In: POPL 2005, pp. 98–109. ACM (2005)
Dallmeier, V., Knopp, N., Mallon, C., Hack, S., Zeller, A.: Generating test cases for specification mining. In: ISSTA, pp. 85–96. ACM (2010)
Damm, W., Harel, D.: LSCs: Breathing life into message sequence charts. Formal Methods in System Design 19(1), 45–80 (2001)
Esmaeilsabzali, S., Majumdar, R., Wies, T., Zufferey, D.: Dynamic package interfaces - extended version. CoRR abs/1311.4934 (2013)
Esmaeilsabzali, S., Majumdar, R., Wies, T., Zufferey, D.: A notion of dynamic interface for depth-bounded object-oriented packages. CoRR abs/1311.4615 (2013)
Ghezzi, C., Mocci, A., Monga, M.: Synthesizing intensional behavior models by graph transformation. In: ICSE, pp. 430–440. IEEE (2009)
Henkel, J., Reichenbach, C., Diwan, A.: Discovering documentation for java container classes. IEEE Trans. Software Eng. 33(8), 526–543 (2007)
Henzinger, T., Jhala, R., Majumdar, R.: Permissive interfaces. In: Wermelinger, M., Gall, H. (eds.) ESEC/SIGSOFT FSE, pp. 31–40. ACM (2005)
Nanda, M., Grothoff, C., Chandra, S.: Deriving object typestates in the presence of inter-object references. In: OOPSLA, pp. 77–96. ACM (2005)
Nguyen, T.T., Nguyen, H.A., Pham, N.H., Al-Kofahi, J.M., Nguyen, T.N.: Graph-based mining of multiple object usage patterns. In: ESEC/SIGSOFT FSE, pp. 383–392. ACM (2009)
Pradel, M., Jaspan, C., Aldrich, J., Gross, T.: Statically checking API protocol conformance with mined multi-object specifications. In: ICSE 2012, pp. 925–935. IEEE (2012)
Pradel, M., Gross, T.R.: Automatic generation of object usage specifications from large method traces. In: ASE, pp. 371–382. IEEE Computer Society (2009)
Strom, R.E., Yemini, S.A.: Typestate: A programming language concept for enhancing software reliability. IEEE Transactions on Software Engineering 12(1), 157–171 (1986)
Wasylkowski, A., Zeller, A.: Mining temporal specifications from object usage. Autom. Softw. Eng. 18(3-4), 263–292 (2011)
Whaley, J., Martin, M., Lam, M.: Automatic extraction of object-oriented component interfaces. In: ISSTA, pp. 218–228 (2002)
Wies, T., Zufferey, D., Henzinger, T.: Forward analysis of depth-bounded processes. In: Ong, L. (ed.) FOSSACS 2010. LNCS, vol. 6014, pp. 94–108. Springer, Heidelberg (2010)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2014 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Esmaeilsabzali, S., Majumdar, R., Wies, T., Zufferey, D. (2014). Dynamic Package Interfaces. In: Gnesi, S., Rensink, A. (eds) Fundamental Approaches to Software Engineering. FASE 2014. Lecture Notes in Computer Science, vol 8411. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-54804-8_18
Download citation
DOI: https://doi.org/10.1007/978-3-642-54804-8_18
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-54803-1
Online ISBN: 978-3-642-54804-8
eBook Packages: Computer ScienceComputer Science (R0)