Behavioural Types for Memory and Method Safety in a Core Object-Oriented Language


We present a type-based analysis ensuring memory safety and object protocol completion in the Java-like language Mungo. Objects are annotated with usages, typestates-like specifications of the admissible sequences of method calls. The analysis entwines usage checking, controlling the order in which methods are called, with a static check determining whether references may contain null values. It prevents null pointer dereferencing in a typestate-aware manner and memory leaks and ensures that the intended usage protocol of every object is respected and completed. The type system admits an algorithm that infers the most general usage with respect to a simulation preorder. The type system is implemented in the form of a type checker and a usage inference tool.

In APLAS 2020
Mathias Jakobsen
Mathias Jakobsen
PhD Student

Mathias is a PhD Student at the School of Computing Science, University of Glasgow.

António Ravara
António Ravara
Associate Professor

António is an Associate Professor at the Department of Informatics of the NOVA School of Science and Technology, in Lisbon, Portugal