skip to main content
10.1145/1706356.1706360acmconferencesArticle/Chapter ViewAbstractPublication PagespepmConference Proceedingsconference-collections
research-article

Corrective hints for type incorrect generic Java programs

Published:18 January 2010Publication History

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.

References

  1. T. Ekman and G. Hedin. JastAdd Extensible Java Compiler. http://jastadd.cs.lth.se/web/extjava. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. N. el Boustani. Improving type error messages for generic java, 2008. http://www.cs.uu.nl/wiki/Hage/MasterStudents.Google ScholarGoogle Scholar
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. M. Odersky et al. The Scala homepage, 2008. http://www.scala-lang.org/.Google ScholarGoogle Scholar
  5. J. Gosling, B. Joy, G. Steele, and G. Bracha. Java(TM) Language Specification, The Third Edition. Addison-Wesley Professional, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. B. Heeren. Top Quality Type Error Messages. PhD thesis, Universiteit Utrecht, The Netherlands, 2005. http://www.cs.uu.nl/people/bastiaan/phdthesis.Google ScholarGoogle Scholar
  9. M.C. Jadud. A first look at novice compilation behaviour using BlueJ. Computer Science Education, 15(1):25--40, March 2005.Google ScholarGoogle ScholarCross RefCross Ref
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. J. Nordlander, M. Carlsson, A. Gill, P. Lindgren, and B. von Sydow. The Timber homepage, 2008. http://www.timber-lang.org.Google ScholarGoogle Scholar
  12. Stuart Russell and Peter Norvig. Artificial Intelligence: A Modern Approach, chapter 5, pages 137--151. Pearson Education, second edition, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Corrective hints for type incorrect generic Java programs

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Conferences
      PEPM '10: Proceedings of the 2010 ACM SIGPLAN workshop on Partial evaluation and program manipulation
      January 2010
      168 pages
      ISBN:9781605587271
      DOI:10.1145/1706356

      Copyright © 2010 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 18 January 2010

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      Overall Acceptance Rate66of120submissions,55%

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader