License: Creative Commons Attribution 3.0 Unported license (CC BY 3.0)
When quoting this document, please refer to the following
DOI: 10.4230/LIPIcs.ECOOP.2018.20
URN: urn:nbn:de:0030-drops-92259
Go to the corresponding LIPIcs Volume Portal

Wang, Yanlin ; Zhang, Haoyuan ; Oliveira, Bruno C. d. S. ; Servetto, Marco

FHJ: A Formal Model for Hierarchical Dispatching and Overriding

LIPIcs-ECOOP-2018-20.pdf (0.8 MB)


Multiple inheritance is a valuable feature for Object-Oriented Programming. However, it is also tricky to get right, as illustrated by the extensive literature on the topic. A key issue is the ambiguity arising from inheriting multiple parents, which can have conflicting methods. Numerous existing work provides solutions for conflicts which arise from diamond inheritance: i.e. conflicts that arise from implementations sharing a common ancestor. However, most mechanisms are inadequate to deal with unintentional method conflicts: conflicts which arise from two unrelated methods that happen to share the same name and signature.
This paper presents a new model called Featherweight Hierarchical Java (FHJ) that deals with unintentional method conflicts. In our new model, which is partly inspired by C++, conflicting methods arising from unrelated methods can coexist in the same class, and hierarchical dispatching supports unambiguous lookups in the presence of such conflicting methods. To avoid ambiguity, hierarchical information is employed in method dispatching, which uses a combination of static and dynamic type information to choose the implementation of a method at run-time. Furthermore, unlike all existing inheritance models, our model supports hierarchical method overriding: that is, methods can be independently overridden along the multiple inheritance hierarchy. We give illustrative examples of our language and features and formalize FHJ as a minimal Featherweight-Java style calculus.

BibTeX - Entry

  author =	{Yanlin Wang and Haoyuan Zhang and Bruno C. d. S. Oliveira and Marco Servetto},
  title =	{{FHJ: A Formal Model for Hierarchical Dispatching and Overriding}},
  booktitle =	{32nd European Conference on Object-Oriented Programming  (ECOOP 2018)},
  pages =	{20:1--20:30},
  series =	{Leibniz International Proceedings in Informatics (LIPIcs)},
  ISBN =	{978-3-95977-079-8},
  ISSN =	{1868-8969},
  year =	{2018},
  volume =	{109},
  editor =	{Todd Millstein},
  publisher =	{Schloss Dagstuhl--Leibniz-Zentrum fuer Informatik},
  address =	{Dagstuhl, Germany},
  URL =		{},
  URN =		{urn:nbn:de:0030-drops-92259},
  doi =		{10.4230/LIPIcs.ECOOP.2018.20},
  annote =	{Keywords: multiple inheritance, hierarchical dispatching, OOP, language design}

Keywords: multiple inheritance, hierarchical dispatching, OOP, language design
Collection: 32nd European Conference on Object-Oriented Programming (ECOOP 2018)
Issue Date: 2018
Date of publication: 10.07.2018

DROPS-Home | Fulltext Search | Imprint | Privacy Published by LZI