# A Co-contextual Type Checker for Featherweight Java (incl. Proofs)

**Authors:** Edlira Kuci, Sebastian Erdweg, Oliver Bra\v{c}evac, Andi Bejleri, and, Mira Mezini

arXiv: 1705.05828 · 2018-05-24

## TL;DR

This paper introduces a co-contextual, incremental type checking approach for Featherweight Java that handles key object-oriented features, improving efficiency and enabling better performance compared to traditional methods.

## Contribution

It develops a novel co-contextual formulation of Featherweight Java's type system, replacing class tables with class table requirements, and proves their equivalence.

## Key findings

- The incremental type checker outperforms javac on realistic programs.
- The co-contextual approach effectively handles subtype polymorphism, nominal typing, and inheritance.
- Proved the equivalence between traditional and co-contextual FJ type systems.

## Abstract

This paper addresses compositional and incremental type checking for object-oriented programming languages. Recent work achieved incremental type checking for structurally typed functional languages through co-contextual typing rules, a constraint-based formulation that removes any context dependency for expression typings. However, that work does not cover key features of object-oriented languages: Subtype polymorphism, nominal typing, and implementation inheritance. Type checkers encode these features in the form of class tables, an additional form of typing context inhibiting incrementalization. In the present work, we demonstrate that an appropriate co-contextual notion to class tables exists, paving the way to efficient incremental type checkers for object-oriented languages. This yields a novel formulation of Igarashi et al.'s Featherweight Java (FJ) type system, where we replace class tables by the dual concept of class table requirements and class table operations by dual operations on class table requirements. We prove the equivalence of FJ's type system and our co-contextual formulation. Based on our formulation, we implemented an incremental FJ type checker and compared its performance against javac on a number of realistic example programs.

## Figures

1 figure with captions in the complete paper: https://tomesphere.com/paper/1705.05828/full.md

---
Source: https://tomesphere.com/paper/1705.05828