skip to main content
research-article

A graph-based approach to API usage adaptation

Published:17 October 2010Publication History
Skip Abstract Section

Abstract

Reusing existing library components is essential for reducing the cost of software development and maintenance. When library components evolve to accommodate new feature requests, to fix bugs, or to meet new standards, the clients of software libraries often need to make corresponding changes to correctly use the updated libraries. Existing API usage adaptation techniques support simple adaptation such as replacing the target of calls to a deprecated API, however, cannot handle complex adaptations such as creating a new object to be passed to a different API method, or adding an exception handling logic that surrounds the updated API method calls.

This paper presents LIBSYNC that guides developers in adapting API usage code by learning complex API usage adaptation patterns from other clients that already migrated to a new library version (and also from the API usages within the library's test code). LIBSYNC uses several graph-based techniques (1) to identify changes to API declarations by comparing two library versions, (2) to extract associated API usage skeletons before and after library migration, and (3) to compare the extracted API usage skeletons to recover API usage adaptation patterns. Using the learned adaptation patterns, LIBSYNC recommends the locations and edit operations for adapting API usages. The evaluation of LIBSYNC on real-world software systems shows that it is highly correct and useful with a precision of 100% and a recall of 91%.

References

  1. }}M. Acharya, T. Xie, J. Pei, and J. Xu. Mining API patterns as partial orders from source code: from usage scenarios to specifications. In ESEC-FSE '07: Proceedings of the 6th joint meeting of the European software engineering conference and the ACM SIGSOFT symposium on The foundations of software engineering, pages 25--34. ACM Press, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. }}R. Agrawal and R. Srikant. Fast algorithms for mining association rules in large databases. In VLDB '94: Proceedings of the 20th International Conference on Very Large Data Bases, pages 487--499. Morgan Kaufmann Publishers Inc., 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. }}J. Andersen and J. Lawall. Generic patch inference. In ASE '08: Proceedings of the 23rd IEEE/ACM International Conference on Automated Software Engineering, 2008, pages 337--346. IEEE Computer Society, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. }}A. Andoni and PiotrIndyk. E2 lsh 0.1 user manual. http://web.mit.edu/andoni/www/LSH/manual.pdf.Google ScholarGoogle Scholar
  5. }}T. Apiwattanapong, A. Orso, and M. J. Harrold. A differencing algorithm for object-oriented programs. In ASE '04: Proceedings of the 19th IEEE International Conference on Automated Software Engineering, pages 2--13. IEEE Computer Society, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. }}D. Binkley, S. Horwitz, and T. Reps. Program integration for languages with procedure calls. ACM Transactions on Software Engineering and Methodology, 4(1):3--35, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. }}K. Chow and D. Notkin. Semi-automatic update of applications in response to library changes. In ICSM '96: Proceedings of the 1996 International Conference on Software Maintenance, page 359. IEEE Computer Society, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. }}B. Dagenais and M. P. Robillard. Recommending adaptive changes for framework evolution. In ICSE '08: Proceedings of the 30th International Conference on Software Engineering, pages 481--490. ACM Press, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. }}D. Dig and R. Johnson. The role of refactorings in API evolution. In ICSM '05: Proceedings of the 21st IEEE International Conference on Software Maintenance, pages 389--398. IEEE Computer Society, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. }}D. Dig and R. Johnson. Automated detection of refactorings in evolving components. In ECOOP '06: Proceedings of European Conference on Object-Oriented Programming, pages 404--428. Springer, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. }}D. Dig, K. Manzoor, R. Johnson, and T. N. Nguyen. Refactoring-aware configuration management for object-oriented programs. In ICSE '07: Proceedings of the 29th International Conference on Software Engineering, pages 427--436. IEEE Computer Society, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. }}D. Engler, D. Y. Chen, S. Hallem, A. Chou, and B. Chelf. Bugs as deviant behavior: a general approach to inferring errors in systems code. In SOSP '01: Proceedings of the eighteenth ACM symposium on Operating systems principles, pages 57--72. ACM Press, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. }}B. Fluri, M. Wursch, M. Pinzger, and H. C. Gall. Change distilling - tree differencing for fine-grained source code change extraction. IEEE Transactions on Software Engi- neering, 33(11):18, November 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. }}M. Gabel and Z. Su. Javert: fully automatic mining of general temporal properties from dynamic traces. In SIGSOFT '08/FSE-16: Proceedings of the 16th ACM SIGSOFT International Symposium on Foundations of software engineering, pages 339--349. ACM Press, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. }}J. Henkel and A. Diwan. CatchUp!: capturing and replaying refactorings to support API evolution. In ICSE '05: Proceedings of the 27th International Conference on Software Engineering, pages 274--283. ACM Press, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. }}J. W. Hunt and M. Mcilroy. An algorithm for differential file comparison. Technical report, 1976.Google ScholarGoogle Scholar
  17. }}J. W. Hunt and T. G. Szymanski. A fast algorithm for computing longest common subsequences. Communications of the ACM, 20(5):350--353, 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. }}M. Kim, D. Notkin, and D. Grossman. Automatic inference of structural changes for matching across program versions. In ICSE '07: Proceedings of the 29th International Conference on Software Engineering, pages 333--343. IEEE Computer Society, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. }}S. Kim, K. Pan, and J. E. James Whitehead. When functions change their names: Automatic detection of origin relationships. In WCRE '05: Proceedings of the 12th Working Conference on Reverse Engineering, pages 143--152. IEEE Computer Society, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. }}S. Kim, E. J. Whitehead, and . J. Bevan, Jr. Properties of signature change patterns. In ICSM '06: Proceedings of the 22nd IEEE International Conference on Software Maintenance, pages 4--13. IEEE Computer Society, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. }}J. L. Lawall, G. Muller, and N. Palix. Enforcing the use of API functions in Linux code. In ACP4IS '09: Proceedings of the 8th workshop on Aspects, components, and patterns for infrastructure software, pages 7--12. ACM Press, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. }}B. Livshits and T. Zimmermann. Dynamine: finding common error patterns by mining software revision histories. SIGSOFT Softw. Eng. Notes, 30(5):296--305, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. }}I. Neamtiu, J. S. Foster, and M. Hicks. Understanding source code evolution using Abstract Syntax Tree matching. In MSR'05: Proceedings of the 2005 Mining Software Repositories Workshop, pages 2--6. ACM Press, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. }}H. A. Nguyen, T. T. Nguyen, N. H. Pham, J. M. Al-Kofahi, and T. N. Nguyen. Accurate and efficient structural characteristic feature extraction for clone detection. In FASE '09: Proceedings of the International Conference on Fundamental Approaches to Software Engineering, pages 440--455. Springer Verlag, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. }}T. T. Nguyen, H. A. Nguyen, N. H. Pham, J. M. Al-Kofahi, and T. N. Nguyen. Graph-based Mining of Multiple Object Usage Patterns. In ESEC/FSE '09: Proceedings of the 17th ACM SIGSOFT Symposium on the Foundations of Software Engineering. ACM Press, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. }}Y. Padioleau, J. L. Lawall, and G. Muller. Understanding collateral evolution in linux device drivers. SIGOPS Operating Systems Review, 40(4):59--71, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. }}Y. Padioleau, J. L. Lawall, and G. Muller. SmPL: A domain-specific language for specifying collateral evolutions in linux device drivers. Electronic Notes Theoretical Computer Science, 166:47--62, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. }}M. Pradel and T. R. Gross. Automatic generation of object usage specifications from large method traces. In ASE '09: Proceedings of the 24th IEEE/ACM International Conference on Automated Software Engineering, pages 371--382. IEEE Computer Society, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. }}M. K. Ramanathan, A. Grama, and S. Jagannathan. Path-sensitive inference of function precedence protocols. In ICSE '07: Proceedings of 29th international conference on Software Engineering, pages 240--250. IEEE CS, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. }}S. Shoham, E. Yahav, S. Fink, and M. Pistoia. Static specification mining using automata-based abstractions. In ISSTA '07: Proceedings of the international symposium on Software testing and analysis, pages 174--184. ACM Press, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. }}JBoss: An open source, standards-compliant, J2EE based application server. http://sourceforge.net/projects/jboss/.Google ScholarGoogle Scholar
  32. }}Subversion.tigris.org. http://subversion.tigris.org/.Google ScholarGoogle Scholar
  33. }}W. Tansey and E. Tilevich. Annotation refactoring: inferring upgrade transformations for legacy applications. In OOPSLA '08: Proceedings of the 23rd ACM SIGPLAN conference on Object-oriented programming systems languages and applications, pages 295--312. ACM Press, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. }}S. Thummalapenta and T. Xie. Alattin: Mining alternative patterns for detecting neglected conditions. In ASE '09: Proceedings of the 24th International Conference on Automated Software Engineering, pages 283--294. IEEE Computer Society, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. }}W. F. Tichy. The string-to-string correction problem with block moves. ACM Transactions on Computer Systems, 2(4):309--321, 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. }}A. Wasylkowski and A. Zeller. Mining temporal specifications from object usage. In ASE '09: Proceedings of the 24th IEEE/ACM International Conference on Automated Software Engineering, pages 295--306. IEEE Computer Society, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. }}A. Wasylkowski, A. Zeller, and C. Lindig. Detecting object usage anomalies. In ESEC-FSE '07: Proceedings of the 6th joint meeting of the European software engineering conference and the ACM SIGSOFT symposium on Foundations of software engineering, pages 35--44. ACM Press, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. }}P. Weissgerber and S. Diehl. Identifying refactorings from source-code changes. In ASE '06: Proceedings of the 21st IEEE/ACM International Conference on Automated Software Engineering, pages 231--240. IEEE Computer Society, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. }}C. C.Williams and J. K. Hollingsworth. Automatic mining of source code repositories to improve bug finding techniques. IEEE Trans. Softw. Eng., 31(6):466--480, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. }}W.Wu, Y.-G. Gueheneuc, G. Antoniol, and M. Kim. Aura: A hybrid approach to identify framework evolution. In ICSE '10: Proceedings of the 32nd International Conference on Software Engineering. ACM Press, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. }}Z. Xing and E. Stroulia. Umldiff: an algorithm for object-oriented design differencing. In ASE '05: Proceedings of the 20th IEEE/ACM International Conference on Automated Software Engineering, pages 54--65. ACM Press, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. }}Z. Xing and E. Stroulia. Refactoring practice: How it is and how it should be supported - an Eclipse case study. In ICSM '06: Proceedings of the 22nd IEEE International Conference on Software Maintenance, pages 458--468. IEEE Computer Society, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. }}Z. Xing and E. Stroulia. API-evolution support with Diff-Catchup. IEEE Trans. Softw. Eng., 33(12):818--836, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. }}J. Yang, D. Evans, D. Bhardwaj, T. Bhat, and M. Das. Perracotta: mining temporal API rules from imperfect traces. In ICSE '06: Proceedings of the 28th international conference on Software engineering, pages 282--291. ACM Press, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. }}R. Yokomori, H. Siy, M. Noro, and K. Inoue. Assessing the impact of framework changes using component ranking. In ICSM '09: Proceedings of the International Conference on Software Maintenance, pages 189--198. IEEE Computer Society, 2009.Google ScholarGoogle ScholarCross RefCross Ref
  46. }}H. Zhong, L. Zhang, T. Xie, and H. Mei. Inferring resource specifications from natural language API documentation. In ASE '09: Proceedings of the 24th IEEE/ACM International Conference on Automated Software Engineering, ACM Press, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. }}L. Zou and M. W. Godfrey. Using origin analysis to detect merging and splitting of source code entities. IEEE Transactions on Software Engineering, 31(2):166--181, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A graph-based approach to API usage adaptation

    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

    Full Access

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!