Issue No. 12 - December (2004 vol. 30)
DOI Bookmark: http://doi.ieeecomputersociety.org/10.1109/TSE.2004.90
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 multi-methods, is known as multipolymorphism. This paper presents a new multi-method implementation based on the standard Java reflection mechanism. Provided as a package, it does not require any language extension nor any virtual machine modification. The design issues of this reflective implementation are presented together with a new and simple multi-method dispatch algorithm that efficiently supports class loading at runtime. This implementation provides a practicable and fully portable multi-method solution.
Java, polymorphism, reflection, dynamic class loading.
G. Roussel, R. Forax and E. Duris, "A Reflective Implementation of Java Multi-Methods," in IEEE Transactions on Software Engineering, vol. 30, no. , pp. 1055-1071, 2004.