Skip to content
Open
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
Fix reflection warnings
I'm seeing reflection warnings like:
```
Reflection warning, clj_diff/optimizations.clj:21:16 - call to method indexOf on java.lang.Object can't be resolved (no such method).
```
I think this should fix them.
  • Loading branch information
emlyn authored Dec 19, 2019
commit ff27062c3b4b45843af1d26b5b090fd28f8b6cbb
4 changes: 2 additions & 2 deletions src/clj/clj_diff/optimizations.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"Return a diff if the shorter sequence exists in the longer one. No need to
use the expensive diff algorithm for this."
[^String a ^String b ^Integer ca ^Integer cb]
(let [[short long] (if (> ca cb) [b a] [a b])
(let [[^String short ^String long] (if (> ca cb) [b a] [a b])
i (int (.indexOf long short))]
(if (= i -1)
nil
Expand All @@ -34,7 +34,7 @@
(range (+ i cb) ca)))}))))

(defn- half-match* [^String long ^String short ^Integer i]
(let [target (.substring long i (+ i (quot (count long) 4)))]
(let [^String target (.substring long i (+ i (quot (count long) 4)))]
(loop [j (.indexOf short target 0)
result []]
(if (= j -1)
Expand Down