Permalink
Browse files

Make sure the clojure.core/bases function always returns a seq.

Previously the function returned a clojure.lang.Cons when passed a class and a Java array when passed an interface. Expanded existing test to show that the changed code is correct.

Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
  • Loading branch information...
1 parent 9252893 commit 73f94cb8c7f60a131759b4488a3fefd6599d0328 @stoyle stoyle committed with stuarthalloway Aug 15, 2011
Showing with 4 additions and 2 deletions.
  1. +1 −1 src/clj/clojure/core.clj
  2. +3 −1 test/clojure/test_clojure/java_interop.clj
View
@@ -4918,7 +4918,7 @@
(let [i (.getInterfaces c)
s (.getSuperclass c)]
(not-empty
- (if s (cons s i) i)))))
+ (if s (cons s i) (seq i))))))
(defn supers
"Returns the immediate and indirect superclasses and interfaces of c, if any"
@@ -154,7 +154,9 @@
(bases java.lang.Math)
(list java.lang.Object)
(bases java.lang.Integer)
- (list java.lang.Number java.lang.Comparable) ))
+ (list java.lang.Number java.lang.Comparable)
+ (bases java.util.List)
+ (list java.util.Collection) ))
(deftest test-supers
(are [x y] (= x y)

0 comments on commit 73f94cb

Please sign in to comment.