diff --git a/CHANGELOG.md b/CHANGELOG.md index 70f8e55b..f4b4d3e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,10 +9,13 @@ A preview of the next release can be installed from ## Unreleased -- [#1815](https://github.com/babashka/babashka/issues/1815): Make install-script wget-compatible +- [#1818](https://github.com/babashka/babashka/issues/1818): wrong argument order in `clojure.java.io/resource` implementation +- Add `java.text.BreakIterator` - Bump `fs` to `0.5.25` - Bump `jsoup` to `1.20.1` - Bump `edamame` to `1.4.30` +- [#1815](https://github.com/babashka/babashka/issues/1815): Make install-script wget-compatible ([@eval](https://github.com/eval)) + ## 1.12.200 (2025-04-26) diff --git a/src/babashka/impl/classes.clj b/src/babashka/impl/classes.clj index a7bda5e9..129e15ff 100644 --- a/src/babashka/impl/classes.clj +++ b/src/babashka/impl/classes.clj @@ -435,6 +435,7 @@ java.text.ParsePosition ;; adds about 200kb, same functionality provided by java.time: java.text.SimpleDateFormat + java.text.BreakIterator ~@(when features/java-time? `[java.time.format.DateTimeFormatter java.time.Clock @@ -824,6 +825,8 @@ (and thread-builder (instance? thread-builder v)) thread-builder + (instance? java.text.BreakIterator v) + java.text.BreakIterator ;; keep commas for merge friendliness ,)] ;; (prn :res res) diff --git a/src/babashka/impl/classpath.clj b/src/babashka/impl/classpath.clj index 6da8b59f..55597802 100644 --- a/src/babashka/impl/classpath.clj +++ b/src/babashka/impl/classpath.clj @@ -84,8 +84,8 @@ cp))) (defn resource - (^URL [path] (resource @the-url-loader path)) - (^URL [loader path] + (^URL [path] (resource path @the-url-loader)) + (^URL [path loader] (if (str/starts-with? path "/") nil ;; non-relative paths always return nil (getResource loader [path] true)))) diff --git a/src/babashka/main.clj b/src/babashka/main.clj index 9a8c554d..82a4eb2f 100644 --- a/src/babashka/main.clj +++ b/src/babashka/main.clj @@ -1193,7 +1193,7 @@ Use bb run --help to show this help output. (println "[babashka] WARNING: config file does not exist:" config)) nil)) jar (let [jar (resolve-symbolic-link jar)] - (some-> [jar] cp/new-loader (cp/resource "META-INF/bb.edn") .toString)) + (some->> [jar] cp/new-loader (cp/resource "META-INF/bb.edn") .toString)) :else (if (and file (fs/exists? file)) ;; file relative to bb.edn (let [file (abs-path file) ;; follow symlink diff --git a/test/babashka/interop_test.clj b/test/babashka/interop_test.clj index e10f8d09..8ea97b6b 100644 --- a/test/babashka/interop_test.clj +++ b/test/babashka/interop_test.clj @@ -250,3 +250,19 @@ (is (nil? (bb nil "(import '(java.util.concurrent Executors ExecutorService)) (let [fut (.submit ^ExecutorService (Executors/newCachedThreadPool) ^Runnable (fn [] 3))] (.get fut))")))) + +(deftest break-iterator-test + (is (= 1 (bb nil "(ns dude + (:import [java.text BreakIterator])) + +(defn count-characters + [^String text] + (let [it (BreakIterator/getCharacterInstance)] + (.setText it text) + (loop [count 0] + (if (= (.next it) BreakIterator/DONE) + count + (recur (inc count)))))) + +(prn + (count-characters \"🇨🇦\"))"))))