Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

mostly eliminate reflective calls, fixes NREPL-35

  • Loading branch information...
commit ac95dc7da973f3d7edea75d0f6f9ce01ee18641d 1 parent 87b1770
Chas Emerick cemerick authored
2  src/main/clojure/clojure/tools/nrepl.clj
View
@@ -172,7 +172,7 @@
{:pre [transport-fn port]}
(transport-fn (java.net.Socket. ^String host (int port))))
-(defn- to-uri
+(defn- ^java.net.URI to-uri
[x]
{:post [(instance? java.net.URI %)]}
(if (string? x)
4 src/main/clojure/clojure/tools/nrepl/helpers.clj
View
@@ -33,11 +33,11 @@
(load-file-command \"…code here…\" \"some/ns/name/file.clj\" \"file.clj\")"
([f] (load-file-command f nil))
([f source-root]
- (let [abspath (if (string? f) f (.getAbsolutePath f))
+ (let [^String abspath (if (string? f) f (.getAbsolutePath ^File f))
source-root (cond
(nil? source-root) ""
(string? source-root) source-root
- (instance? File source-root) (.getAbsolutePath source-root))]
+ (instance? File source-root) (.getAbsolutePath ^File source-root))]
(load-file-command (slurp abspath :encoding "UTF-8")
(if (and (seq source-root)
(.startsWith abspath source-root))
12 src/main/clojure/clojure/tools/nrepl/middleware/interruptible_eval.clj
View
@@ -8,10 +8,8 @@
(:import clojure.lang.LineNumberingPushbackReader
(java.io StringReader Writer)
java.util.concurrent.atomic.AtomicLong
- (java.util.concurrent LinkedBlockingQueue
- SynchronousQueue
- TimeUnit ThreadPoolExecutor
- ThreadFactory)))
+ (java.util.concurrent Executor LinkedBlockingQueue ThreadFactory
+ SynchronousQueue TimeUnit ThreadPoolExecutor)))
(def ^{:dynamic true
:doc "The message currently being evaluated."}
@@ -52,7 +50,7 @@
:read (if (string? code)
(let [reader (LineNumberingPushbackReader. (StringReader. code))]
#(read reader false %2))
- (let [code (.iterator code)]
+ (let [^java.util.Iterator code (.iterator code)]
#(or (and (.hasNext code) (.next code)) %2)))
:prompt (fn [])
:need-prompt (constantly false)
@@ -124,7 +122,7 @@
(declare run-next)
(defn- run-next*
- [session executor]
+ [session ^Executor executor]
(let [qa (-> session meta :queue)]
(loop []
(let [q @qa
@@ -143,7 +141,7 @@
(defn- queue-eval
"Queues the function for the given session."
- [session executor f]
+ [session ^Executor executor f]
(let [qa (-> session prep-session meta :queue)]
(loop []
(let [q @qa]
4 src/main/clojure/clojure/tools/nrepl/middleware/session.clj
View
@@ -30,7 +30,7 @@
(let [buf (clojure.tools.nrepl.StdOutBuffer.)]
(PrintWriter. (proxy [Writer] []
(close [] (.flush ^Writer this))
- (write [& [x off len]]
+ (write [& [x ^Integer off ^Integer len]]
(locking buf
(cond
(number? x) (.append buf (char x))
@@ -199,7 +199,7 @@
(h msg))
(= op "stdin")
(do
- (-> session meta ^Writer (:stdin-writer) (.write stdin))
+ (-> session meta ^Writer (:stdin-writer) (.write ^String stdin))
(t/send transport (response-for msg :status :done)))
:else
(h msg))))
2  src/main/clojure/clojure/tools/nrepl/misc.clj
View
@@ -14,7 +14,7 @@
msgs (if ex msgs (cons ex msgs))]
(binding [*out* *err*]
(apply println "ERROR:" msgs)
- (when ex (.printStackTrace ex)))))))
+ (when ex (.printStackTrace ^Throwable ex)))))))
(defmacro returning
"Executes `body`, returning `x`."
Please sign in to comment.
Something went wrong with that request. Please try again.