Artigo Acesso aberto Revisado por pares

Improving type error messages for generic Java

2011; Springer Science+Business Media; Volume: 24; Issue: 1-2 Linguagem: Inglês

10.1007/s10990-011-9070-3

ISSN

2212-0793

Autores

Nabil El Boustani, Jurriaan Hage,

Tópico(s)

Advanced Software Engineering Methodologies

Resumo

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.

Referência(s)