From b569b6fae2f912e2feadd06a3b49d448f114cc3d Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 10 Oct 2024 20:21:24 +0200 Subject: [PATCH] yeah --- .../native-image/babashka/babashka/proxy-config.json | 10 ++++++++++ test/babashka/interop_test.clj | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/resources/META-INF/native-image/babashka/babashka/proxy-config.json b/resources/META-INF/native-image/babashka/babashka/proxy-config.json index 1b8f3b05..d204a8bb 100644 --- a/resources/META-INF/native-image/babashka/babashka/proxy-config.json +++ b/resources/META-INF/native-image/babashka/babashka/proxy-config.json @@ -17,5 +17,15 @@ "interfaces": [ "java.nio.file.DirectoryStream$Filter" ] + }, + { + "interfaces": [ + "java.util.function.Supplier" + ] + }, + { + "interfaces": [ + "java.util.function.UnaryOperator" + ] } ] diff --git a/test/babashka/interop_test.clj b/test/babashka/interop_test.clj index 4a8a57da..645dac01 100644 --- a/test/babashka/interop_test.clj +++ b/test/babashka/interop_test.clj @@ -69,4 +69,9 @@ (is (true? (bb nil "(= [1 3] (into [] (doto (java.util.ArrayList. [1 2 3]) (.removeIf even?))))"))) (is (true? (bb nil "(= \"abcabc\" (.computeIfAbsent (java.util.HashMap.) \"abc\" #(str % %)))"))) (is (true? (bb nil "(= '(\\9) (-> \"a9-\" seq .stream (.filter Character/isDigit) stream-seq!))"))) - ) + (is (true? (bb nil "(require (quote [clojure.java.io :as jio])) (import [java.io File] [java.nio.file Path Files DirectoryStream$Filter]) (pos? (count (seq (Files/newDirectoryStream (.toPath (jio/file \".\")) + #(-> ^Path % .toFile .isDirectory)))))"))) + (is (true? (bb nil "(import [java.util Collection] [java.util.stream Stream] [java.util.function Predicate]) + (= '(100 100 100 100 100) (->> (Stream/generate (constantly 100)) stream-seq! (take 5)))"))) + (is (true? (bb nil "(import [java.util Collection] [java.util.stream Stream] [java.util.function Predicate]) + (= '(1 2 3 4 5 6 7 8 9 10) (->> (Stream/iterate 1 inc) stream-seq! (take 10)))"))))