ABSTRACT
Since version 1.5, generics (parametric polymorphism) are part of the Java language. Experience with implementations of the Java Language Specification such as EJC and JAVAC has shown that the type error messages provided by these tools leave more than a little to be desired. Type error messages are often uninformative and sometimes show artifacts of the type checking process in the messages. Apparently, providing good type error messages for a language as large and complex as Java currently is, is not easy.
To alleviate the problem, we describe a number of heuristics that suggest fixes for generic method invocations in Generic Java, and illustrate their effect by means of examples. The heuristics are part of an extension to the original type checking process that has been implemented into the JastAdd Extensible Java Compiler.
- T. Ekman and G. Hedin. JastAdd Extensible Java Compiler. http://jastadd.cs.lth.se/web/extjava. Google ScholarDigital Library
- N. el Boustani. Improving type error messages for generic java, 2008. http://www.cs.uu.nl/wiki/Hage/MasterStudents.Google Scholar
- N. el Boustani and J. Hage. Improving type error messages for Generic Java. In G. Puebla and G. Vidal, editors, Proceedings of the ACM SIGPLAN 2009 Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM '09), pages 131--140. ACM Press, 2009. Google ScholarDigital Library
- M. Odersky et al. The Scala homepage, 2008. http://www.scala-lang.org/.Google Scholar
- J. Gosling, B. Joy, G. Steele, and G. Bracha. Java(TM) Language Specification, The Third Edition. Addison-Wesley Professional, 2005. Google ScholarDigital Library
- J. Hage and B. Heeren. Heuristics for type error discovery and recovery. In Z. Horváth, V. Zsók, and A. Butterfield, editors, Implementation of Functional Languages -- IFL 2006, volume 4449, pages 199--216, Heidelberg, 2007. Springer Verlag. Google ScholarDigital Library
- G. Hedin and E. Magnusson. The JastAdd system -- an aspect-oriented compiler construction system. Science of Computer Programming, 47(1):37--58, April 2003. http://www.cs.lth.se/~gorel/publications/2003-JastAdd-SCP-Preprint.pdf. Google ScholarDigital Library
- B. Heeren. Top Quality Type Error Messages. PhD thesis, Universiteit Utrecht, The Netherlands, 2005. http://www.cs.uu.nl/people/bastiaan/phdthesis.Google Scholar
- M.C. Jadud. A first look at novice compilation behaviour using BlueJ. Computer Science Education, 15(1):25--40, March 2005.Google ScholarCross Ref
- B. Lerner, D. Grossman, and C. Chambers. Seminal: searching for ml type-error messages. In ML '06: Proceedings of the 2006 workshop on ML, pages 63--73, New York, NY, USA, 2006. ACM. Google ScholarDigital Library
- J. Nordlander, M. Carlsson, A. Gill, P. Lindgren, and B. von Sydow. The Timber homepage, 2008. http://www.timber-lang.org.Google Scholar
- Stuart Russell and Peter Norvig. Artificial Intelligence: A Modern Approach, chapter 5, pages 137--151. Pearson Education, second edition, 2003. Google ScholarDigital Library
- D. Smith and R. Cartwright. Java type inference is broken: Can we x it? In Proceedings of the 23rd Conference on Object-oriented programming, systems, languages, and applications (OOPSLA '08), pages 505--524, New York, NY, USA, 2008. ACM. Google ScholarDigital Library
- J.A. Walz and G.F. Johnson. A maximum flow approach to anomaly isolation in unification-based incremental type inference. In Conference Record of the 13th Annual ACM Symposium on Principles of Programming Languages, pages 44--57, St. Petersburg, FL, January 1986. Google ScholarDigital Library
Index Terms
- Corrective hints for type incorrect generic Java programs
Recommendations
Improving type error messages for generic java
PEPM '09: Proceedings of the 2009 ACM SIGPLAN workshop on Partial evaluation and program manipulationSince 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 ...
Improving type error messages for generic Java
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, ...
A type system for object initialization in the Java bytecode language
In the standard Java implementation, a Java language program is compiled to Java bytecode. This bytecode may be sent across the network to another site, where it is then executed by the Java Virtual Machine. Since bytecode may be written by hand, or ...
Comments