<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -201,6 +201,10 @@
                       table cs)]
     (clojure.lang.MethodImplCache. (.protocol cache) (.methodk cache) shift mask table)))
 
+(defn- super-chain [#^Class c]
+  (when c
+    (cons c (super-chain (.getSuperclass c)))))
+
 (defn find-protocol-impl [protocol x]
   (if (and (:on protocol) (instance? (:on protocol) x))
     x
@@ -209,8 +213,9 @@
           impl #(get (:impls protocol) %)]
       (or (impl t)
           (impl c)
-          ;todo - better path,  how to prioritize supers vs interfaces?
-          (first (remove nil? (map impl (supers c))))))))
+          (first (remove nil? (map impl (butlast (super-chain c)))))
+          (first (remove nil? (map impl (disj (supers c) Object))))
+          (impl Object)))))
 
 (defn find-protocol-method [protocol methodk x]
   (get (find-protocol-impl protocol x) methodk))</diff>
      <filename>src/clj/clojure/core_deftype.clj</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>292836f87260fdb994d25a98ef65b4edebf9d09e</id>
    </parent>
  </parents>
  <author>
    <name>Rich Hickey</name>
    <email>richhickey@gmail.com</email>
  </author>
  <url>http://github.com/richhickey/clojure/commit/bebb1ff5cb80b863a3aba2ba21eaafc843f990da</url>
  <id>bebb1ff5cb80b863a3aba2ba21eaafc843f990da</id>
  <committed-date>2009-11-12T11:00:53-08:00</committed-date>
  <authored-date>2009-11-12T11:00:53-08:00</authored-date>
  <message>use hierarchy to determine impl given multiple extends in superclasses of target, now: target type, target class, superclasses (not interfaces) of target (in reverse derivation order, not including Object), interfaces (in arbitrary order for now), Object</message>
  <tree>cb55a1f5dc4ac375bc9610a042645b7ddf56a9f8</tree>
  <committer>
    <name>Rich Hickey</name>
    <email>richhickey@gmail.com</email>
  </committer>
</commit>
