A reflective implementation of Java multi-methods

In Java, method implementations are chosen at runtime by late-binding with respect to the runtime class of just the receiver argument. However, in order to simplify many programming designs, late-binding with respect to the dynamic type of all arguments is sometimes desirable. This behavior, usually provided by multimethods, is known as multipolymorphism. This work presents a new multimethod implementation based on the standard Java reflection mechanism. Provided as a package, it does not require any language extension or any virtual machine modification. The design issues of this reflective implementation are presented together with a new and simple multimethod dispatch algorithm that efficiently supports class loading at runtime. This implementation provides a practicable and fully portable multimethod solution.

[1]  Olivier Gruber,et al.  Optimizing Multi-Method Dispatch Using Compressed Dispatch Tables , 1994, OOPSLA.

[2]  Linda G. DeMichiel,et al.  The Common Lisp Object System: An Overview , 1987, ECOOP.

[3]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[4]  R. Forax,et al.  Java Multi-Method Framework , 2000, Proceedings 37th International Conference on Technology of Object-Oriented Languages and Systems. TOOLS-Pacific 2000.

[5]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[6]  Barbara Liskov,et al.  Data Abstraction and Hierarchy , 1987 .

[7]  Guy L. Steele,et al.  Java(TM) Language Specification, The (3rd Edition) (Java (Addison-Wesley)) , 2005 .

[8]  Duane Szafron,et al.  Multi-method Dispatch Using Multiple Row Displacement , 1999, ECOOP.

[9]  Craig Chambers,et al.  Object-Oriented Multi-Methods in Cecil , 1992, ECOOP.

[10]  Laurence Duchien,et al.  JAC: A Flexible Solution for Aspect-Oriented Programming in Java , 2001, Reflection.

[11]  Todd D. Millstein,et al.  Modular Statically Typed Multimethods , 1999, Inf. Comput..

[12]  Jens Palsberg,et al.  The essence of the Visitor pattern , 1998, Proceedings. The Twenty-Second Annual International Computer Software and Applications Conference (Compsac '98) (Cat. No.98CB 36241).

[13]  Wolfgang Klas,et al.  Efficient Dynamic Look-Up Strategy for Multi-Methods , 1994, ECOOP.

[14]  Guy L. Steele,et al.  Java Language Specification, Second Edition: The Java Series , 2000 .

[15]  Daniel G. Bobrow,et al.  Book review: The Art of the MetaObject Protocol By Gregor Kiczales, Jim des Rivieres, Daniel G. and Bobrow(MIT Press, 1991) , 1991, SGAR.

[16]  Eric Simon,et al.  Fast algorithms for compressed multimethod dispatch table generation , 1998, TOPL.

[17]  Duane Szafron,et al.  Multi-Method Dispatch Using Single-Receiver Projections , 1998 .

[18]  Christian Grothoff Walkabout Revisited: The Runabout , 2003, ECOOP.

[19]  Thierry Coupaye,et al.  ASM: a code manipulation tool to implement adaptable systems , 2002 .

[20]  AgrawalRakesh,et al.  Static type checking of multi-methods , 1991 .

[21]  Gary T. Leavens,et al.  MultiJava: modular open classes and symmetric multiple dispatch for Java , 2000, OOPSLA '00.

[22]  David Grove,et al.  Vortex: an optimizing compiler for object-oriented languages , 1996, OOPSLA '96.

[23]  Luca Cardelli,et al.  On Binary Methods , 1995, Theory Pract. Object Syst..

[24]  Stephan Merz,et al.  Type checking higher-order polymorphic multi-methods , 1997, POPL '97.

[25]  Gilles Roussel,et al.  Recursive Types and Pattern-Matching in Java , 1999, GCSE.

[26]  Bruce G. Lindsay,et al.  Static type checking of multi-methods , 1991, OOPSLA '91.

[27]  Karl Lieberherr,et al.  Adaptive Object-Oriented Software: The Demeter Method with Propagation Patterns , 1995 .

[28]  Eric Dujardin Efficient Dispatch of Multimethods in Constant Time Using Dispatch Trees , 1996 .

[29]  Mirko Viroli,et al.  Parametric polymorphism in Java: an approach to translation based on reflective features , 2000, OOPSLA '00.

[30]  Barbara Liskov,et al.  Keynote address - data abstraction and hierarchy , 1988, OOPSLA '87.

[31]  John Tang Boyland,et al.  Parasitic methods: an implementation of multi-methods for Java , 1997, OOPSLA '97.

[32]  Joseph Gil,et al.  Fast algorithm for creating space efficient dispatching tables with application to multi-dispatching , 2002, OOPSLA '02.

[33]  James Gosling The Java Language Specification - Second Edition , 2000 .

[34]  Duane Szafron,et al.  Multi-Dispatch in the Java Virtual Machine: Design and Implementation , 2001, COOTS.

[35]  Gerald Baumgartner,et al.  Half & Half: Multiple Dispatch and Retroactive Abstraction for Java TM† , 2002 .