Skip to content

Commit bd8149b

Browse files
committed
Merge branch 'fix-reflection-warnings'
2 parents e7175f1 + d5f1f3a commit bd8149b

File tree

5 files changed

+16
-15
lines changed

5 files changed

+16
-15
lines changed

src/cider/nrepl/middleware/content_type.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
[cider.nrepl.middleware.slurp :refer [slurp-reply]])
4747
(:import
4848
java.awt.Image
49+
[java.awt.image RenderedImage]
4950
[java.io ByteArrayOutputStream File OutputStream]
5051
[java.net URI URL]
5152
java.nio.file.Path
@@ -94,7 +95,7 @@
9495
(assoc response
9596
:content-type ["message/external-body"
9697
{"access-type" "URL"
97-
"URL" (.toString (as-url value))}]
98+
"URL" (.toString ^URL (as-url value))}]
9899
:body "")
99100

100101
;; FIXME (arrdem 2018-04-03):
@@ -107,7 +108,7 @@
107108
(instance? java.awt.Image value)
108109
(with-open [bos (ByteArrayOutputStream.)]
109110
(merge response
110-
(when (ImageIO/write ^Image value "png" ^OutputStream bos)
111+
(when (ImageIO/write ^RenderedImage value "png" ^OutputStream bos)
111112
(slurp-reply "" ["image/png" {}] (.toByteArray bos)))))
112113

113114
:else response))

src/cider/nrepl/middleware/debug.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
[]
6868
(letfn [(hex [] (format "%x" (rand-int 15)))
6969
(nhex [n] (apply str (repeatedly n hex)))]
70-
(let [rhex (format "%x" (bit-or 0x8 (bit-and 0x3 (rand-int 14))))]
70+
(let [rhex (format "%x" (bit-or 0x8 (bit-and 0x3 ^int (rand-int 14))))]
7171
(str (nhex 8) "-" (nhex 4) "-4" (nhex 3)
7272
"-" rhex (nhex 3) "-" (nhex 12)))))
7373

@@ -140,7 +140,7 @@
140140
(if (map? *msg*)
141141
(do
142142
(transport/send (:transport *msg*) (response-for *msg* :value 'QUIT))
143-
(.stop (:thread (meta (:session *msg*)))))
143+
(.stop ^Thread (:thread (meta (:session *msg*)))))
144144
;; We can't really abort if there's no *msg*, so we do our best
145145
;; impression of that. This is only used in some panic situations,
146146
;; the user won't be offered the :quit option if there's no *msg*.
@@ -381,7 +381,7 @@ this map (identified by a key), and will `dissoc` it afterwards."}
381381
(throw (ex-info "Invalid input from `read-debug-input`."
382382
{:response-raw response-raw})))))))
383383

384-
(defn print-step-indented [depth form value]
384+
(defn print-step-indented [^long depth form value]
385385
(print (apply str (repeat (dec depth) "| ")))
386386
(binding [*print-length* 4
387387
*print-level* 2]

src/cider/nrepl/middleware/slurp.clj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
[nrepl.misc :refer [response-for]]
1212
[nrepl.transport :as transport])
1313
(:import
14-
(java.io ByteArrayOutputStream)
15-
(java.net MalformedURLException URL)
14+
(java.io ByteArrayOutputStream InputStream)
15+
(java.net MalformedURLException URL URLConnection)
1616
(java.nio.file Files Path Paths)
1717
(java.util Base64)))
1818

@@ -61,7 +61,7 @@
6161
[^bytes buff]
6262
(.encodeToString (Base64/getEncoder) buff))
6363

64-
(defn slurp-reply [location content-type buff]
64+
(defn slurp-reply [location content-type ^bytes buff]
6565
(let [^String real-type (first content-type)
6666
binary? (= "application/octet-stream" real-type)
6767
text? (.contains real-type "text")]
@@ -82,21 +82,21 @@
8282
(defn slurp-url-to-content+body
8383
"Attempts to parse and then to slurp a URL, producing a content-typed response."
8484
[url-str]
85-
(if-let [url (try (URL. url-str)
86-
(catch MalformedURLException e nil))]
85+
(if-let [^URL url (try (URL. url-str)
86+
(catch MalformedURLException e nil))]
8787
(if (= (.getProtocol url) "file") ;; expected common case
8888
(let [^Path p (Paths/get (.toURI url))
8989
content-type (normalize-content-type (get-file-content-type p))
9090
buff (Files/readAllBytes p)]
9191
(slurp-reply p content-type buff))
9292

9393
;; It's not a file, so just try to open it on up
94-
(let [conn (.openConnection url)
94+
(let [^URLConnection conn (.openConnection url)
9595
content-type (normalize-content-type
9696
(.getContentType conn))
9797
;; FIXME (arrdem 2018-04-03):
9898
;; There's gotta be a better way here
99-
is (.getInputStream conn)
99+
^InputStream is (.getInputStream conn)
100100
os (ByteArrayOutputStream.)]
101101
(loop []
102102
(let [b (.read is)]

src/cider/nrepl/middleware/util/instrument.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@
252252
[x y]
253253
(if (seq x)
254254
(if (seq y)
255-
(let [fa (first x)
256-
fb (first y)]
255+
(let [^int fa (first x)
256+
^int fb (first y)]
257257
(if (= fa fb)
258258
(recur (rest x) (rest y))
259259
(< fa fb)))

src/cider/nrepl/print_method.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
;;; Agents, futures, delays, promises, etc
7575
(defn- deref-name [c]
7676
(let [class-name (translate-class-name c)]
77-
(if-let [[_ short-name] (re-find #"^clojure\.lang\.([^.]+)" class-name)]
77+
(if-let [[_ ^String short-name] (re-find #"^clojure\.lang\.([^.]+)" class-name)]
7878
(.toLowerCase short-name)
7979
(case (second (re-find #"^clojure\.core/(.+)/reify" class-name))
8080
"future-call" "future"

0 commit comments

Comments
 (0)