Abstract
Contemporary refactoring tools for Java aiding in the restructuring of programs have problems with respecting access modifiers such as public and private: while some tools provide hints that referenced elements may become inaccessible due to the intended restructuring, none we have tested prevent changes that alter the meaning of a program, and none take steps that counteract such alterations. To address these problems, we formalize accessibility in Java as a set of constraint rules, and show how the constraints obtained from applying these rules to a program and an intended refactoring allow us to check the preconditions of the refactoring, as well as to compute the changes of access modifiers necessary to preserve the behaviour of the refactored program. We have implemented our framework as a proof of concept in Eclipse, and demonstrated how it improves applicability and success of an important refactoring in a number of sample programs. That our approach is not limited to Java is shown by comparison with the constraint rules for C# and Eiffel.
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
Bouillon, P., Großkinsky, E., Steimann, F.: Controlling accessibility in agile projects with the Access Modifier Modifier. In: Proc. of TOOLS, vol. 46, pp. 41–59 (2008)
Daniel, B., Dig, D., Garcia, K., Marinov, D.: Automated testing of refactoring engines. In: Proc. of ESEC/SIGSOFT FSE, pp. 185–194 (2007)
Eclipse Java Development Tools Version 3.4.1, http://www.eclipse.org
Fowler, M.: Refactoring: Improving the Design of Existing Code. Addison-Wesley, Reading (1999)
Frühwirth, T., Abdennadher, S.: Essentials of Constraint Programming. Springer, Berlin (2003)
Gosling, J., Joy, B., Steele, G., Bracha, G.: The Java Language Specification, http://java.sun.com/docs/books/jls/
Grothoff, C., Palsberg, J., Vitek, J.: Encapsulating objects with confined types. ACM Trans. Program. Lang. Syst. 29(6), 32 (2007)
Grothoff, C.: Introducing: the Java Access Modifier Inference Tool, http://grothoff.org/christian/xtc/jamit/
IntelliJ IDEA Version 8, http://www.jetbrains.com/idea/
Kegel, H., Steimann, F.: Systematically refactoring inheritance to delegation in Java. In: Proc. of ICSE, pp. 431–440 (2008)
Koved, L., Pistoia, M., Kershenbaum, A.: Access rights analysis for Java. In: Proc. of OOPSLA, pp. 359–372 (2002)
Meyer, B.: Object-Oriented Software Construction, 2nd edn. Prentice Hall International, Englewood Cliffs (1997)
Microsoft C# Language Specification v1.2, http://download.microsoft.com
Müller, P., Poetzsch-Heffter, A.: Kapselung und Methodenbindung: Javas Designprobleme und ihre Korrektur. In: Java-Informations-Tage, pp. 1–10 (1998)
NetBeans Integrated Development Environment Version 6.5, http://www.netbeans.org
Opdyke, W.: Refactoring Object-Oriented Frameworks. Ph.D. thesis, University of Illinois at Urbana-Champaign (1992)
Parnas, D.L.: On the criteria to be used in decomposing systems into modules. Commun. ACM 15(12), 1053–1058 (1972)
Schäfer, M., Ekman, T., de Moor, O.: Sound and extensible renaming for Java. In: Proc. of OOPSLA, pp. 277–294 (2008)
Schirmer, N.: Analysing the Java package/access concepts in Isabelle/HOL. Concurrency — Practice and Experience 16(7), 689–706 (2004)
Tamura, N.: Cream: Class Library for Constraint Programming in Java, http://bach.istc.kobe-u.ac.jp/cream/
Tip, F., Kiezun, A., Bäumer, D.: Refactoring for generalization using type constraints. In: Proc. of OOPSLA, pp. 13–26 (2003)
Tip, F.: Refactoring using type constraints. In: Riis Nielson, H., Filé, G. (eds.) SAS 2007. LNCS, vol. 4634, pp. 1–17. Springer, Heidelberg (2007)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2009 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Steimann, F., Thies, A. (2009). From Public to Private to Absent: Refactoring Java Programs under Constrained Accessibility. In: Drossopoulou, S. (eds) ECOOP 2009 – Object-Oriented Programming. ECOOP 2009. Lecture Notes in Computer Science, vol 5653. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-03013-0_19
Download citation
DOI: https://doi.org/10.1007/978-3-642-03013-0_19
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-03012-3
Online ISBN: 978-3-642-03013-0
eBook Packages: Computer ScienceComputer Science (R0)