Skip to main content

Inference of Necessary Field Conditions with Abstract Interpretation

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 7705))

Abstract

We present a new static analysis to infer necessary field conditions for object-oriented programs. A necessary field condition is a property that should hold on the fields of a given object, for otherwise there exists a calling context leading to a failure due to bad object state. Our analysis also infers the provenance of the necessary condition, so that if a necessary field condition is violated then an explanation containing the sequence of method calls leading to a failing assertion can be produced.

When the analysis is restricted to readonly fields, i.e., fields that can only be set in the initialization phase of an object, it infers object invariants. We provide empirical evidence on the usefulness of necessary field conditions by integrating the analysis into cccheck, our static analyzer for .NET. Robust inference of readonly object field invariants was the #1 request from cccheck users.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Barnett, M., Fähndrich, M., Leino, K.R.M., Müller, P., Schulte, W., Venter, H.: Specification and verification: the Spec# experience. CACM 54(6), 81–91 (2011)

    Article  Google Scholar 

  2. Brauer, J., Simon, A.: Inferring Definite Counterexamples through Under-Approximation. In: Goodloe, A.E., Person, S. (eds.) NFM 2012. LNCS, vol. 7226, pp. 54–69. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  3. Chalin, P., Kiniry, J.R., Leavens, G.T., Poll, E.: Beyond Assertions: Advanced Specification and Verification with JML and ESC/Java2. In: de Boer, F.S., Bonsangue, M.M., Graf, S., de Roever, W.-P. (eds.) FMCO 2005. LNCS, vol. 4111, pp. 342–363. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  4. Chang, B.-Y.E., Leino, K.R.M.: Inferring object invariants: Extended abstract. ENTCS 131 (2005)

    Google Scholar 

  5. Clarke, E.M., Grumberg, O., Peled, D.: Model checking. MIT Press (2001)

    Google Scholar 

  6. Cousot, P.: Asynchronous iterative methods for solving a fixed point system of monotone equations in a complete lattice. Res. rep. 88, Laboratoire IMAG, Université scientifique et médicale de Grenoble, France (1977)

    Google Scholar 

  7. Cousot, P., Cousot, R.: Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In: POPL (1977)

    Google Scholar 

  8. Cousot, P., Cousot, R., Logozzo, F.: Precondition Inference from Intermittent Assertions and Application to Contracts on Collections. In: Jhala, R., Schmidt, D. (eds.) VMCAI 2011. LNCS, vol. 6538, pp. 150–168. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  9. Csallner, C., Tillmann, N., Smaragdakis, Y.: DySy: dynamic symbolic execution for invariant inference. In: ICSE (2008)

    Google Scholar 

  10. Distefano, D., Parkinson, M.J.: jStar: Towards practical verification for Java. In: OOPSLA (2008)

    Google Scholar 

  11. Drossopoulou, S., Francalanza, A., Müller, P., Summers, A.J.: A Unified Framework for Verification Techniques for Object Invariants. In: Dell’Acqua, P. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 412–437. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  12. Ernst, M.D.: Dynamically Discovering Likely Program Invariants. PhD thesis, University of Washington (2000)

    Google Scholar 

  13. Fähndrich, M., Barnett, M., Logozzo, F.: Code Contracts (2009)

    Google Scholar 

  14. Fähndrich, M., Leino, K.R.M.: Declaring and checking non-null types in an object-oriented language. In: OOPSLA (2003)

    Google Scholar 

  15. Fähndrich, M., Logozzo, F.: Static Contract Checking with Abstract Interpretation. In: Beckert, B., Marché, C. (eds.) FoVeOOS 2010. LNCS, vol. 6528, pp. 10–30. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  16. Filliâtre, J.-C., Marché, C.: The Why/Krakatoa/Caduceus Platform for Deductive Program Verification. In: Damm, W., Hermanns, H. (eds.) CAV 2007. LNCS, vol. 4590, pp. 173–177. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  17. Flanagan, C., Leino, K.R.M.: Houdini, an Annotation Assistant for ESC/Java. In: Oliveira, J.N., Zave, P. (eds.) FME 2001. LNCS, vol. 2021, pp. 500–517. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  18. Flanagan, C., Leino, K.R.M., Lillibridge, M., Nelson, G., Saxe, J.B., Stata, R.: Extended static checking for java. In: PLDI (2002)

    Google Scholar 

  19. Hejlsberg, A., Torgersen, M., Wiltamuth, S., Golde, P.: The C# Programming Language. Addison-Wesley Professional (2010)

    Google Scholar 

  20. Jacobs, B., Smans, J., Piessens, F.: A Quick Tour of the VeriFast Program Verifier. In: Ueda, K. (ed.) APLAS 2010. LNCS, vol. 6461, pp. 304–311. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

  21. Le Goues, C., Leino, K.R.M., Moskal, M.: The Boogie Verification Debugger (Tool Paper). In: Barthe, G., Pardo, A., Schneider, G. (eds.) SEFM 2011. LNCS, vol. 7041, pp. 407–414. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  22. Logozzo, F.: Class-Level Modular Analysis for Object Oriented Languages. In: Cousot, R. (ed.) SAS 2003. LNCS, vol. 2694, pp. 37–54. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  23. Logozzo, F.: Modular static analysis of Object-oriented languages. PhD thesis, École polytechnique (2004)

    Google Scholar 

  24. Meyer, B.: Eiffel: The Language. Prentice Hall (1991)

    Google Scholar 

  25. MSDN. CodeContracts Forum, http://social.msdn.microsoft.com/Forums/en-US/codecontracts/threads/

  26. Rival, X.: Understanding the Origin of Alarms in Astrée. In: Hankin, C., Siveroni, I. (eds.) SAS 2005. LNCS, vol. 3672, pp. 303–319. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Bouaziz, M., Logozzo, F., Fähndrich, M. (2012). Inference of Necessary Field Conditions with Abstract Interpretation. In: Jhala, R., Igarashi, A. (eds) Programming Languages and Systems. APLAS 2012. Lecture Notes in Computer Science, vol 7705. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-35182-2_13

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-35182-2_13

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-35181-5

  • Online ISBN: 978-3-642-35182-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics