skip to main content
research-article
Free Access

Refactoring using type constraints

Authors Info & Claims
Published:04 May 2011Publication History
Skip Abstract Section

Abstract

Type constraints express subtype relationships between the types of program expressions, for example, those relationships that are required for type correctness. Type constraints were originally proposed as a convenient framework for solving type checking and type inference problems. This paper shows how type constraints can be used as the basis for practical refactoring tools. In our approach, a set of type constraints is derived from a type-correct program P. The main insight behind our work is the fact that P constitutes just one solution to this constraint system, and that alternative solutions may exist that correspond to refactored versions of P. We show how a number of refactorings for manipulating types and class hierarchies can be expressed naturally using type constraints. Several refactorings in the standard distribution of Eclipse are based on our work.

References

  1. Balaban, I., Tip, F., and Fuhrer, R. 2005. Refactoring support for class library migration. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Application (OOPSLA). 265--279. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Beck, K. 2000. Extreme Programming Explained: Embrace Change. Addison-Wesley. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Bracha, G., Cohen, N., Kemper, C., Odersky, M., Stoutamire, D., Thorup, K., and Wadler, P. 2004. Adding generics to the Java programming language, final release. Tech. rep., Java Community Process JSR-000014.Google ScholarGoogle Scholar
  4. Choi, J.-D., Gupta, M., Serrano, M., Sreedhar, V. C., and Midkiff, S. 1999. Escape analysis for Java. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Application (OOPSLA). ACM Press, 1--19. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. De Sutter, B., Tip, F., and Dolby, J. 2004. Customization of Java library classes using type constraints and profile information. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP). 585--610.Google ScholarGoogle Scholar
  6. Donovan, A. and Ernst, M. 2003. Inference of generic types in Java. Tech. rep. MIT/LCS/TR-889, MIT.Google ScholarGoogle Scholar
  7. Donovan, A., Kieżun, A., Tschantz, M., and Ernst, M. 2004. Converting Java programs to use generic libraries. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Application (OOPSLA). 15--34. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Duggan, D. 1999. Modular type-based reverse engineering of parameterized types in Java code. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Application (OOPSLA). 97--113. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Fowler, M. 1999. Refactoring. Improving the Design of Existing Code. Addison-Wesley. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Fuhrer, R., Tip, F., Kieżun, A., Dolby, J., and Keller, M. 2005. Efficiently refactoring Java applications to use generic libraries. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP). 71--96. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Gosling, J., Joy, B., Steele, G., and Bracha, G. 2005. The Java Language Specification 3rd Ed. Addison Wesley, Boston, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Griswold, W. G. 1991. Program restructuring as an aid to software maintenance. Ph.D. thesis, University of Washington. Tech. rep. 91-08-04. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Griswold, W. G. and Notkin, D. 1993. Automated assistance for program restructuring. ACM Trans. Softw. Engin. Methodol. 2, 3, 228--269. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Halloran, T. J. and Scherlis, W. L. 2002. Models of Thumb: Assuring best practice source code in large Java software systems. Tech. rep. Fluid Project, School of Computer Science/ISRI, Carnegie Mellon University.Google ScholarGoogle Scholar
  15. Hind, M. and Pioli, A. 2001. Evaluating the effectiveness of pointer alias analyses. Sci. of Comput. Program. 39, 1, 31--55. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Kerievsky, J. 2004. Refactoring to Patterns. Addison-Wesley. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Kieżun, A., Ernst, M., Tip, F., and Fuhrer, R. 2007. Refactoring for parameterizing Java classes. In Proceedings of the International Conference on Software Engineering (ICSE). 437--446. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Kieżun, A., Ernst, M. D., Tip, F., and Fuhrer, R. M. 2006. Refactoring for parameterizing Java classes. Tech. rep., MIT.Google ScholarGoogle Scholar
  19. Mens, T. and Tourwé, T. 2004. A survey of software refactoring. IEEE Trans. Softw. 30, 2, 126--139. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Opdyke, W. F. 1992. Refactoring object-oriented frameworks. Ph.D. thesis, University Of Illinois at Urbana-Champaign. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Opdyke, W. F. and Johnson, R. E. 1993. Creating abstract superclasses by refactoring. In Proceedings of the ACM Computer Science Conference (CSC'93). 66--73. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Palsberg, J. and Schwartzbach, M. 1993. Object-Oriented Type Systems. John Wiley & Sons. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Ryder, B. G. 2003. Dimensions of precision in reference analysis of object-oriented programming languages. In Proceedings of the International Conference on Compiler Construction (CC). 126--137. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Snelting, G. and Tip, F. 2000. Understanding class hierarchies using concept analysis. ACM Trans. Program. Lang. Syst. 22, 3, 540--582. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Steimann, F. and Mayer, P. 2007. Type access analysis: Towards informed interface design. In Proceedings of the TOOLS Europe.Google ScholarGoogle Scholar
  26. Steimann, F., Mayer, P., and Meissner, A. 2006. Decoupling classes with inferred interfaces. In Proceedings of the ACM Symposium on Applied Computing (SAC). 1404--1408. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Steimann, F. and Thies, A. 2009. From public to private to absent: Refactoring Java programs under constrained accessibility. In Proceedings of the 23rd European Conference on Object-Oriented Programming (ECOOP). 419--443. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Streckenbach, M. and Snelting, G. 2004. Refactoring class hierarchies with KABA. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Application (OOPSLA). 315--330. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Tip, F. 2007. Refactoring using type constraints. In Proceedings of the 14th International Static Analysis Symposium (SAS). 1--17. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Tip, F., Kieżun, A., and Bäumer, D. 2003. Refactoring for generalization using type constraints. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Application (OOPSLA). 13--26. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Tokuda, L. and Batory, D. 2001. Evolving object-oriented designs with refactorings. Kluwer J. Automat. Softw. Eng. 8, 1, 89--120. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Torgersen, M., Plesner Hansen, C., Ernst, E., von der Ahé, P., Bracha, G., and Gafter, N. 2004. Adding wildcards to the Java programming language. In Proceedings of the ACM Symposium on Applied Computing. 1289--1296. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. von Dincklage, D. and Diwan, A. 2004. Converting Java classes to use generics. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Application (OOPSLA). 1--14. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Refactoring using type constraints

            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

            • Published in

              cover image ACM Transactions on Programming Languages and Systems
              ACM Transactions on Programming Languages and Systems  Volume 33, Issue 3
              April 2011
              119 pages
              ISSN:0164-0925
              EISSN:1558-4593
              DOI:10.1145/1961204
              Issue’s Table of Contents

              Copyright © 2011 ACM

              Publisher

              Association for Computing Machinery

              New York, NY, United States

              Publication History

              • Published: 4 May 2011
              • Accepted: 1 July 2010
              • Revised: 1 December 2009
              • Received: 1 June 2009
              Published in toplas Volume 33, Issue 3

              Permissions

              Request permissions about this article.

              Request Permissions

              Check for updates

              Qualifiers

              • research-article
              • Research
              • Refereed

            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!