Nothing Special   »   [go: up one dir, main page]

skip to main content
research-article
Open access

Refactoring using type constraints

Published: 04 May 2011 Publication History

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.
[2]
Beck, K. 2000. Extreme Programming Explained: Embrace Change. Addison-Wesley.
[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.
[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.
[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.
[6]
Donovan, A. and Ernst, M. 2003. Inference of generic types in Java. Tech. rep. MIT/LCS/TR-889, MIT.
[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.
[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.
[9]
Fowler, M. 1999. Refactoring. Improving the Design of Existing Code. Addison-Wesley.
[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.
[11]
Gosling, J., Joy, B., Steele, G., and Bracha, G. 2005. The Java Language Specification 3rd Ed. Addison Wesley, Boston, MA.
[12]
Griswold, W. G. 1991. Program restructuring as an aid to software maintenance. Ph.D. thesis, University of Washington. Tech. rep. 91-08-04.
[13]
Griswold, W. G. and Notkin, D. 1993. Automated assistance for program restructuring. ACM Trans. Softw. Engin. Methodol. 2, 3, 228--269.
[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.
[15]
Hind, M. and Pioli, A. 2001. Evaluating the effectiveness of pointer alias analyses. Sci. of Comput. Program. 39, 1, 31--55.
[16]
Kerievsky, J. 2004. Refactoring to Patterns. Addison-Wesley.
[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.
[18]
Kieżun, A., Ernst, M. D., Tip, F., and Fuhrer, R. M. 2006. Refactoring for parameterizing Java classes. Tech. rep., MIT.
[19]
Mens, T. and Tourwé, T. 2004. A survey of software refactoring. IEEE Trans. Softw. 30, 2, 126--139.
[20]
Opdyke, W. F. 1992. Refactoring object-oriented frameworks. Ph.D. thesis, University Of Illinois at Urbana-Champaign.
[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.
[22]
Palsberg, J. and Schwartzbach, M. 1993. Object-Oriented Type Systems. John Wiley & Sons.
[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.
[24]
Snelting, G. and Tip, F. 2000. Understanding class hierarchies using concept analysis. ACM Trans. Program. Lang. Syst. 22, 3, 540--582.
[25]
Steimann, F. and Mayer, P. 2007. Type access analysis: Towards informed interface design. In Proceedings of the TOOLS Europe.
[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.
[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.
[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.
[29]
Tip, F. 2007. Refactoring using type constraints. In Proceedings of the 14th International Static Analysis Symposium (SAS). 1--17.
[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.
[31]
Tokuda, L. and Batory, D. 2001. Evolving object-oriented designs with refactorings. Kluwer J. Automat. Softw. Eng. 8, 1, 89--120.
[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.
[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.

Cited By

View all
  • (2024)Semantic Code Refactoring for Abstract Data TypesProceedings of the ACM on Programming Languages10.1145/36328708:POPL(816-847)Online publication date: 5-Jan-2024
  • (2024)Generic Sensitivity: Generics-Guided Context Sensitivity for Pointer AnalysisIEEE Transactions on Software Engineering10.1109/TSE.2024.337764550:5(1144-1162)Online publication date: 12-Apr-2024
  • (2023)An Automated Approach to Extracting Local VariablesProceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering10.1145/3611643.3616261(313-325)Online publication date: 30-Nov-2023
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

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
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 04 May 2011
Accepted: 01 July 2010
Revised: 01 December 2009
Received: 01 June 2009
Published in TOPLAS Volume 33, Issue 3

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Refactoring
  2. program transformation
  3. type constraints

Qualifiers

  • Research-article
  • Research
  • Refereed

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)85
  • Downloads (Last 6 weeks)22
Reflects downloads up to 04 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Semantic Code Refactoring for Abstract Data TypesProceedings of the ACM on Programming Languages10.1145/36328708:POPL(816-847)Online publication date: 5-Jan-2024
  • (2024)Generic Sensitivity: Generics-Guided Context Sensitivity for Pointer AnalysisIEEE Transactions on Software Engineering10.1109/TSE.2024.337764550:5(1144-1162)Online publication date: 12-Apr-2024
  • (2023)An Automated Approach to Extracting Local VariablesProceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering10.1145/3611643.3616261(313-325)Online publication date: 30-Nov-2023
  • (2023)Verifying Well-Typedness Preservation of Refactorings using Scope GraphsProceedings of the 25th ACM International Workshop on Formal Techniques for Java-like Programs10.1145/3605156.3606455(44-50)Online publication date: 18-Jul-2023
  • (2022)Synthesis-powered optimization of smart contracts via data type refactoringProceedings of the ACM on Programming Languages10.1145/35633086:OOPSLA2(560-588)Online publication date: 31-Oct-2022
  • (2022)Generic sensitivity: customizing context-sensitive pointer analysis for genericsProceedings of the 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering10.1145/3540250.3549122(1110-1121)Online publication date: 7-Nov-2022
  • (2022)Flexible semi-automatic support for type migration of primitives for C/C++ programs2022 IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER)10.1109/SANER53432.2022.00106(878-889)Online publication date: Mar-2022
  • (2022)On preserving the behavior in software refactoringInformation and Software Technology10.1016/j.infsof.2021.106675140:COnline publication date: 22-Apr-2022
  • (2022)Large‐scale semi‐automated migration of legacy C/C++ test codeSoftware: Practice and Experience10.1002/spe.308252:7(1543-1580)Online publication date: 22-Mar-2022
  • (2021)Understanding Software-2.0ACM Transactions on Software Engineering and Methodology10.1145/345347830:4(1-42)Online publication date: 23-Jul-2021
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Full Access

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media