Ownership and immutability in generic Java

13 years 2 months ago
Ownership and immutability in generic Java
The Java language lacks the important notions of ownership (an object owns its representation to prevent unwanted aliasing) and immutability (the division into mutable, immutable, and readonly data and references). Programmers are prone to design errors, such as representation exposure or violation of immutability contracts. This paper presents Ownership Immutability Generic Java (OIGJ), a backward-compatible purely-static language extension supporting ownership and immutability. We formally defined a core calculus for OIGJ, based on Featherweight Java, and proved it sound. We also implemented OIGJ and performed case studies on 33,000 lines of code. Creation of immutable cyclic structures requires a “cooking phase” in which the structure is mutated but the outside world cannot observe this mutation. OIGJ uses ownership information to facilitate creation of immutable cyclic structures, by safely prolonging the cooking phase even after the constructor finishes. OIGJ is easy for a ...
Yoav Zibin, Alex Potanin, Paley Li, Mahmood Ali, M
Added 29 Jan 2011
Updated 29 Jan 2011
Type Journal
Year 2010
Authors Yoav Zibin, Alex Potanin, Paley Li, Mahmood Ali, Michael D. Ernst
Comments (0)