Skip to content

Commit 98996ba

Browse files
committed
Remove reflection warnings
1 parent a3cb965 commit 98996ba

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/kaocha/watch.clj

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
[lambdaisland.tools.namespace.track :as ctn-track]
2323
[slingshot.slingshot :refer [try+]]
2424
[nextjournal.beholder :as beholder])
25-
(:import (java.nio.file FileSystems Path)
25+
(:import (java.io File)
26+
(java.nio.file FileSystems Path PathMatcher)
2627
(java.util.concurrent ArrayBlockingQueue BlockingQueue)))
2728

2829
(defn make-queue []
@@ -96,7 +97,7 @@
9697
(assert (instance? Path path))
9798
(let [fs (FileSystems/getDefault)
9899
patterns (map #(.getPathMatcher fs (str "glob:" %)) patterns)]
99-
(some #(.matches % path) patterns)))
100+
(some #(.matches ^PathMatcher % path) patterns)))
100101

101102
(defn convert
102103
"Converts a Git-style ignore pattern into the equivalent pattern that Java PathMatcher uses."
@@ -154,7 +155,7 @@
154155
"Finds ignore files in the local directory and the system."
155156
[dir]
156157
(let [absolute-files [(io/file (str (System/getProperty "user.home") "/.config/git/ignore"))]
157-
relative-files (filter #(glob? (.toPath %) ["**.gitignore" "**.ignore"]) (file-seq (io/file dir)))]
158+
relative-files (filter #(glob? (.toPath ^File %) ["**.gitignore" "**.ignore"]) (file-seq (io/file dir)))]
158159
(into absolute-files relative-files)))
159160

160161
(defn merge-ignore-files
@@ -170,7 +171,7 @@
170171
(defn wait-and-rescan! [q tracker watch-paths ignore]
171172
(let [f (qtake q)]
172173
(cond
173-
(and (file? f) (glob? (.toPath f) ignore))
174+
(and (file? f) (glob? (.toPath ^File f) ignore))
174175
(recur q tracker watch-paths ignore)
175176

176177
(directory? f)
@@ -282,7 +283,7 @@ errors as test errors."
282283
(map io/file))
283284
(:kaocha/tests config))
284285
;; Without this, if any path doesn't exist the watching doesn't work.
285-
(filter (fn [x] (.exists ^java.io.File x)))))
286+
(filter (fn [x] (.exists ^File x)))))
286287

287288
(defmulti watch! :type)
288289

@@ -298,7 +299,7 @@ errors as test errors."
298299
(fn [{:keys [type path]}]
299300
(assert (instance? Path path))
300301
(when (contains? #{:modify :create} type)
301-
(qput q (.toFile path))))
302+
(qput q (.toFile ^Path path))))
302303
(map str watch-paths)))
303304

304305
(defn run* [config finish? q]
@@ -309,7 +310,7 @@ errors as test errors."
309310
{})
310311
watch-paths (if (:kaocha.watch/use-ignore-file config)
311312
(set/union (watch-paths config)
312-
(set (map #(.getParentFile (.getCanonicalFile %)) (find-ignore-files "."))))
313+
(set (map #(.getParentFile (.getCanonicalFile ^File %)) (find-ignore-files "."))))
313314
(watch-paths config))
314315
tracker (ctn-track/tracker)
315316
;; if t.n fails due to circular dependencies, do not track-reload.

0 commit comments

Comments
 (0)