Typechecking protocols with Mungo and StMungo: A session type toolchain for Java

Abstract

Static typechecking is an important feature of many standard programming languages. However, static typing focuses on data rather than communication, and therefore does not help programmers correctly implement communication protocols in distributed systems. The theory of session types provides a basis for tackling this problem; we use it to develop two tools that support static typechecking of communication protocols in Java. The first tool, Mungo, extends Java with typestate definitions, which allow classes to be associated with state machines defining permitted sequences of method calls: for example, communication methods. The second tool, StMungo, takes a session type describing a communication protocol, and generates a typestate specification of the permitted sequences of messages in the protocol. Protocol implementations can be validated by Mungo against their typestate definitions and then compiled with a standard Java compiler. The result is a toolchain for static typechecking of communication protocols in Java. We formalise and prove soundness of the typestate inference system used by Mungo, and show that our toolchain can be used to typecheck a client for the standard Simple Mail Transfer Protocol (SMTP).

Publication
In Science of Computer Programming 2018
Dimitrios Kouzapas
Dimitrios Kouzapas
Research Associate
Ornela Dardha
Ornela Dardha
Assistant Professor

Dr. Ornela Dardha is a Lecturer (Assistant Professor) at the School of Computing Science, University of Glasgow.

Roly Perera
Roly Perera
Senior Research Software Engineer

He is currently a Senior research software engineer at The Alan Turing Institute.

Simon Gay
Simon Gay
Head of School of Computing Science

Professor Simon Gay is Head of School in the School of Computing Science.

Related