Encoding Ownership Types in Java
نویسندگان
چکیده
Ownership types systems organise the heap into a hierarchy which can be used to support encapsulation properties, effects, and invariants. Ownership types have many applications including parallelisation, concurrency, memory management, and security. In this paper, we show that several flavours and extensions of ownership types can be entirely encoded using the standard Java type system. Ownership types systems usually require a sizable effort to implement and the relation of ownership types to standard type systems is poorly understood. Our encoding demonstrates the connection between ownership types and parametric and existential types. We formalise our encoding using a model for Java’s type system, and prove that it is sound and enforces an ownership hierarchy. Finally, we leverage our encoding to produce lightweight compilers for Ownership Types and Universe Types — each compiler took only one day to implement.
منابع مشابه
Gradual Ownership Types
Gradual Ownership Types are a framework allowing programs to be partially annotated with ownership types, while providing the same encapsulation guarantees. The formalism provides a static guarantee of the desired encapsulation property for fully annotated programs, and dynamic guarantees for partially annotated programs via dynamic checks inserted by the compiler. This enables a smooth migrati...
متن کاملSafe Runtime Downcasts With Ownership Types
The possibility of aliasing between objects constitutes one of the primary challenges in understanding and reasoning about correctness of object-oriented programs. Ownership types provide a principled way of specifying statically enforcable restrictions on object aliasing. Ownership types have been used to aid program understanding and evolution, verify absence of data races and deadlocks in mu...
متن کاملVariant Ownership with Existential Types
We propose an ownership types system with existential quantification of owners, similar to the existential quantification of types in models of Java wildcards. This produces a system with variant ownership types. Using explicit existential types for variance is more expressive, less ad hoc, and easier to understand and reason about than previous solutions. Furthermore, we propose using both typ...
متن کاملGeneric Ownership: Practical Alias Control in Object-Oriented Programming Languages
Modern object-oriented languages support many techniques that simplify the work of a programmer. Among them is type genericity — an ability to create generic descriptions of algorithms and object structures that will be automatically specialised by supplying type information at run time. On the other hand, object-oriented technologies still suffer from bad effects of aliasing— a case of many ob...
متن کاملJavaD: Bringing Ownership Domains to Mainstream Java
Ownership types have been receiving much attention from the research community. However, few of the proposed designs have been implemented or evaluated on real object-oriented implementations. AliasJava has been available for a few years and has been applied on several case studies. Currently, AliasJava is implemented as a non-backwards compatible extension of the Java programming language. As ...
متن کامل