We present MultiJava, a backward-compatible extension to Java supporting op
en classes and symmetric multiple dispatch. Open classes allow one to add t
o the set of methods that an existing class supports without creating disti
nct subclasses or editing existing code. Unlike the "Visitor" design patter
n, open classes do not require advance planning, and open classes preserve
the ability to add new subclasses modularly and safely. Multiple dispatch o
ffers several well-known advantages over the single dispatching of conventi
onal object-oriented languages, including a simple solution to some kinds o
f "binary method" problems. MultiJava's multiple dispatch retains Java's ex
isting class-based encapsulation properties. We adapt previous theoretical
work to allow compilation units to be statically typechecked modularly and
safely, ruling out any link-time or run-time type errors. We also present a
novel compilation scheme that operates modularly and incurs performance ov
erhead only where open classes or multiple dispatching are actually used.