Skip to content

Commit 73f94cb

Browse files
stoylestuarthalloway
authored andcommitted
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>
1 parent 9252893 commit 73f94cb

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/clj/clojure/core.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4918,7 +4918,7 @@
49184918
(let [i (.getInterfaces c)
49194919
s (.getSuperclass c)]
49204920
(not-empty
4921-
(if s (cons s i) i)))))
4921+
(if s (cons s i) (seq i))))))
49224922

49234923
(defn supers
49244924
"Returns the immediate and indirect superclasses and interfaces of c, if any"

test/clojure/test_clojure/java_interop.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@
154154
(bases java.lang.Math)
155155
(list java.lang.Object)
156156
(bases java.lang.Integer)
157-
(list java.lang.Number java.lang.Comparable) ))
157+
(list java.lang.Number java.lang.Comparable)
158+
(bases java.util.List)
159+
(list java.util.Collection) ))
158160

159161
(deftest test-supers
160162
(are [x y] (= x y)

0 commit comments

Comments
 (0)