Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ SCI is used in [babashka](https://github.com/babashka/babashka),

## Unreleased

- Fix interop with a `false` argument: `(Boolean. false)` picked the `String` overload
- Caches resolved JVM instance methods per call site for performance
- Fix [babashka#2030](https://github.com/babashka/babashka/issues/2030): `aset` on a primitive array was reflective and 170x slower than `aset-double`
- Bump edamame to `1.6.43`
Expand Down
2 changes: 1 addition & 1 deletion src/sci/impl/reflector.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
(if (and (nil? t) (some? arg))
(.getClass ^Object arg)
t))
(when arg (.getClass ^Object arg)))
(when-some [a arg] (.getClass ^Object a)))
param-type (aget params i)]
(if (param-arg-type-match? param-type arg-type)
(recur (inc i))
Expand Down
9 changes: 9 additions & 0 deletions test/sci/interop_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@
(is (= "dude" (eval* "(String. (str \"dude\"))")))
(is (= "dude" (eval* "(new String (str \"dude\"))")))))

#?(:clj
(deftest false-arg-overload-test
(testing "false picks the boolean overload, not a reference one"
(is (= ["false" "true"] (eval* "[(String/valueOf false) (String/valueOf true)]")))
(when-not tu/native?
(is (= [false false false]
(tu/eval* "[(Boolean. false) (Boolean/valueOf false) (Boolean/logicalAnd true false)]"
{:classes {'Boolean Boolean}})))))))

#?(:clj
(deftest import-test
(is (true? (eval* "(class? (import clojure.lang.ExceptionInfo))")))
Expand Down
Loading