Skip to main content

From Public to Private to Absent: Refactoring Java Programs under Constrained Accessibility

  • Conference paper
ECOOP 2009 – Object-Oriented Programming (ECOOP 2009)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 5653))

Included in the following conference series:

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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)

    Google Scholar 

  2. Daniel, B., Dig, D., Garcia, K., Marinov, D.: Automated testing of refactoring engines. In: Proc. of ESEC/SIGSOFT FSE, pp. 185–194 (2007)

    Google Scholar 

  3. Eclipse Java Development Tools Version 3.4.1, http://www.eclipse.org

  4. Fowler, M.: Refactoring: Improving the Design of Existing Code. Addison-Wesley, Reading (1999)

    MATH  Google Scholar 

  5. Frühwirth, T., Abdennadher, S.: Essentials of Constraint Programming. Springer, Berlin (2003)

    Book  MATH  Google Scholar 

  6. Gosling, J., Joy, B., Steele, G., Bracha, G.: The Java Language Specification, http://java.sun.com/docs/books/jls/

  7. Grothoff, C., Palsberg, J., Vitek, J.: Encapsulating objects with confined types. ACM Trans. Program. Lang. Syst. 29(6), 32 (2007)

    Article  Google Scholar 

  8. Grothoff, C.: Introducing: the Java Access Modifier Inference Tool, http://grothoff.org/christian/xtc/jamit/

  9. IntelliJ IDEA Version 8, http://www.jetbrains.com/idea/

  10. Kegel, H., Steimann, F.: Systematically refactoring inheritance to delegation in Java. In: Proc. of ICSE, pp. 431–440 (2008)

    Google Scholar 

  11. Koved, L., Pistoia, M., Kershenbaum, A.: Access rights analysis for Java. In: Proc. of OOPSLA, pp. 359–372 (2002)

    Google Scholar 

  12. Meyer, B.: Object-Oriented Software Construction, 2nd edn. Prentice Hall International, Englewood Cliffs (1997)

    MATH  Google Scholar 

  13. Microsoft C# Language Specification v1.2, http://download.microsoft.com

  14. Müller, P., Poetzsch-Heffter, A.: Kapselung und Methodenbindung: Javas Designprobleme und ihre Korrektur. In: Java-Informations-Tage, pp. 1–10 (1998)

    Google Scholar 

  15. NetBeans Integrated Development Environment Version 6.5, http://www.netbeans.org

  16. Opdyke, W.: Refactoring Object-Oriented Frameworks. Ph.D. thesis, University of Illinois at Urbana-Champaign (1992)

    Google Scholar 

  17. Parnas, D.L.: On the criteria to be used in decomposing systems into modules. Commun. ACM 15(12), 1053–1058 (1972)

    Article  Google Scholar 

  18. Schäfer, M., Ekman, T., de Moor, O.: Sound and extensible renaming for Java. In: Proc. of OOPSLA, pp. 277–294 (2008)

    Google Scholar 

  19. Schirmer, N.: Analysing the Java package/access concepts in Isabelle/HOL. Concurrency — Practice and Experience 16(7), 689–706 (2004)

    Article  Google Scholar 

  20. Tamura, N.: Cream: Class Library for Constraint Programming in Java, http://bach.istc.kobe-u.ac.jp/cream/

  21. Tip, F., Kiezun, A., Bäumer, D.: Refactoring for generalization using type constraints. In: Proc. of OOPSLA, pp. 13–26 (2003)

    Google Scholar 

  22. Tip, F.: Refactoring using type constraints. In: Riis Nielson, H., Filé, G. (eds.) SAS 2007. LNCS, vol. 4634, pp. 1–17. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics