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

  • Authors:
  • Friedrich Steimann;Andreas Thies

  • Affiliations:
  • Lehrgebiet Programmiersysteme Fakultät für Mathematik und Informatik, Fernuniversität in Hagen, Hagen, D-58084;Lehrgebiet Programmiersysteme Fakultät für Mathematik und Informatik, Fernuniversität in Hagen, Hagen, D-58084

  • Venue:
  • Genoa Proceedings of the 23rd European Conference on ECOOP 2009 --- Object-Oriented Programming
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

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 .