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

Annotation refactoring: inferring upgrade transformations for legacy applications

Published:19 October 2008Publication History

ABSTRACT

Since annotations were added to the Java language, many frameworks have moved to using annotated Plain Old Java Objects (POJOs) in their newest releases. Legacy applications are thus forced to undergo extensive restructuring in order to migrate from old framework versions to new versions based on annotations (Version Lock-in). Additionally, because annotations are embedded in the application code, changing between framework vendors may also entail largescale manual changes (Vendor Lock-in).

This paper presents a novel refactoring approach that effectively solves these two problems. Our approach infers a concise set of semantics-preserving transformation rules from two versions of a single class. Unlike prior approaches that detect only simple structural refactorings, our algorithm can infer general composite refactorings and is more than 97% accurate on average. We demonstrate the effectiveness of our approach by automatically upgrading more than 80K lines of the unit testing code of four open-source Java applications to use the latest version of the popular JUnit testing framework.

References

  1. T. Apiwattanapong, A. Orso, and M. J. Harrold. A differencing algorithm for object-oriented programs. In Automated Software Engineering, 2004. Proceedings. 19th International Conference on, pages 2--13, 2004. Google ScholarGoogle Scholar
  2. I. D. Baxter, C. Pidgeon, and M. Mehlich. DMS: Program transformations for practical scalable software evolution. In ICSE '04: Proceeding of the 26th International Conference on Software Engineering, pages 625--634, Los Alamitos, CA, USA, 2004. IEEE Computer Society. Google ScholarGoogle Scholar
  3. K. Beck and E. Gamma. Test Infected: Programmers love writing tests. Java Report, 3(7):37--50, 1998.Google ScholarGoogle Scholar
  4. C. Beust and H. Suleiman. Next Generation Java Testing: TestNG and Advanced Concepts. Addison-Wesley Professional, 2007. Google ScholarGoogle Scholar
  5. M. Boshernitsan, S. L. Graham, and M. A. Hearst. Aligning development tools with the way programmers think about code changes. In CHI '07: Proceedings of the SIGCHI Conference on Human Factors in Computing Systems, pages 567--576, New York, NY, USA, 2007. ACM. Google ScholarGoogle Scholar
  6. W. Brown, R. Malveau, H. McCormick III, and T. Mowbray. AntiPatterns: refactoring software, architectures, and projects in crisis. John Wiley & Sons, Inc. New York, NY, USA, 1998. Google ScholarGoogle Scholar
  7. F. Castor and P. Borba. A language for specifying Java transformations. In V Brazilian Symposium on Programming Languages, pages 236--251, 2001.Google ScholarGoogle Scholar
  8. S. S. Chawathe, A. Rajaraman, H. Garcia-Molina, and J. Widom. Change detection in hierarchically structured information. In SIGMOD '96: Proceedings of the 1996 ACM SIGMOD international conference on Management of data, pages 493--504, New York, NY, USA, 1996. ACM. Google ScholarGoogle Scholar
  9. 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, Washington, DC, USA, 1996. IEEE Computer Society. Google ScholarGoogle Scholar
  10. J. Cordy. The TXL source transformation language. Science of Computer Programming, 61(3):190--210, August 2006. Google ScholarGoogle Scholar
  11. M. Cortés, M. Fontoura, and C. Lucena. Using refactoring and unification rules to assist framework evolution. SIGSOFT Softw. Eng. Notes, 28(6):1--5, 2003. Google ScholarGoogle Scholar
  12. M. Cortés, M. Fontoura, and C. Lucena. A Rule-based Approach to Framework Evolution. Journal of Object Technology (JOT), 5(1), jan-feb 2006.Google ScholarGoogle Scholar
  13. R. Cottrell, J. J. C. Chang, R. J. Walker, and J. Denzinger. Determining detailed structural correspondence for generalization tasks. In ESEC-FSE '07: Proceedings of the the 6th ACM SIGSOFT Symposium on the Foundations of Software Engineering, pages 165--174, New York, NY, USA, 2007. ACM. Google ScholarGoogle Scholar
  14. I. Şavga and M. Rudolf. Refactoring-based support for binary compatibility in evolving frameworks. In GPCE '07: Proceedings of the 6th International Conference on Generative Programming and Component Engineering, pages 175--184, New York, NY, USA, 2007. ACM. Google ScholarGoogle Scholar
  15. L. DeMichiel and M. Keith. JSR 220: Enterprise JavaBeans 3.0, 2008. http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html.Google ScholarGoogle Scholar
  16. D. Dig, C. Comertoglu, D. Marinov, and R. Johnson. Automated detection of refactorings in evolving components. In ECOOP, pages 404--428, 2006. Google ScholarGoogle Scholar
  17. 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, Washington, DC, USA, 2007. IEEE Computer Society. Google ScholarGoogle Scholar
  18. D. Dig, S. Negara, V. Mohindra, and R. Johnson. ReBA: refactoring-aware binary adaptation of evolving libraries. In ICSE '08: Proceedings of the 30th international conference on Software engineering, pages 441--450, New York, NY, USA, 2008. ACM. Google ScholarGoogle Scholar
  19. M. Dmitriev. Language-specific make technology for the Java programming language. SIGPLAN Not., 37(11):373--385, 2002. Google ScholarGoogle Scholar
  20. Eclipse Foundation. Eclipse Java development tools, March 2008. http://www.eclipse.org/jdt.Google ScholarGoogle Scholar
  21. B. Fluri, M.Wuersch, M. Pinzger, and H. Gall. Change distilling: Tree differencing for fine-grained source code change extraction. IEEE Trans. Softw. Eng., 33(11):725--743, 2007. Google ScholarGoogle Scholar
  22. T. Genssler and V. Kuttruff. Source-to-source transformation in the large. In Modular Programming Languages, pages 254--265. Springer-Verlag, 2003.Google ScholarGoogle Scholar
  23. 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, New York, NY, USA, 2005. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. M. Kim, D. Notkin, and D. Grossman. Automatic inference of structural changes for matching across program versions. In The 29th International Conference on Software Engineering (ICSE'07), pages 333--343, 2007. Google ScholarGoogle Scholar
  25. H. Lieberman. Your Wish is My Command: Programming By Example. Morgan Kaufmann, 2001.Google ScholarGoogle Scholar
  26. Y. Lin, J. Gray, and F. Jouault. DSMDiff: A differentiation tool for domain-specific models. European Journal of Information Systems, 16:349--361, 2007.Google ScholarGoogle Scholar
  27. D. Panda, D. Clarke, and M. Schincariol. EJB 3.0 migration. Technical report, Oracle, October 2005.Google ScholarGoogle Scholar
  28. R. Pawlak, C. Noguera, and N. Petitprez. Spoon: Program analysis and transformation in Java. Technical report, INRIA Research Report, 2006.Google ScholarGoogle Scholar
  29. J. H. Perkins. Automatically generating refactorings to support API evolution. In PASTE '05: Proceedings of the 6th ACM SIGPLAN-SIGSOFT Workshop on Program Analysis for Software Tools and Engineering, pages 111--114, New York, NY, USA, 2005. ACM. Google ScholarGoogle Scholar
  30. M. Proctor, M. Neale, P. Lin, and M. Frandsen. Drools Documentation. Technical report, JBoss Inc., 2006.Google ScholarGoogle Scholar
  31. C. Richardson. Untangling enterprise Java. Queue, 4(5):36--44, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. D. Roberts and J. Brant. Tools for making impossible changes - experiences with a tool for transforming large Smalltalk programs. Software, IEE Proceedings-, 151(2):49--56, 2004. 1462--5970.Google ScholarGoogle Scholar
  33. S. Roock and A. Havenstein. Refactoring tags for automatic refactoring of framework dependent applications. In Proc. Int'l Conf. eXtreme Programming and Flexible Processes in Software Engineering (XP), 2002.Google ScholarGoogle Scholar
  34. C. Russell. Java Data Objects 2.1, June 2007. http://db.apache.org/jdo/specifications.html.Google ScholarGoogle Scholar
  35. M. Shonle, W. G. Griswold, and S. Lerner. Beyond refactoring: a framework for modular maintenance of crosscutting design idioms. In ESEC-FSE '07: Proceedings of the the 6th ACM SIGSOFT Symposium on the Foundations of Software Engineering, pages 175--184, 2007. Google ScholarGoogle Scholar
  36. R. Stuckert. JUnit reloaded, December 2006. http://today.java.net/pub/a/today/2006/12/07/junit-reloaded.html.Google ScholarGoogle Scholar
  37. K. Taneja, D. Dig, and T. Xie. Automated detection of API refactorings in libraries. In ASE '07: Proceedings of the 22nd IEEE/ACM International Conference on Automated Software Engineering. IEEE Computer Society, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. W. Tansey and E. Tilevich. Refactoring object-oriented applications for metadata-based frameworks. Technical report, Virginia Tech, January 2008.Google ScholarGoogle Scholar
  39. T. Tourwé and T. Mens. Automated support for framework-based software evolution. In ICSM '03: Proceedings of the International Conference on Software Maintenance, page 148, Washington, DC, USA, 2003. IEEE Computer Society. Google ScholarGoogle Scholar
  40. D. Vines and K. Sutter. Migrating legacy Hibernate applications to OpenJPA and EJB 3.0, August 2007. http://www.ibm.com/developerworks/websphere/techjournal/0708_vines/0708_vines.html.Google ScholarGoogle Scholar
  41. E. Visser. A survey of strategies in program transformation systems. Electronic Notes in Theoretical Computer Science, 57, 2001.Google ScholarGoogle Scholar
  42. E. Visser. Program transformation with Stratego/XT: Rules, strategies, tools, and systems in StrategoXT-0.9. In Domain-Specific Program Generation, volume 3016 of Lecture Notes in Computer Science, pages 216--238. Spinger-Verlag, June 2004.Google ScholarGoogle Scholar
  43. 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, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Z. Xing and E. Stroulia. API-evolution support with Diff-CatchUp. IEEE Trans. Softw. Eng., 33(12):818--836, 2007. Google ScholarGoogle Scholar
  45. Z. Xing and E. Stroulia. Differencing logical UML models. Automated Software Engineering, 14(2):215--259, 2007. Google ScholarGoogle Scholar

Index Terms

  1. Annotation refactoring: inferring upgrade transformations for legacy applications

          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

          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!