The Runabout is an extension of the Java libraries that adds two-argument multi-dispatch to Java without changing the language or the VM. It uses reflection to find visit methods, which are invoked using dynamically generated and loaded code. The Runabout does not need a special compiler or changes to Java's syntax. Dispatch with the Runabout is fairly fast, typically a factor of two to ten times slower than double dispatch. The Runabout is useful since it can help to make code faster and more readable. For example, a sequence of instanceof tests is a clear sign that a Runabout should be used instead.
| Tags | Software Development Compilers Libraries Java Libraries |
|---|---|
| Licenses | GPL |
| Operating Systems | OS Independent |
| Implementation | Java |
Recent releases


Changes: This release makes the Runabout code much simpler. The goal was to make it easier for users to understand code using the Runabout by avoiding feature-bloat. The major changes are elimination of features. Specifically, there is no longer support for primitive types or user-defined dispatching functions. Supporting primitive types would interact badly with the auto (un)boxing features that are new in Java 5.0. The implementation was cleaned up to make use of the new features of Java 5.0. As a result, the new version works only with Java 5.0 or higher.


Changes: This release fixed various bugs in the Runabout Optimizer that could lead to the generation of invalid bytecode under certain circumstances. It also fixed handing of the line number and local variable attributes.


Changes: With this release a new tool, the Runabout Optimizer, is made available. It statically translates Java applications that use the Runabout into semantically equivalent applications where the reflective code of the Runabout is replaced with synthetic, visitor-like dispatching code. This makes the Runabout applicable in situations where dynamic loading or reflection are not possible or extraordinarily costly, e.g. when Java code is compiled ahead of time with gcj. The package name Runabout was changed to follow Java naming conventions.


Changes: Dispatching on arrays was broken (the generated bytecode would not verify). The new version handles code generation for arrays and performs the dispatch correctly with respect to Java's array-subtyping rules.


Changes: Ambiguous resolutions due to multiple matching interfaces are now detected and cause a run-time exception. Visits to primitive types now fall back to visit(Object) by default on the boxed values if the primitive visit methods are not redefined. Minor code cleanups were also made.