Java's type system mostly relies on type checking augmented with local type inference to improve programmer convenience. We study global type inference for Featherweight Generic Java (FGJ), a functional Java core language. Given generic class headers and field specifications, our inference algorithm infers all method types if classes do not make use of polymorphic recursion. The algorithm is constraint-based and improves on prior work in several respects. Despite the restricted setting, global type inference for FGJ is NP-complete.
翻译:Java的型号系统主要依靠类型检查,加上当地类型的推论,以提高程序员的方便性。 我们研究一种实用的 Java 核心语言,即Peatherweight general Java (FGJ) 的全球类型推论。 根据通用类标题和实地规格,如果各类不使用多变循环,我们的推论算算算法推断出所有方法类型。 算法基于限制,在几个方面改进了先前的工作。 尽管设置有限制,但FGJ 的全球类型推论还是完成了 NP 。