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.
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- K. Beck and E. Gamma. Test Infected: Programmers love writing tests. Java Report, 3(7):37--50, 1998.Google Scholar
- C. Beust and H. Suleiman. Next Generation Java Testing: TestNG and Advanced Concepts. Addison-Wesley Professional, 2007. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- F. Castor and P. Borba. A language for specifying Java transformations. In V Brazilian Symposium on Programming Languages, pages 236--251, 2001.Google Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- J. Cordy. The TXL source transformation language. Science of Computer Programming, 61(3):190--210, August 2006. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- L. DeMichiel and M. Keith. JSR 220: Enterprise JavaBeans 3.0, 2008. http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html.Google Scholar
- D. Dig, C. Comertoglu, D. Marinov, and R. Johnson. Automated detection of refactorings in evolving components. In ECOOP, pages 404--428, 2006. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- M. Dmitriev. Language-specific make technology for the Java programming language. SIGPLAN Not., 37(11):373--385, 2002. Google ScholarDigital Library
- Eclipse Foundation. Eclipse Java development tools, March 2008. http://www.eclipse.org/jdt.Google Scholar
- 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 ScholarDigital Library
- T. Genssler and V. Kuttruff. Source-to-source transformation in the large. In Modular Programming Languages, pages 254--265. Springer-Verlag, 2003.Google ScholarCross Ref
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- H. Lieberman. Your Wish is My Command: Programming By Example. Morgan Kaufmann, 2001.Google ScholarDigital Library
- 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 ScholarCross Ref
- D. Panda, D. Clarke, and M. Schincariol. EJB 3.0 migration. Technical report, Oracle, October 2005.Google Scholar
- R. Pawlak, C. Noguera, and N. Petitprez. Spoon: Program analysis and transformation in Java. Technical report, INRIA Research Report, 2006.Google Scholar
- 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 ScholarDigital Library
- M. Proctor, M. Neale, P. Lin, and M. Frandsen. Drools Documentation. Technical report, JBoss Inc., 2006.Google Scholar
- C. Richardson. Untangling enterprise Java. Queue, 4(5):36--44, 2006. Google ScholarDigital Library
- 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 ScholarCross Ref
- 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 Scholar
- C. Russell. Java Data Objects 2.1, June 2007. http://db.apache.org/jdo/specifications.html.Google Scholar
- 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 ScholarDigital Library
- R. Stuckert. JUnit reloaded, December 2006. http://today.java.net/pub/a/today/2006/12/07/junit-reloaded.html.Google Scholar
- 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 ScholarDigital Library
- W. Tansey and E. Tilevich. Refactoring object-oriented applications for metadata-based frameworks. Technical report, Virginia Tech, January 2008.Google Scholar
- 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 ScholarDigital Library
- 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 Scholar
- E. Visser. A survey of strategies in program transformation systems. Electronic Notes in Theoretical Computer Science, 57, 2001.Google Scholar
- 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 ScholarCross Ref
- 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 ScholarDigital Library
- Z. Xing and E. Stroulia. API-evolution support with Diff-CatchUp. IEEE Trans. Softw. Eng., 33(12):818--836, 2007. Google ScholarDigital Library
- Z. Xing and E. Stroulia. Differencing logical UML models. Automated Software Engineering, 14(2):215--259, 2007. Google ScholarDigital Library
Index Terms
- Annotation refactoring: inferring upgrade transformations for legacy applications
Recommendations
Annotation refactoring: inferring upgrade transformations for legacy applications
OOPSLA '08: Proceedings of the 23rd ACM SIGPLAN conference on Object-oriented programming systems languages and applicationsSince 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 ...
Trailblazer: a tool for automated annotation refactoring
OOPSLA '09: Proceedings of the 24th ACM SIGPLAN conference companion on Object oriented programming systems languages and applicationsSince annotations were added to the Java language, many enterprise frameworks have been transitioning to using annotated Plain Old Java Objects (POJOs) in their latest releases. Our automated refactoring tool, Trailblazer, alleviates the maintenance ...
Cross language refactoring for Eclipse plug-ins
WRT '08: Proceedings of the 2nd Workshop on Refactoring ToolsThis article presents our research on how a cross-language refactoring could be implemented in an Eclipse Plugin.
A non-Java language running on the Java virtual machine JVM interacts with Java code. Refactorings in either language might break the code ...
Comments