Object and reference immutability using Java generics

Uložené v:
Podrobná bibliografia
Názov: Object and reference immutability using Java generics
Autori: Yoav Zibin, Alex Potanin, Mahmood Ali, Shay Artzi, Michael D. Ernst
Prispievatelia: The Pennsylvania State University CiteSeerX Archives
Zdroj: http://www.cs.washington.edu/homes/mernst/pubs/immutability-generics-fse2007.pdf.
Informácie o vydavateľovi: ACM Press
Rok vydania: 2007
Zbierka: CiteSeerX
Predmety: General Terms, Design, Languages, Theory Keywords, const, Generic, IGJ, Immutability, Java, Readonly
Popis: A compiler-checked immutability guarantee provides useful documentation, facilitates reasoning, and enables optimizations. This paper presents Immutability Generic Java (IGJ), a novel language extension that expresses immutability without changing Java’s syntax by building upon Java’s generics and annotation mechanisms. In IGJ, each class has one additional type parameter that is Mutable, Immutable, or ReadOnly. IGJ guarantees both reference immutability (only mutable references can mutate an object) and object immutability (an immutable reference points to an immutable object). IGJ is the first proposal for enforcing object immutability within Java’s syntax and type system, and its reference immutability is more expressive than previous work. IGJ also permits covariant changes of type parameters in a type-safe manner, e.g., a readonly list of integers is a subtype of a readonly list of numbers. IGJ extends Java’s type system with a few simple rules. We formalize this type system and prove it sound. Our IGJ compiler works by typeerasure and generates byte-code that can be executed on any JVM without runtime penalty.
Druh dokumentu: text
Popis súboru: application/pdf
Jazyk: English
Relation: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.143.5200
Dostupnosť: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.143.5200
http://www.cs.washington.edu/homes/mernst/pubs/immutability-generics-fse2007.pdf
Rights: Metadata may be used without restrictions as long as the oai identifier remains attached to it.
Prístupové číslo: edsbas.256F9A99
Databáza: BASE
Popis
Abstrakt:A compiler-checked immutability guarantee provides useful documentation, facilitates reasoning, and enables optimizations. This paper presents Immutability Generic Java (IGJ), a novel language extension that expresses immutability without changing Java’s syntax by building upon Java’s generics and annotation mechanisms. In IGJ, each class has one additional type parameter that is Mutable, Immutable, or ReadOnly. IGJ guarantees both reference immutability (only mutable references can mutate an object) and object immutability (an immutable reference points to an immutable object). IGJ is the first proposal for enforcing object immutability within Java’s syntax and type system, and its reference immutability is more expressive than previous work. IGJ also permits covariant changes of type parameters in a type-safe manner, e.g., a readonly list of integers is a subtype of a readonly list of numbers. IGJ extends Java’s type system with a few simple rules. We formalize this type system and prove it sound. Our IGJ compiler works by typeerasure and generates byte-code that can be executed on any JVM without runtime penalty.