JPred: Practical Predicate Dispatch for Java

JPred is an extension to the Java programming language to support predicate dispatch. With predicate dispatch, each method implementation includes a predicate guard specifying the conditions under which the method should be invoked, and logical implication of predicates determines the method overriding relation. Predicate dispatch naturally unifies and generalizes several common forms of dynamic dispatch, including traditional OO dispatch, multimethod dispatch, and functional-style pattern matching.

JPred resolves several limitations in prior approaches to predicate dispatch. First, JPred retains Java's modular typechecking and compilation strategies; prior languages with predicate dispatch have required the whole program to be available for typechecking and compilation. Second, JPred employs general-purpose, off-the-shelf decision procedures to perform precise reasoning about predicates at compile time. As a result, JPred's type system allows several useful programming idioms that are spuriously rejected by prior languages.

Project Members

Chris Frost
Todd Millstein
Jason Ryder
Alessandro Warth


Expressive and Modular Predicate Dispatch for Java    (TOPLAS 2009)
        Todd Millstein, Christopher Frost, Jason Ryder, and Alessandro Warth

Modularly Typesafe Interface Dispatch in JPred  (FOOL/WOOD 2006)
        Christopher Frost and Todd Millstein

Practical Predicate Dispatch  (OOPSLA 2004)
        Todd Millstein


Download the JPred compiler. The compiler is implemented in Java, and both source and bytecode versions of the compiler are included.

An Eclipse plugin for the JPred compiler is available here.

The JPred compiler is implemented as an extension in the Polyglot extensible compiler framework. It extends the Polyglot for Java 1.5 extension, which allows Polyglot to support the Java 1.5 language features.

The TOPLAS 2009 paper above is currently the best documentation for the language.