## A Type-based Trace Analysis for Java

### BibTeX

@MISC{Rowe_atype-based,

author = {R. N. S. Rowe and S. J. Van Bakel},

title = {A Type-based Trace Analysis for Java},

year = {}

}

### OpenURL

### Abstract

The intersection type discipline (ITD) is a well established one in the field of the Lambda Calculus (LC) and the functional programming paradigm. It has also been extended to Term Rewriting Systems (TRS) and more recently to object calculi and sequent calculi. We continue this trend by applying the techniques of ITD to the analysis of the (class based) object-oriented (OO) programming paradigm: specifically, we study a small core calculus for Java which is a restriction of Featherweight Java by removing casts, for which using ITD we define an intersection type system that traces method and field calls. Type assignment in this system is closed under reduction and expansion, allowing for a type-based semantics for programs. The main contribution of this paper is an approximation result for this programming model, linking approximation semantics with trace semantics, which we achieve by defining a notion of reduction on type derivations that is strongly normalising (as for LC and TRS). This result demonstrates a direct correspondence between a trace semantics for programs and their types, and opens up the possibility of both abstract interpretation and detailed type-based analyses for OO. We show how the approximation result facilitates one such analysis- a characterisation of normalisation and termination. In order to demonstrate that our framework constitutes a practical approach to program analysis, we define a restriction of our type system which is essentially equivalent to Curry’s system for the Lambda Calculus (functional programming), and show that a principal typings property holds. We show that our system is expressive by giving an encoding of Combinatory Logic (and thereby, indirectly, the Lambda Calculus) into our calculus which preserves type assignment. The definition of principal typings for this system leads straightforwardly to a decidable type inference algorithm, for which we have a reference implementation in ML.