Abstract
Type constraints express subtype-relationships between the types of program expressions that are required for type-correctness, and were originally proposed as a convenient framework for solving type checking and type inference problems. In this paper, we show 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 results.
This work has been supported in part by the Defense Advanced Research Projects Agency (DARPA) under contract No. NBCH30390004.
Access provided by Autonomous University of Puebla. Download to read the full chapter text
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Balaban, I., Tip, F., Fuhrer, R.: Refactoring support for class library migration. In: Proc. OOPSLA, pp. 265–279 (2005)
Beck, K.: Extreme Programming Explained: Embrace Change. Addison-Wesley, London, UK (2000)
De Sutter, B., Tip, F., Dolby, J.: Customization of Java library classes using type constraints and profile information. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 585–610. Springer, Heidelberg (2004)
Donovan, A., Ernst, M.: Inference of generic types in Java. Tech. Rep. MIT/LCS/TR-889, MIT (March 2003)
Donovan, A., Kieżun, A., Tschantz, M., Ernst, M.: Converting Java programs to use generic libraries. In: Proc. OOPSLA, pp. 15–34 (2004)
Duggan, D.: Modular type-based reverse engineering of parameterized types in Java code. In: Proc. OOPSLA, pp. 97–113 (1999)
Fowler, M.: Refactoring. In: Improving the Design of Existing Code, Addison-Wesley, London, UK (1999)
Fuhrer, R., Tip, F., Kieżun, A., Dolby, J., Keller, M.: Efficiently refactoring Java applications to use generic libraries. In: Black, A.P. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 71–96. Springer, Heidelberg (2005)
Griswold, W.G.: Program Restructuring as an Aid to Software Maintenance. PhD thesis, University of Washington, Technical Report 91-08-04 (1991)
Griswold, W.G., Notkin, D.: Automated assistance for program restructuring. ACM Trans. Softw. Eng. Methodol. 2(3), 228–269 (1993)
Halloran, T.J., Scherlis, W.L.: 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 (September 2002)
Kerievsky, J.: Refactoring to Patterns. Addison-Wesley, Reading (2004)
Kieżun, A., Ernst, M., Tip, F., Fuhrer, R.: Refactoring for parameterizing Java classes. In: Proc. ICSE, pp. 437–446 (2007)
Mens, T., Tourwé, T.: A survey of software refactoring. IEEE Trans. on Softw. Eng. 30(2), 126–139 (2004)
Opdyke, W.F.: Refactoring Object-Oriented Frameworks. PhD thesis, University Of Illinois at Urbana-Champaign (1992)
Opdyke, W.F., Johnson, R.E.: Creating abstract superclasses by refactoring. In: CSC 1993. The ACM 1993 Computer Science Conf., February 1993, pp. 66–73 (1993)
Palsberg, J., Schwartzbach, M.: Object-Oriented Type Systems. John Wiley & Sons, West Sussex, England (1993)
Snelting, G., Tip, F.: Understanding class hierarchies using concept analysis. In: ACM Trans. on Programming Languages and Systems, May 2000, pp. 540–582 (2000)
Steimann, F., Mayer, P.: Type access analysis: Towards informed interface design. In: Proc. TOOLS Europe (to appear, 2007)
Steimann, F., Mayer, P., Meißner, A.: Decoupling classes with inferred interfaces. In: Preneel, B., Tavares, S. (eds.) SAC 2005. LNCS, vol. 3897, pp. 1404–1408. Springer, Heidelberg (2006)
Streckenbach, M., Snelting, G.: Refactoring class hierarchies with KABA. In: Proc. OOPSLA, pp. 315–330 (2004)
Tip, F., Kieżun, A., Bäumer, D.: Refactoring for generalization using type constraints. In: Proc. OOPSLA, pp. 13–26 (2003)
Tokuda, L., Batory, D.: Evolving object-oriented designs with refactorings. Kluwer Journal of Automated Software Engineering, 89–120 (August 2001)
Torgersen, M., Plesner Hansen, C., Ernst, E., von der Ahé, P., Bracha, G., Gafter, N.: Adding wildcards to the Java programming language. In: Proc. of the 2004 ACM symposium on Applied computing, pp. 1289–1296 (2004)
von Dincklage, D., Diwan, A.: Converting Java classes to use generics. In: Proc. OOPSLA, pp. 1–14 (2004)
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2007 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Tip, F. (2007). Refactoring Using Type Constraints. In: Nielson, H.R., Filé, G. (eds) Static Analysis. SAS 2007. Lecture Notes in Computer Science, vol 4634. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-74061-2_1
Download citation
DOI: https://doi.org/10.1007/978-3-540-74061-2_1
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-74060-5
Online ISBN: 978-3-540-74061-2
eBook Packages: Computer ScienceComputer Science (R0)