Skip to main content

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 9952))

Included in the following conference series:

Abstract

Refactorings often require semantic correctness conditions that amount to software model checking. However, IDEs such as Eclipse’s Java Development Tools implement far simpler checks on the structure of the code. This leads to the phenomenon that a seemingly innocuous refactoring can change the behaviour of the program. In this paper we demonstrate our technique of introducing runtime checks for two particular refactorings for the Java programming language: Extract And Move Method, and Extract Local Variable. These checks can, in combination with unit tests, detect changed behaviour and allow identification of which specific refactoring step introduced the deviant behaviour.

This article is based upon work from COST Action ARVI IC1402, supported by COST (European Cooperation in Science and Technology).

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 EPUB and 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

References

  1. Ahrendt, W., Beckert, B., Hähnle, R., Schmitt, P.H.: KeY: a formal method for object-oriented systems. In: Bonsangue, M.M., Johnsen, E.B. (eds.) FMOODS 2007. LNCS, vol. 4468, pp. 32–43. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  2. Cinnéide, M.Ó., Nixon, P.: A methodology for the automated introduction of design patterns. In: International Conference on Software Maintenance, ICSM 1999, pp. 463–472. IEEE Computer Society (1999)

    Google Scholar 

  3. Eilertsen, A.M.: Making software refactoring safer. Master’s thesis, Department of Informatics, University of Bergen (2016)

    Google Scholar 

  4. Ekman, T., Hedin, G.: The JastAdd system - modular extensible compiler construction. Sci. Comput. Program. 69(1–3), 14–26 (2007)

    Article  MathSciNet  MATH  Google Scholar 

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

    MATH  Google Scholar 

  6. Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Boston (1994)

    MATH  Google Scholar 

  7. Hofmann, M., Pavlova, M.: Elimination of ghost variables in program logics. In: Barthe, G., Fournet, C. (eds.) TGC 2007. LNCS, vol. 4912, pp. 1–20. Springer, Heidelberg (2008). doi:10.1007/978-3-540-78663-4_1

    Chapter  Google Scholar 

  8. Igarashi, A., Pierce, B.C., Wadler, P.: Featherweight Java: a minimal core calculus for Java and GJ. ACM Trans. Program. Lang. Syst. (TOPLAS) 23(3), 396–450 (2001)

    Article  Google Scholar 

  9. Kristiansen, E.: Automated composition of refactorings. Master’s thesis, Department of Informatics, University of Oslo (2014). http://www.mn.uio.no/ifi/english/research/groups/pma/completedmasters/2014/kristiansen/

  10. Kristiansen, E., Stolz, V.: Search-based composed refactorings. In: 27th Norsk Informatikkonferanse, NIK. Bibsys Open Journal Systems, Norway (2014)

    Google Scholar 

  11. Leavens, G.T.: JML’s rich, inherited specifications for behavioral subtypes. In: Liu, Z., Kleinberg, R.D. (eds.) ICFEM 2006. LNCS, vol. 4260, pp. 2–34. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  12. Mens, T., Taentzer, G., Runge, O.: Analysing refactoring dependencies using graph transformation. Softw. Syst. Model. 6(3), 269–285 (2007)

    Article  Google Scholar 

  13. Murphy-Hill, E., Parnin, C., Black, A.P.: How we refactor, and how we know it. IEEE Trans. Softw. Eng. 38(1), 5–18 (2012)

    Article  Google Scholar 

  14. Opdyke, W.F.: Refactoring object-oriented frameworks. Ph.D. thesis, University of Illinois at Urbana-Champaign (1992). UMI Order No. GAX93-05645

    Google Scholar 

  15. Ryder, B.G.: Dimensions of precision in reference analysis of object-oriented programming languages. In: Hedin, G. (ed.) CC 2003. LNCS, vol. 2622, pp. 126–137. Springer, Heidelberg (2003). doi:10.1007/3-540-36579-6_10

    Chapter  Google Scholar 

  16. Schäfer, M., de Moor, O.: Specifying, implementing refactorings. In: Cook, W.R., Clarke, S., Rinard, M.C. (eds.) Object Oriented Programming: Systems, Languages, and Applications (OOPSLA) 2010, pp. 286–301. ACM (2010)

    Google Scholar 

  17. Smaragdakis, Y., Balatsouras, G.: Pointer analysis. Found. Trends Program. Lang. 2(1), 1–69 (2015)

    Article  Google Scholar 

  18. Soares, G., Gheyi, R., Serey, D., Massoni, T.: Making program refactoring safer. IEEE Softw. 27(4), 52–57 (2010)

    Article  Google Scholar 

  19. Wimmer, C., Mössenböck, H.: Automatic feedback-directed object inlining in the Java HotSpot\(^{\text{tm}}\) virtual machine. In: Krintz, C., Hand, S., Tarditi, D. (eds.) 3rd International Conference on Virtual Execution Environments VEE, pp. 12–21. ACM (2007)

    Google Scholar 

  20. Zhao, L., Liu, X., Liu, Z., Qiu, Z.: Graph transformations for object-oriented refinement. Formal Asp. Comput. 21(1–2), 103–131 (2009)

    Article  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Volker Stolz .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Springer International Publishing AG

About this paper

Cite this paper

Eilertsen, A.M., Bagge, A.H., Stolz, V. (2016). Safer Refactorings. In: Margaria, T., Steffen, B. (eds) Leveraging Applications of Formal Methods, Verification and Validation: Foundational Techniques. ISoLA 2016. Lecture Notes in Computer Science(), vol 9952. Springer, Cham. https://doi.org/10.1007/978-3-319-47166-2_36

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-47166-2_36

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-47165-5

  • Online ISBN: 978-3-319-47166-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics