skip to main content
10.1145/1449764.1449784acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Enforcing object protocols by combining static and runtime analysis

Published:19 October 2008Publication History

ABSTRACT

In this paper, we consider object protocols that constrain interactions between objects in a program. Several such protocols have been proposed in the literature. For many APIs (such as JDOM, JDBC), API designers constrain how API clients interact with API objects. In practice, API clients violate such constraints, as evidenced by postings in discussion forums for these APIs. Thus, it is important that API designers specify constraints using appropriate object protocols and enforce them. The goal of an object protocol is expressed as a protocol invariant. Fundamental properties such as ownership can be expressed as protocol invariants. We present a language, PROLANG, to specify object protocols along with their protocol invariants, and a tool, INVCOP++, to check if a program satisfies a protocol invariant. INVCOP++ separates the problem of checking if a protocol satisfies its protocol invariant (called protocol correctness), from the problem of checking if a program conforms to a protocol (called program conformance). The former is solved using static analysis, and the latter using runtime analysis. Due to this separation (1) errors made in protocol design are detected at a higher level of abstraction, independent of the program's source code, and (2) performance of conformance checking is improved as protocol correctness has been verified statically. We present theoretical guarantees about the way we combine static and runtime analysis, and empirical evidence that our tool INVCOP++ finds usage errors in widely used APIs. We also show that statically checking protocol correctness greatly optimizes the overhead of checking program conformance, thus enabling API clients to test whether their programs use the API as intended by the API designer.

References

  1. AspectJ -- http://www.eclipse.org/aspectj/.Google ScholarGoogle Scholar
  2. T. Ball and S. K. Rajamani. The SLAM project: Debugging system software via static analysis. In POPL 02: Principles of Programming Languages, pages 1--3. ACM, January 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. M. Barnett, R. DeLine, M. Fähndrich, K. R. M. Leino, and W. Schulte. Verification of object-oriented programs with invariants. JOT, 3(6):27--56, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  4. M. Barnett, K. R. M. Leino, and W. Schulte. The Spec# programming system: An overview. In CASSIS 04: Construction and Analysis of Safe, Secure and Interoperable Smart devices, LNCS 3362. Springer Verlag, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. M. Barnett and D. A. Naumann. Friends need a bit more: Maintaining invariants over shared state. In MPC, pages 54--84. Springer-Verlag, 2004.Google ScholarGoogle Scholar
  6. C. Boyapati, B. Liskov, and L. Shrira. Ownership types for object encapsulation. In POPL, pages 213--223. ACM, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. F. Chen and G. Rosu. Mop: an efficient and generic runtime verification framework. In OOPSLA, pages 569--588, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. B. Chin, S. Markstrum, and T. Millstein. Semantic type qualifiers. In PLDI 05: Programming Language Design and Implementation, pages 85--95. ACM, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. D. G. Clarke, J. Potter, and J. Noble. Ownership types for flexible alias protection. In OOPSLA, pages 48--64, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. http://www.servlets.com/archive/servlet/ReadMsg?msgId=539019&listName=jdom-interest.Google ScholarGoogle Scholar
  11. http://bugs.mysql.com/bug.php?id=2054.Google ScholarGoogle Scholar
  12. T. H. Cormen, C. E. Leiserson, and R. L. Rivest. Introduction to Algorithms. The MIT Press, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. R. DeLine and M. Fähndrich. Enforcing high-level protocols in low-level software. In PLDI 01: Programming Language Design and Implementation. ACM, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. D. Detlefs, G. Nelson, and J. B. Saxe. Simplify: a theorem prover for program checking. J. ACM, 52(3):365--473, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. S. Fink, E. Yahav, N. Dor, G. Ramalingam, and E. Geay. Effective typestate verification in the presence of aliasing. In ISSTA 06: Software Testing and Analysis. ACM, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. J. S. Foster, T. Terauchi, and A. Aiken. Flow-sensitive type qualifiers. In PLDI 02: Programming Language Design and Implementation, pages 1--12. ACM, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. M. Fowler. Analysis Patterns: Reusable Object Models. Addison-Wesley, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. M. Gopinathan and S. Rajamani. Runtime monitoring of object invariants with guarantee. In RV '08: Runtime Verification, LNCS 5289. Springer, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. R. Helm, I. M. Holland, and D. Gangopadhyay. Contracts: Specifying behavioural compositions in object-oriented systems. In OOPSLA/ECOOP, pages 169--180, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. C. Jaspan and J. Aldrich. Checking framework plugins. In OOPSLA Companion, pages 795--796, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. http://archives.postgresql.org/pgsql-jdbc/2003--10/msg00062.php.Google ScholarGoogle Scholar
  22. http://java.sun.com/products/jdbc/download.html#corespec40.Google ScholarGoogle Scholar
  23. JDOM -- http://www.jdom.org.Google ScholarGoogle Scholar
  24. JDOM FAQ -- http://www.jdom.org/docs/faq.html#a0390.Google ScholarGoogle Scholar
  25. G. Kiczales, J. Lamping, A. Mendhekar, C. Maeda, C. V. Lopes, J.-M. Loingtier, and J. Irwin. Aspect-oriented programming. In ECOOP, pages 220--242, 1997.Google ScholarGoogle ScholarCross RefCross Ref
  26. G. Leavens and Y. Cheon. Design by contract with jml, 2003.Google ScholarGoogle Scholar
  27. http://people.csa.iisc.ernet.in/gmadhu/oopsla.Google ScholarGoogle Scholar
  28. MySQL -- http://www.mysql.com.Google ScholarGoogle Scholar
  29. http://java.sun.com/javase/6/docs/platform/serialization/spec/security.html#4271.Google ScholarGoogle Scholar
  30. R. E. Strom and S. Yemini. Typestate: A programming language concept for enhancing software reliability. IEEE Trans. Softw. Eng., 12(1):157--171, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Enforcing object protocols by combining static and runtime analysis

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        OOPSLA '08: Proceedings of the 23rd ACM SIGPLAN conference on Object-oriented programming systems languages and applications
        October 2008
        654 pages
        ISBN:9781605582153
        DOI:10.1145/1449764
        • cover image ACM SIGPLAN Notices
          ACM SIGPLAN Notices  Volume 43, Issue 10
          September 2008
          613 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/1449955
          Issue’s Table of Contents

        Copyright © 2008 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 19 October 2008

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        Overall Acceptance Rate268of1,244submissions,22%

        Upcoming Conference

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader