Automatic generation of Java fluent APIs from BNF specifications

Tomer Levy, M.Sc. Thesis Seminar
Wednesday, 24.2.2016, 12:30
Taub 601
Assoc. Prof. J. Gil

Fluent APIs increasingly gain popularity and research interest. It allows an API designer to enforce correct usage of the API by type-safety. Although many people design new fluent APIs manually, the question of automating the process remained unanswered yet. In this work, we explain why the problem's core lies with the expressive power of Java generics. Our main result is that automatic generation is possible whenever the specification is an instance of the set of deterministic context-free languages, a set which contains most ``practical'' languages. Other contributions include a collection of techniques and idioms of the limited meta-programming possible with Java generics, and an empirical measurement demonstrating that the runtime of the ``javac'' compiler of Java may be exponential in the program's length, even for programs composed of a handful of lines and which do not rely on overly complex use of generics.

Back to the index of events