A common approach to improve software quality is to use programming guidelines to avoid common kinds of errors. In this paper, we consider the problem of enforcing guidelines for Featherweight Java (FJ). We formalize guidelines as sets of finite or infinite execution traces and develop a region-based type and effect system for FJ that can enforce such guidelines. We build on the work by Erbatur, Hofmann and Z\u{a}linescu, who presented a type system for verifying the finite event traces of terminating FJ programs. We refine this type system, separating region typing from FJ typing, and use ideas of Hofmann and Chen to extend it to capture also infinite traces produced by non-terminating programs. Our type and effect system can express properties of both finite and infinite traces and can compute information about the possible infinite traces of FJ programs. Specifically, the set of infinite traces of a method is constructed as the greatest fixed point of the operator which calculates the possible traces of method bodies. Our type inference algorithm is realized by working with the finitary abstraction of the system based on B\"uchi automata.
翻译:提高软件质量的通用方法是使用程序设计指南来避免常见的错误。 在本文中, 我们考虑了执行Featherweight Java(FJ)指南的问题。 我们正式将指南作为有限或无限执行痕迹的一组, 并为FJ开发一个基于区域的类型和效果系统, 可以执行这种指南。 我们以Erbatur、Hofmann 和 {u{a}linescu 的工作为基础, 他们提出了一个用于核查终止 FJ 程序的有限事件痕迹的类型系统。 我们改进了这一类型系统, 将区域打字与 FJ 打字区分开来, 并使用Hofmann 和 Chen 的想法来扩展它, 以捕捉非终止程序产生的无限痕迹。 我们的类型和效果系统可以表达有限和无限的痕迹的属性, 并且可以编译关于FJ程序可能存在的无限痕迹的信息。 具体地说, 一种方法的无限痕迹组是计算方法机体可能留下的痕迹的最大固定点。 我们的推算算算法是通过基于 Buchi aumatata 的系统原始抽象而实现的。