Improving Type Error Messages for Generic Java

Nabil El Boustani, Jurriaan Hage

Research output: Book/ReportOther report


Since version 1.5, generics (parametric polymorphism) are part of the Java language. However, adding parametric polymorphism to a language that is built on inclusion polymorphism can be confusing to a novice programmer, because the typing rules are suddenly different and, in the case of Generic Java, quite complex. Indeed, the main Java compilers, Eclipse’s ejc compiler 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. The extension has been implemented into the Jastad extensible Java compiler.
Original languageEnglish
PublisherDepartment of Information and Computing Sciences, Utrecht University
Number of pages23
Publication statusPublished - Oct 2008

Publication series

NameTechnical Report Series
ISSN (Print)0924-3275


Dive into the research topics of 'Improving Type Error Messages for Generic Java'. Together they form a unique fingerprint.

Cite this