摘要: Predicate dispatch is an object-oriented (OO) language mechanism for determining the method implementation to be invoked upon a message send. With predicate dispatch, each includes guard specifying conditions under which should invoked, and logical implication of predicates determines overriding relation. naturally unifies generalizes several common forms dynamic including traditional OO multimethod functional-style pattern matching. Unfortunately, prior languages supporting have had deficiencies that limit its utility in practice.We introduce JPred, backward-compatible extension Java dispatch. While with been extensions toy or non-mainstream languages, we show how can added language. required whole program available type-checking compilation, JPred retains Java's modular typechecking compilation strategies. included special-purpose algorithms reasoning about predicates, employs general-purpose, off-the-shelf decision procedures. As result, JPred's type system more flexible, allowing useful programming idioms are spuriously rejected by those other languages. After describing system, present case study illustrating real-world application, use detection errors.