Automated Software Engineering

, Volume 18, Issue 3–4, pp 263–292 | Cite as

Mining temporal specifications from object usage

Article

Abstract

A caller must satisfy the callee’s precondition—that is, reach a state in which the callee may be called. Preconditions describe the state that needs to be reached, but not how to reach it. We combine static analysis with model checking to mine Fair Computation Tree Logic (CTL F ) formulas that describe the operations a parameter goes through: “In parseProperties(String xml), the parameter xml normally stems from getProperties().” Such operational preconditions can be learned from program code, and the code can be checked for their violations. Applied to AspectJ, our Tikanga prototype found 169 violations of operational preconditions, uncovering 7 unique defects and 27 unique code smells—with 52% true positives in the 25% top-ranked violations.

Keywords

Automatic defect detection Mining specifications Temporal logic Computation Tree Logic Program analysis 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Acharya, M., Xie, T., Xu, J.: Mining interface specifications for generating checkable robustness properties. In: ISSRE 2006: Proceedings of the 17th International Symposium on Software Reliability Engineering, pp. 311–320. IEEE Computer Society, Los Alamitos (2006) CrossRefGoogle Scholar
  2. Acharya, M., Xie, T., Pei, J., Xu, J.: Mining API patterns as partial orders from source code: from usage scenarios to specifications. In: ESEC-FSE 2007: Proceedings of the the 6th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on The Foundations of Software Engineering, pp. 25–34. ACM, New York (2007) Google Scholar
  3. Alur, R., Černý, P., Madhusudan, P., Nam, W.: Synthesis of interface specifications for Java classes. In: POPL 2005: Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 98–109. ACM, New York (2005) CrossRefGoogle Scholar
  4. Ammons, G., Bodík, R., Larus, J.R.: Mining specifications. In: POPL 2002: Proceedings of the 29th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 4–16. ACM, New York, (2002) CrossRefGoogle Scholar
  5. Antoy, S., Hamlet, D.: Automatically checking an implementation against its formal specification. IEEE Trans. Softw. Eng. 26(1), 55–69 (2000) CrossRefGoogle Scholar
  6. Bodden, E., Lam, P., Hendren, L.: Finding programming errors earlier by evaluating runtime monitors ahead-of-time. In: SIGSOFT 2008/FSE-16: Proceedings of the 16th ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 36–47. ACM, New York (2008) CrossRefGoogle Scholar
  7. Brin, S., Motwani, R., Ullman, J.D., Tsur, S.: Dynamic itemset counting and implication rules for market basket data. In: SIGMOD 1997: Proceedings of the 1997 ACM SIGMOD International Conference on Management of Data, pp. 255–264. ACM, New York (1997) CrossRefGoogle Scholar
  8. Chan, W.: Temporal-logic queries. In: Proceedings of the 12th International Conference on Computer Aided Verification. Lecture Notes in Computer Science, vol. 1855, pp. 450–463. Springer, Berlin (2000) CrossRefGoogle Scholar
  9. Chang, R.Y., Podgurski, A., Yang, J.: Discovering neglected conditions in software by mining dependence graphs. IEEE Trans. Softw. Eng. 34(5), 579–596 (2008) CrossRefGoogle Scholar
  10. Clarke, E.M., Emerson, E.A., Sistla, A.P.: Automatic verification of finite-state concurrent systems using temporal logic specifications. ACM Trans. Program. Lang. Syst. 8(2), 244–263 (1986) MATHCrossRefGoogle Scholar
  11. Cook, J.E., Wolf, A.L.: Discovering models of software processes from event-based data. ACM Trans. Softw. Eng. Methodol. 7(3), 215–249 (1998) CrossRefGoogle Scholar
  12. Csallner, C., Tillmann, N., Smaragdakis, Y.: DySy: dynamic symbolic execution for invariant inference. In: Proc. ICSE’08, pp. 281–290. ACM, New York (2008). http://doi.acm.org/10.1145/1368088.1368127 Google Scholar
  13. Dallmeier, V., Lindig, C., Zeller, A.: Lightweight defect localization for Java. In: ECOOP 2005: Proceedings of the 19th European Conference on Object-Oriented Programming. Lecture Notes in Computer Science, vol. 3586, pp. 528–550. Springer, Berlin (2005) CrossRefGoogle Scholar
  14. Dallmeier, V., Knopp, N., Mallon, C., Hack, S., Zeller, A.: Generating test cases for specification mining. In: Proceedings of the 19th International Symposium on Software Testing and Analysis, pp. 85–96. ACM, New York (2010). http://doi.acm.org/10.1145/1831708.1831719 CrossRefGoogle Scholar
  15. Engler, D., Chen, D.Y., Hallem, S., Chou, A., Chelf, B.: Bugs as deviant behavior: a general approach to inferring errors in systems code. In: SOSP 2001: Proceedings of the 18th ACM Symposium on Operating Systems Principles, pp. 57–72. ACM, New York (2001) CrossRefGoogle Scholar
  16. Ernst, M.D., Cockrell, J., Griswold, W.G., Notkin, D.: Dynamically discovering likely program invariants to support program evolution. IEEE Trans. Softw. Eng. 27(2), 99–123 (2001) CrossRefGoogle Scholar
  17. Fink, S.J., Yahav, E., Dor, N., Ramalingam, G., Geay, E.: Effective typestate verification in the presence of aliasing. ACM Trans. Softw. Eng. Methodol. 17(2), 1–34 (2006) CrossRefGoogle Scholar
  18. Flanagan, C., Leino, K.R.M.: Houdini, an annotation assistant for ESC/Java. In: Proc. FME’01, pp. 500–517. Springer, London (2001). http://portal.acm.org/citation.cfm?id=647540.730008 Google Scholar
  19. Fowler, M.: Refactoring. Improving the Design of Existing Code. Addison-Wesley, Reading (1999) Google Scholar
  20. Gabel, M., Su, Z.: Javert: fully automatic mining of general temporal properties from dynamic traces. In: SIGSOFT 2008/FSE-16: Proceedings of the 16th ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 339–349. ACM, New York (2008) CrossRefGoogle Scholar
  21. Gabel, M., Su, Z.: Online inference and enforcement of temporal properties. In: ICSE 2010: Proceedings of the 32nd International Conference on Software Engineering, pp. 15–24. ACM, New York (2010) Google Scholar
  22. Ganter, B., Wille, R.: Formal Concept Analysis: Mathematical Foundations. Springer, Berlin (1999) MATHGoogle Scholar
  23. Götzmann, D.N.: Formale Begriffsanalyse in Java: Entwurf und Implementierung effizienter Algorithmen. Bachelor thesis, Saarland University (2007). Available from http://code.google.com/p/colibri-java/
  24. Gurfinkel, A., Chechik, M., Devereux, B.: Temporal logic query checking: a tool for model exploration. IEEE Trans. Softw. Eng. 29(10), 898–914 (2003) CrossRefGoogle Scholar
  25. Hangal, S., Lam, M.S.: Tracking down software bugs using automatic anomaly detection. In: ICSE 2002: Proceedings of the 24th International Conference on Software Engineering, pp. 291–301. ACM, New York (2002) CrossRefGoogle Scholar
  26. Henkel, J., Diwan, A.: Discovering algebraic specifications from Java classes. In: Proc ECOOP’03, pp. 431–456 (2003) Google Scholar
  27. Hovemeyer, D., Pugh, W.: Finding bugs is easy. In: OOPSLA 2004: Companion to the 19th Annual ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pp. 132–136. ACM, New York (2004) CrossRefGoogle Scholar
  28. Jonsson, B., Khan, A.H., Parrow, J.: Implementing a model checking algorithm by adapting existing automated tools. In: Proceedings of the International Workshop on Automatic Verification Methods for Finite State Systems. Lecture Notes in Computer Science, vol. 407, pp. 179–188. Springer, Berlin (1990) Google Scholar
  29. Li, Z., Zhou, Y.: PR-Miner: Automatically extracting implicit programming rules and detecting violations in large software code. In: ESEC/FSE-13: Proceedings of the 10th European Software Engineering Conference Held Jointly with 13th ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 306–315. ACM, New York (2005) Google Scholar
  30. Lindig, C.: Mining patterns and violations using concept analysis. Technical report, Saarland University, Software Engineering Chair (2007). Avaliable from http://www.st.cs.uni-saarland.de/publications/; the software is available from http://code.google.com/p/colibri-ml/
  31. Livshits, B., Zimmermann, T.: DynaMine: Finding common error patterns by mining software revision histories. In: ESEC/FSE-13: Proceedings of the 10th European Software Engineering Conference Held Jointly with 13th ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 296–305. ACM, New York (2005) Google Scholar
  32. Mandelin, D., Xu, L., Bodík, R., Kimelman, D.: Jungloid mining: helping to navigate the API jungle. In: PLDI 2005: Proceedings of the ACM SIGPLAN 2005 Conference on Programming Language Design and Implementation, pp. 48–61. ACM, New York (2005) CrossRefGoogle Scholar
  33. 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-FSE 2009: Proceedings of the the 7th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on The Foundations of Software Engineering, pp. 383–392. ACM, New York (2009) Google Scholar
  34. Polikarpova, N., Ciupa, I., Meyer, B.: A comparative study of programmer-written and automatically inferred contracts. In: Proc. ISSTA’09, pp. 93–104. ACM, New York (2009). http://doi.acm.org/10.1145/1572272.1572284 Google Scholar
  35. Ramanathan, M.K., Grama, A., Jagannathan, S.: Static specification inference using predicate mining. In: PLDI 2007: Proceedings of the 2007 ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 123–134. ACM, New York (2007) CrossRefGoogle Scholar
  36. Reiss, S.P.: Specifying and checking component usage. In: AADEBUG 2005: Proceedings of the Sixth International Symposium on Automated Analysis-Driven Debugging, pp. 13–22. ACM, New York (2005) CrossRefGoogle Scholar
  37. Sahavechaphan, N., Claypool, K.: XSnippet: Mining for sample code. In: OOPSLA 2006: Proceedings of the 21st Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 413–430. ACM, New York (2006) CrossRefGoogle Scholar
  38. Shoham, S., Yahav, E., Fink, S., Pistoia, M.: Static specification mining using automata-based abstractions. In: Proc. ISSTA’07, pp. 174–184. ACM, New York (2007). http://doi.acm.org/10.1145/1273463.1273487 Google Scholar
  39. Shoham, S., Yahav, E., Fink, S.J., Pistoia, M.: Static specification mining using automata-based abstractions. IEEE Trans. Softw. Eng. 34(5), 651–666 (2008) CrossRefGoogle Scholar
  40. Thummalapenta, S., Xie, T.: Alattin: Mining alternative patterns for detecting neglected conditions. In: ASE 2009: Proceedings of the 24th IEEE/ACM International Conference on Automated Software Engineering, pp. 283–294. IEEE Computer Society, Los Alamitos (2009a) Google Scholar
  41. Thummalapenta, S., Xie, T.: Mining exception-handling rules as sequence association rules. In: ICSE 2009: Proceedings of the 31st International Conference on Software Engineering, pp. 496–506. IEEE Computer Society, Los Alamitos (2009b) Google Scholar
  42. Wasylkowski, A.: Object usage: Patterns and anomalies. PhD thesis, Saarland University (2010). Available from http://www.st.cs.uni-saarland.de/~wasylkowski/papers/wasylkowski-2010-thesis.pdf
  43. Wasylkowski, A., Zeller, A.: Mining temporal specifications from object usage. In: ASE 2009: Proceedings of the 24th IEEE/ACM International Conference on Automated Software Engineering, pp. 295–306. IEEE Computer Society, Los Alamitos (2009) Google Scholar
  44. Wasylkowski, A., Zeller, A., Lindig, C.: Detecting object usage anomalies. In: ESEC-FSE 2007: Proceedings of the the 6th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering, pp. 35–44. ACM, New York (2007) Google Scholar
  45. Weimer, W., Necula, G.C.: Mining temporal specifications for error detection. In: TACAS 2005: Proceedings of the 12th International Conference on Tools and Algorithms for the Construction and Analysis of Systems. Lecture Notes in Computer Science, vol. 3440, pp. 461–476. Springer, Berlin (2005) CrossRefGoogle Scholar
  46. Whaley, J., Martin, M.C., Lam, M.S.: Automatic extraction of object-oriented component interfaces. In: ISSTA 2002: Proceedings of the 2002 ACM SIGSOFT International Symposium on Software Testing and Analysis, pp. 218–228. ACM, New York (2002) CrossRefGoogle Scholar
  47. Yang, J., Evans, D., Bhardwaj, D., Bhat, T., Das, M.: Perracotta: mining temporal API rules from imperfect traces. In: ICSE 2006: Proceedings of the 28th International Conference on Software Engineering, pp. 282–291. ACM, New York (2006) CrossRefGoogle Scholar
  48. Zeller, A.: Why Programs Fail: A Guide to Systematic Debugging. Morgan Kaufmann, San Francisco (2005) Google Scholar
  49. Zhong, H., Xie, T., Zhang, L., Pei, J., Mei, H.: MAPO: Mining and recommending API usage patterns. In: ECOOP 2009: Proc. 23rd European Conference on Object-Oriented Programming. Lecture Notes in Computer Science, vol. 5653, pp. 318–343. Springer, Berlin (2009) CrossRefGoogle Scholar

Copyright information

© Springer Science+Business Media, LLC 2011

Authors and Affiliations

  1. 1.Department of Computer ScienceSaarland UniversitySaarbrückenGermany

Personalised recommendations