I think I found a small bug in clojure.core/bases. Extending the
existing unit test reveals it:

(deftest test-bases
  (are [x y] (= x y)
      (bases java.lang.Math)
        (list java.lang.Object)
      (bases java.lang.Integer)
        (list java.lang.Number java.lang.Comparable) )
    (is (seq? (bases java.util.List))))

Test output is:

FAIL in (test-bases) (java_interop.clj:143)
expected: (seq? (bases java.util.List))
  actual: (not (seq? #<Class[] [Ljava.lang.Class;@363256a5>))

When calling bases on an inteface it returns an array. Should this not
be a seq?

An easy fix though, 'seq' the else part:

(defn bases
  "Returns the immediate superclass and direct interfaces of c, if any"
  {:added "1.0"
   :static true}
  [^Class c]
  (when c
    (let [i (.getInterfaces c)
          s (.getSuperclass c)]
      (not-empty
       (if s (cons s i) (seq i))))))

Should I file a bug, submit a pull request, or is the behavior intended?

Cheers,
Alf

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to