Skip to main content
Log in

The Clara framework for hybrid typestate analysis

  • Runtime Verification
  • Published:
International Journal on Software Tools for Technology Transfer Aims and scope Submit manuscript

Abstract

A typestate property describes which operations are available on an object or a group of inter-related objects, depending on this object’s or group’s internal state, the typestate. Researchers in the field of static analysis have devised static program analyses to prove the absence of typestate-property violations on all possible executions of a given program under test. Researchers in runtime verification, on the other hand, have developed powerful monitoring approaches that guarantee to capture property violations on actual executions. Although static analysis can greatly benefit runtime monitoring, up until now, most static analyses are incompatible with most monitoring tools. We present Clara, a novel framework that makes these approaches compatible. With Clara, researchers in static analysis can easily implement powerful typestate analyses. Runtime-verification researchers, on the other hand, can use Clara to specialize AspectJ-based runtime monitors to a particular target program. To make aspects compatible to Clara, the monitoring tool annotates them with so-called dependency state machines. Clara uses the static analyses to automatically convert an annotated monitoring aspect into a residual runtime monitor that is triggered by fewer program locations. If the static analysis succeeds on all locations, this proves that the program fulfills the stated typestate properties, making runtime monitoring entirely obsolete. If not, the residual runtime monitor is at least optimized. We instantiated Clara with three static typestate analyses and applied these analyses to monitoring aspects generated from tracematches. In two-thirds of the cases in our experiments, the static analysis succeeds on all locations, proving that the program fulfills the stated properties, and completely obviating the need for runtime monitoring. In the remaining cases, the runtime monitor is often significantly optimized.

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Allan, C., Avgustinov, P., Christensen, A.S., Hendren, L., Kuzins, S., Lhoták, O., de Moor, O., Sereni, D., Sittampalam, G., Tibble, J.: Adding Trace Matching with Free Variables to AspectJ. In: OOPSLA, pp. 345–364. ACM Press (October 2005)

  2. Avgustinov, P., Christensen, A.S., Hendren, L., Kuzins, S., Lhoták, J., Lhoták, O., de Moor, O., Sereni, D., Sittampalam, G., Tibble, J.: abc: an extensible AspectJ compiler. In: AOSD, pp. 87–98. ACM Press (March 2005)

  3. Avgustinov, P., Tibble, J., de Moor, O.: Making trace monitors feasible. In: OOPSLA, pp. 589–608. ACM Press (October 2007)

  4. Barik, R.: Efficient computation of may-happen-in-parallel information for concurrent Java programs. In: International Workshop on Languages and Compilers for Parallel Computing (LCPC), volume 4339 of LNCS, pp. 152–169. Springer (October 2005)

  5. Bierhoff, K., Aldrich, J.: Modular typestate checking of aliased objects. In: OOPSLA, pp. 301–320 (October 2007)

  6. Blackburn, S.M., Garner, R., Hoffman, C., Khan, A.M., McKinley, K.S., Bentzur, R., Diwan, A., Feinberg, D., Frampton, D., Guyer, S.Z., Hirzel, M., Hosking, A., Jump, M., Lee, H., Moss, J.E.B., Phansalkar, A., Stefanovic, D., VanDrunen, T., von Dincklage, D., Wiedermann, B.: The DaCapo benchmarks: Java benchmarking development and analysis. In: OOPSLA, pp. 169–190. ACM Press (October 2006)

  7. Bodden, E.: J-LO—a tool for runtime-checking temporal assertions. Master’s thesis, RWTH Aachen University (November 2005)

  8. Bodden, E.: Verifying finite-state properties of large-scale programs. PhD thesis, McGill University (June 2009). Available through ProQuest

  9. Bodden, E.: Efficient hybrid typestate analysis by determining continuation-equivalent states. In: ICSE ’10: Proceedings of the 32nd ACM/IEEE International Conference on Software Engineering, pp. 5–14. ACM, New York, NY, USA (2010)

  10. Bodden, E., Chen, F., Roşu, G.: Dependent advice: a general approach to optimizing history-based aspects. In: AOSD, pp. 3–14. ACM Press (March 2009)

  11. Bodden, E., Hendren, L., Lam, P., Lhoták, O., Naeem, N.A.: Collaborative runtime verification with tracematches. J. Log. Comput. (November 2008). doi:10.1093/logcom/exn077

  12. Bodden, E., Hendren, L.J., Lhoták, O.:. A staged static program analysis to improve the performance of runtime monitoring. In: European Conference on Object-Oriented Programming (ECOOP), volume 4609 of LNCS, pp. 525–549. Springer (2007)

  13. Bodden, E., Lam, P., Hendren, L.: Finding programming errors earlier by evaluating runtime monitors ahead-of-time. In: Symposium on the Foundations of Software Engineering (FSE), pp. 36–47. ACM Press (November 2008)

  14. Bodden, E., Lam, P., Hendren, L.: Object representatives: a uniform abstraction for pointer information. In: Visions of Computer Science—BCS International Academic Conference. British Computing Society (September 2008)

  15. Bodden, E., Lam, P., Hendren, L.: Clara: a framework for statically evaluating finite-state runtime monitors. In: 1st International Conference on Runtime Verification (RV), volume 6418 of LNCS, pp. 74–88. Springer (November 2010)

  16. Chen, F., Roşu, G.: MOP: an efficient and generic runtime verification framework. In: OOPSLA, pp. 569–588. ACM Press (October 2007)

  17. Clocksin W.F., Mellish C.: Programming in Prolog, 5th edn. Springer, New York (2003)

    Book  MATH  Google Scholar 

  18. DeLine, R., Fähndrich, M.: Typestates for objects. In: European Conference on Object-Oriented Programming (ECOOP), Volume 3086 of LNCS, pp. 465–490. Springer (June 2004)

  19. Dwyer, M.B., Avrunin, G.S., Corbett, J.C.: Patterns in property specifications for finite-state verification. In: International Conference on Software Engineering (ICSE), pp. 411–420. ACM Press (May 1999)

  20. Dwyer, M.B., Purandare, R.: Residual dynamic typestate analysis: Exploiting static analysis results to reformulate and reduce the cost of dynamic analysis. In: International Conference on Automated Software Engineering (ASE), pp. 124–133. ACM Press (May 2007)

  21. Fink, S., Yahav, E., Dor, N., Ramalingam, G., Geay, E.: Effective typestate verification in the presence of aliasing. In: International Symposium on Software Testing and Analysis (ISSTA), pp. 133–144. ACM Press (July 2006)

  22. Gosling J., Joy B., Steele G., Bracha G.: The Java(TM) Language Specification. 3rd edn. Addison-Wesley Professional, Reading (2005)

    Google Scholar 

  23. Grieskamp, W.: (Microsoft Research): Personal communication (January 2007)

  24. Hilsdale, E., Hugunin, J.: Advice weaving in AspectJ. In: AOSD, pp. 26–35. ACM Press (March 2004)

  25. Krüger, I.H., Lee, G., Meisinger, M.: Automating software architecture exploration with M2Aspects. In: Workshop on Scenarios and State Machines: Models, Algorithms, and Tools (SCESM), pp. 51–58. ACM Press (May 2006)

  26. Liblit, B., Aiken, A., Zheng, A.X., Jordan, M.I.: Bug isolation via remote program sampling. In: Conference on Programming Language Design and Implementation (PLDI), pp. 141–154. ACM Press (June 2003)

  27. Maoz, S., Harel, D.: From multi-modal scenarios to code: compiling LSCs into AspectJ. In: Symposium on the Foundations of Software Engineering (FSE), pp. 219–230. ACM Press (November 2006)

  28. Masuhara, H., Kiczales, G., Dutchyn, C.: A compilation and optimization model for aspect-oriented programs. In: International Conference on Compiler Construction (CC), Volume 2622 of LNCS, pp. 46–60. Springer (April 2003)

  29. Naeem, N.A., Lhoták, O.: Typestate-like analysis of multiple interacting objects. In: OOPSLA, pp. 347–366. ACM Press (October 2008)

  30. Pnueli, A.: The temporal logic of programs. In: IEEE Symposium on the Foundations of Computer Science (FOCS), pp. 46–57. IEEE Computer Society, (October 1977)

  31. Sridharan, M., Bodík, R.: Refinement-based context-sensitive points-to analysis for Java. In: Conference on Programming Language Design and Implementation (PLDI), pp. 387–400. ACM Press (June 2006)

  32. Standard Performance Evaluation Coorperation. SPECjvm98 Documentation (March 1999). Release 1.03 edition

  33. Standard Performance Evaluation Coorperation. SPECjbb2000 (Java Business Benchmark) Documentation (2001). Release 1.01 edition

  34. Strom R.E., Yemini S.: Typestate: a programming language concept for enhancing software reliability. IEEE Trans Softw Eng (TSE) 12(1), 157–171 (1986)

    MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Eric Bodden.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Bodden, E., Hendren, L. The Clara framework for hybrid typestate analysis. Int J Softw Tools Technol Transfer 14, 307–326 (2012). https://doi.org/10.1007/s10009-010-0183-5

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10009-010-0183-5

Keywords

Navigation