Abstract
This paper describes a reduction from the halting problem of Turing machines to subtype checking in Java. It follows that subtype checking in Java is undecidable, which answers a question posed by Kennedy and Pierce in 2007. It also follows that Java's type checker can recognize any recursive language, which improves a result of Gill and Levy from 2016. The latter point is illustrated by a parser generator for fluent interfaces.
- N. Amin and R. Tate. Java and Scala’s type systems are unsound: The existential crisis of null pointers. In OOPSLA, 2016. Google Scholar
Digital Library
- R. O. Bjarnason. More Scala typehackery. https://apocalisp.wordpress.com/2009/09/02/ (see also https://michid.wordpress.com/2010/01/29), 2009.Google Scholar
- A. Breslav. Mixed-site variance in Kotlin. http://blog.jetbrains.com/kotlin/2013/06/mixed, 2013.Google Scholar
- B. Courcelle. On jump-deterministic pushdown automata. Mathematical Systems Theory, 1977.Google Scholar
- L. Dionne. Boost.Hana. http://boostorg.github.io/hana, 2016.Google Scholar
- Y. Gil and T. Levy. Formal language recognition with the Java type checker. In ECOOP, 2016.Google Scholar
- O. Goldreich. Computational complexity: a conceptual perspective. Cambridge University Press, 2008. Google Scholar
Cross Ref
- J. Gosling, B. Joy, G. Steele, G. Bracha, and A. Buckley. The Java language specification, 2015. Java SE 8 Edition. B. Greenman, F. Muehlboeck, and R. Tate. Getting F-bounded polymorphism into shape. In PLDI, 2014. Google Scholar
Digital Library
- R. Grigore. Parser generator for fluent interfaces. http://rgrig.appspot.com/javats, 2016.Google Scholar
- J. E. Hopcroft and J. D. Ullman. Introduction to Automata Theory, Languages, and Computation. Addison–Wesley, 1979. Google Scholar
Digital Library
- A. J. Kennedy and B. Pierce. On decidability of nominal subtyping with variance. In FOOL, 2007.Google Scholar
- D. E. Knuth. On the translation of languages from left to right. Information and Control, 1965.Google Scholar
Cross Ref
- M. Lange and H. Leiß. To CNF or not to CNF? An efficient yet presentable version of the CYK algorithm. Informatica Didactica, 2009.Google Scholar
- X. Leroy. Formal verification of a realistic compiler. CACM, 2009. Google Scholar
Digital Library
- M. Lillibridge. Translucent Sums: A Foundation for Higher-Order Modules. PhD thesis, CMU, 1997.Google Scholar
- E. Lippert. A simple problem whose decidability is not known. Theoretical Computer Science Stack Exchange, 2013. http://cstheory.stackexchange.com/q/18866.Google Scholar
- H. G. Mairson. Deciding ML typability is complete for deterministic exponential time. In POPL, 1990. Google Scholar
Digital Library
- M. Odersky. Scaling DOT to Scala – soundness. http://scala-lang. org/blog/2016/02/17/scaling-dot-soundness.html, 2016.Google Scholar
- B. C. Pierce. Bounded quantification is undecidable. Information and Computation, 1994. Google Scholar
Digital Library
- A. Rossberg. Undecidability of OCaml type checking. Caml mailing list, 1999. http://caml.inria.fr/pub/old_caml_site/caml-list/1507.html. M. Sulzmann, G. J. Duck, S. L. P. Jones, and P. J. Stuckey. Understanding functional dependencies via constraint handling rules. J. Funct. Program., 2007. Google Scholar
Digital Library
- R. Tate, A. Leung, and S. Lerner. Taming wildcards in Java’s type system. In PLDI, 2011. Google Scholar
Digital Library
- A. M. Turing. On computable numbers, with an application to the Entscheidungsproblem. J. of Math, 1936.Google Scholar
- T. L. Veldhuizen. C++ templates are Turing complete. Technical report, Indiana University, 2003.Google Scholar
- M. Viroli. On the recursive generation of parametric types. Technical report, University of Bologna, 2000.Google Scholar
- K. Wansbrough. Instance declarations are universal. http://www.lochan.org/keith/publications/undec.html (see also https://wiki.haskell.org/Type_SK), 1998.Google Scholar
- S. Wehr and P. Thiemann. On the decidability of subtyping with bounded existential types. In APLAS, 2009. Google Scholar
Digital Library
- S. Weirich. RepLib: a library for derivable type classes. In Haskell, 2006. Google Scholar
Digital Library
- J. B. Wells. Typability and type checking in System F are equivalent and undecidable. Annals of Pure and Applied Logic, 1999.Google Scholar
Cross Ref
- Y. Zhang, M. C. Loring, G. Salvaneschi, B. Liskov, and A. C. Myers. Lightweight, flexible object-oriented generics. In PLDI, 2015. Google Scholar
Digital Library
Index Terms
Java generics are turing complete
Recommendations
Java generics are turing complete
POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming LanguagesThis paper describes a reduction from the halting problem of Turing machines to subtype checking in Java. It follows that subtype checking in Java is undecidable, which answers a question posed by Kennedy and Pierce in 2007. It also follows that Java's ...
Object and reference immutability using Java generics
ESEC-FSE '07: Proceedings of the the 6th joint meeting of the European software engineering conference and the ACM SIGSOFT symposium on The foundations of software engineeringA compiler-checked immutability guarantee provides useful documentation, facilitates reasoning, and enables optimizations. This paper presents Immutability Generic Java (IGJ), a novel language extension that expresses immutability without changing Java'...
Compile-time type-checking for custom type qualifiers in Java
OOPSLA '07: Companion to the 22nd ACM SIGPLAN conference on Object-oriented programming systems and applications companionWe have created a system that enables programmers to add custom type qualifiers to the Java language in a backward-compatible way. The system allows programmers to write type qualifiers in their programs and to create compiler plug-ins that enforce the ...







Comments