The Community for Technology Leaders
RSS Icon
Issue No.06 - Nov.-Dec. (2012 vol.38)
pp: 1233-1257
Max Schäfer , IBM T.J. Watson Research Center, Hawthorne
Andreas Thies , Fernuniversität in Hagen, Hagen
Friedrich Steimann , Fernuniversität in Hagen, Hagen
Frank Tip , IBM, Hawthorne
Automated tool support for refactoring is now widely available for mainstream programming languages such as Java. However, current refactoring tools are still quite fragile in practice and often fail to preserve program behavior or compilability. This is mainly because analyzing and transforming source code requires consideration of many language features that complicate program analysis, in particular intricate name lookup and access control rules. This paper introduces J_L, a lookup-free, access control-free representation of Java programs. We present algorithms for translating Java programs into J_L and vice versa, thereby making it possible to formulate refactorings entirely at the level of J_L and to rely on the translations to take care of naming and accessibility issues. We demonstrate how complex refactorings become more robust and powerful when lifted to J_L. Our approach has been implemented using the JastAddJ compiler framework, and evaluated by systematically performing two commonly used refactorings on an extensive suite of real-world Java applications. The evaluation shows that our tool correctly handles many cases where current refactoring tools fail to handle the complex rules for name binding and accessibility in Java.
Java, Access control, Feature extraction, Reverse engineering, Object oriented programming, Shadow mapping, Program processors, Java, Restructuring, reverse engineering, and reengineering, object-oriented languages
Max Schäfer, Andreas Thies, Friedrich Steimann, Frank Tip, "A Comprehensive Approach to Naming and Accessibility in Refactoring Java Programs", IEEE Transactions on Software Engineering, vol.38, no. 6, pp. 1233-1257, Nov.-Dec. 2012, doi:10.1109/TSE.2012.13
[1] M. Fowler, Refactoring: Improving the Design of Existing Code. Addison Wesley, 1999.
[2] T. Mens and T. Tourwé, "A Survey of Software Refactoring," IEEE Trans. Software Eng., vol. 30, no. 2, pp. 126-139, Feb. 2004.
[3] M. Schäfer, T. Ekman, R. Ettinger, and M. Verbaere, "Refactoring Bugs," , 2011.
[4] E. Foundation, "Eclipse 3.6 JDT," http://www.eclipse.orgjdt, 2011.
[5] JetBrains, "IntelliJ IDEA 10.5," http://www.jetbrains.comidea, 2011.
[6] M. Schäfer, T. Ekman, and A. Thies, "JRRT—JastAdd Refactoring Tools,", 2011.
[7] T. Ekman and G. Hedin, "The JastAdd Extensible Java Compiler," Proc. 22nd Ann. ACM SIGPLAN Conf. Object-Oriented Programming Systems and Applications, pp. 1-18, 2007.
[8] M. Schäfer and O. de Moor, "Specifying and Implementing Refactorings," Proc. ACM Int'l Conf. Object-Oriented Programming Systems and Applications, M. Rinard, ed., 2010.
[9] E. Bodden, A. Sewe, J. Sinschek, H. Oueslati, and M. Mezini, "Taming Reflection: Aiding Static Analysis in the Presence of Reflection and Custom Class Loaders," Proc. Int'l Conf. Software Eng., pp. 241-250, May 2011.
[10] J. Gosling, B. Joy, G. Steele, and G. Bracha, The Java Language Specification, third ed. Addison Wesley, 2005.
[11] F. Tip, A. Kieżun, and D. Bäumer, "Refactoring for Generalization Using Type Constraints," Proc. 18th Ann. ACM SIGPLAN Conf. Object-Oriented Programming Systems and Applications, pp. 13-26, 2003.
[12] F. Tip, R.M. Fuhrer, A. Kieżun, M.D. Ernst, I. Balaban, and B. De Sutter, "Refactoring Using Type Constraints," ACM Trans. Programming Languages and Systems, vol. 33, no. 3, p. 9, 2011.
[13] T. Ekman and G. Hedin, "Modular Name Analysis for Java Using JastAdd," Proc. Int'l Conf. Generative and Transformational Techniques in Software Eng.. pp. 422-436, 2006.
[14] T. Ekman and G. Hedin, "The JastAdd System—Modular Extensible Compiler Construction," Science of Computer Programming, vol. 69, nos. 1-3, pp. 14-26, 2007.
[15] F. Steimann, "The Infer Type Refactoring and Its Use for Interface-Based Programming," J. Object Technology, vol. 6, no. 2, pp. 99-120, 2007.
[16] H. Kegel and F. Steimann, "Systematically Refactoring Inheritance to Delegation in Java," Proc. ACM/IEEE 30th Int'l Conf. Software Eng., pp. 431-440, 2008.
[17] F. Steimann and A. Thies, "From Public to Private to Absent: Refactoring Java Programs under Constrained Accessibility," Proc. European Conf. Object-Oriented Programming, S. Drossopoulou, ed., pp. 419-443, 2009.
[18] F. Steimann, C. Kollee, and J.von Pilgrim, "A Refactoring Constraint Language and Its Application," Proc. European Conf. Object-Oriented Programming, 2011.
[19] F. Steimann, "Constraint-Based Model Refactoring," Proc. 14th Int'l Conf. Model Driven Eng. Languages and Systems, J. Whittle, Clark, and T. Kühne, eds., 2011.
[20] D.A. Wheeler, "SLOCCount," sloccount/, 2006.
[21] N. Tamura, "Cream: Class Library for Constraint Programming in Java," 2009.
[22] N. Schirmer, "Analysing the Java Package/Access Concepts in Isabelle/HOL," Concurrency—Practice and Experience, vol. 16, no. 7, pp. 689-706, 2004.
[23] M. Fowler, "Public versus Published Interfaces," IEEE Software, vol. 19, no. 2, pp. 18-19, Mar./Apr. 2002.
[24] G. Soares, R. Gheyi, D. Serey, and T. Massoni, "Making Program Refactoring Safer," IEEE Software, vol. 27, no. 4,, pp. 52-57, July/Aug. 2010.
[25] G. Soares, R. Gheyi, and T. Massoni, "Automated Behavioral Testing of Refactoring Engines," IEEE Trans. Software Eng., doi: 10.1109/TSE.2012.19, 2012.
[26] W.G. Griswold, "Program Restructuring as an Aid to Software Maintenance," PhD thesis, Univ. Washington, 1991.
[27] W.F. Opdyke, "Refactoring Object-Oriented Frameworks," PhD thesis, Univ. Illinois at Urbana-Champaign, 1992.
[28] D.B. Roberts, "Practical Analysis for Refactoring," PhD thesis, Univ. Illinois at Urbana-Champaign, 1999.
[29] P. Borba, A. Sampaio, A. Cavalcanti, and M. Cornélio, "Algebraic Reasoning for Object-Oriented Programming," Science of Computer Programming, vol. 52, pp. 53-100, 2004.
[30] A. Garrido and J. Meseguer, "Formal Specification and Verification of Java Refactorings," Proc. IEEE Sixth Int'l Workshop Source Code Analysis and Manipulation, pp. 165-174, 2006.
[31] N. Sultana and S. Thompson, "Mechanical Verification of Refactorings," Proc. ACM SIGPLAN Symp. Partial Evaluation and Semantics-Based Program Manipulation, pp. 51-60, 2008.
[32] T. Mens, N.V. Eetvelde, S. Demeyer, and D. Janssens, "Formalizing Refactorings with Graph Transformations," J. Software Maintenance, vol. 17, no. 4, pp. 247-276, 2005.
[33] M. Schäfer, M. Verbaere, T. Ekman, and O. deMoor, "Stepping Stones over the Refactoring Rubicon—Lightweight Language Extensions to Easily Realise Refactorings," Proc. European Conf. Object-Oriented Programming, S. Drossopoulou, ed., pp. 369-393, 2009.
[34] M. Schäfer, J. Dolby, M. Sridharan, F. Tip, and E. Torlak, "Correct Refactoring of Concurrent Java Code," Proc. European Conf. Object-Oriented Programming, T. D 'Hondt, ed., 2010.
[35] M. Verbaere, R. Ettinger, and O. de Moor, "JunGL: A Scripting Language for Refactoring," Proc. Int'l Conf. Software Eng., D. Rombach and M.L. Soffa, eds., pp. 172-181, 2006.
[36] M.O. Cinnéide, "Automated Application of Design Patterns: A Refactoring Approach," PhD thesis, Univ. of Dublin, Trinity College, 2000.
[37] G. Kniesel and H. Koch, "Static Composition of Refactorings," Science of Computer Programming, vol. 52, no. 1-3, pp. 9-51, 2004.
[38] A. Donovan, A. Kieżun, M. Tschantz, and M.D. Ernst, "Converting Java Programs to Use Generic Libraries," Proc. 19th ACM SIGPLAN Conf. Object-Oriented Programming Systems and Applications, pp. 15-34, 2004.
[39] D. von Dincklage and A. Diwan, "Converting Java Classes to Use Generics," Proc. 19th ACM SIGPLAN Conf. Object-Oriented Programming Systems and Applications, pp. 1-14, 2004.
[40] R.M. Fuhrer, F. Tip, A. Kieżun, J. Dolby, and M. Keller, "Efficiently Refactoring Java Applications to Use Generic Libraries" Proc. European Conf. Object-Oriented Programming, 2005.
[41] L. Tokuda and D. Batory, "Evolving Object-Oriented Designs with Refactorings," Automated Software Eng., vol. 8, no. 1, pp. 89-120, Jan. 2001.
[42] J. Kerievsky, Refactoring to Patterns. Addison Wesley, 2005.
[43] B. Daniel, D. Dig, K. Garcia, and D. Marinov, "Automated Testing of Refactoring Engines," Proc. Joint Meeting of the European Software Eng. Conf. and Symp. Foundations of Software Eng.. pp. 185-194, 2007.
42 ms
(Ver 2.0)

Marketing Automation Platform Marketing Automation Tool