Improving type error messages for generic Java

  • Authors:
  • Nabil Boustani;Jurriaan Hage

  • Affiliations:
  • Center for Software Technology, Department of Information and Computing Sciences, Universiteit Utrecht, Utrecht, The Netherlands 3508 TB;Center for Software Technology, Department of Information and Computing Sciences, Universiteit Utrecht, Utrecht, The Netherlands 3508 TB

  • Venue:
  • Higher-Order and Symbolic Computation
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

Since version 1.5, generics (parametric polymorphism) are part of the Java language. However, the combination of parametric polymorphism and inclusion polymorphism is complicated, particularly so for Generic Java. Indeed, the main Java compilers, Eclipse's ejc and Sun's javac, do not even accept the same set of programs. Moreover, experience with these compilers shows that the error messages provided by them leave more than a little to be desired.To alleviate the latter problem, we describe how to adapt the type inference process of Java to obtain better error diagnostics for generic method invocations. Although the extension by itself already helps to improve type error messages to some extent, another major advantage of the new type inference process is that it also paves the way for further heuristics can provide additional diagnostic information. The extension has been implemented into the JastAdd Extensible Java Compiler.