Permalink
Browse files

TRDR-6: Eliminate reflection in tools.reader via type hints

Signed-off-by: Bronsa <brobronsa@gmail.com>
  • Loading branch information...
1 parent e27e1ec commit 1beaf845da2a3965c05c2c19e7b5297c5d59acbb @jafingerhut jafingerhut committed with Bronsa Apr 13, 2013
@@ -160,7 +160,7 @@ with invalid arguments."
;;; ------------------------------------------------------------------------
;;; print integration
-(def ^:private thread-local-utc-date-format
+(def ^:private ^ThreadLocal thread-local-utc-date-format
;; SimpleDateFormat is not thread-safe, so we use a ThreadLocal proxy for access.
;; http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4228335
(proxy [ThreadLocal] []
@@ -174,7 +174,7 @@ with invalid arguments."
[^java.util.Date d, ^java.io.Writer w]
(let [utc-format (.get thread-local-utc-date-format)]
(.write w "#inst \"")
- (.write w (.format utc-format d))
+ (.write w ^String (.format ^java.text.SimpleDateFormat utc-format d))
(.write w "\"")))
(defmethod print-method java.util.Date
@@ -206,7 +206,7 @@ with invalid arguments."
(print-calendar c w))
-(def ^:private thread-local-utc-timestamp-format
+(def ^:private ^ThreadLocal thread-local-utc-timestamp-format
;; SimpleDateFormat is not thread-safe, so we use a ThreadLocal proxy for access.
;; http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4228335
(proxy [ThreadLocal] []
@@ -219,7 +219,7 @@ with invalid arguments."
[^java.sql.Timestamp ts, ^java.io.Writer w]
(let [utc-format (.get thread-local-utc-timestamp-format)]
(.write w "#inst \"")
- (.write w (.format utc-format ts))
+ (.write w ^String (.format ^java.text.SimpleDateFormat utc-format ts))
;; add on nanos and offset
;; RFC3339 says to use -00:00 when the timezone is unknown (+00:00 implies a known GMT)
(.write w (format ".%09d-00:00" (.getNanos ts)))
@@ -175,12 +175,12 @@
(PushbackReader. (string-reader s) (object-array buf-len) buf-len buf-len)))
(defn input-stream-reader
- "Creates an InputStreamReader from an InputString"
+ "Creates an InputStreamReader from an InputStream"
[is]
(InputStreamReader. is nil))
(defn input-stream-push-back-reader
- "Creates a PushbackReader from a given InputString"
+ "Creates a PushbackReader from a given InputStream"
([is]
(input-stream-push-back-reader is 1))
([^InputStream is buf-len]

0 comments on commit 1beaf84

Please sign in to comment.