IDEALS Home University of Illinois at Urbana-Champaign logo The Alma Mater The Main Quad

Refactoring for Immutability

Show full item record

Bookmark or cite this item:

Files in this item

File Description Format
PDF immutator.pdf (476KB) Main article PDF
Title: Refactoring for Immutability
Author(s): Kjolstad, Fredrik Berg; Dig, Danny; Acevedo, Gabriel; Snir, Marc
Subject(s): refactoring refactoring tools immutability program analysis Eclipse program transformation
Abstract: It is common for Object-Oriented programs to contain mutable and immutable classes. Immutable classes simplify sequential programing because the programmer does not have to reason about side-effects. Immutable classes also simplify parallel programming because they are embarrassingly thread-safe. Sometimes programmers write immutable classes from scratch, other times they refactor mutable into immutable classes. To refactor a mutable class, programmers must find (i) all methods that mutate its transitive state and (ii) all objects that can enter or escape the state of the class. The programmer must also update client code to use the class in an immutable fashion. The analysis is non-trivial and the rewriting is tedious. Fortunately, this can be automated. We present Immutator, a technique and tool that enables the programmer to safely refactor a mutable class into an immutable class. Immutator also repairs client code to use the refactored class in an immutable fashion. Experience with refactoring several open-source programs shows that Immutator is useful: (i) it reduces the burden of making classes immutable, (ii) is fast enough to be used interactively, and (iii) is much safer than manual refactorings performed by open-source developers.
Issue Date: 2010-06-07
Genre: Technical ReportArticle
Type: Text
Language: English
Publication Status: unpublished
Peer Reviewed: is peer reviewed
Date Available in IDEALS: 2010-06-07

This item appears in the following Collection(s)

Show full item record

Item Statistics

  • Total Downloads: 473
  • Downloads this Month: 5
  • Downloads Today: 0


My Account


Access Key