mirror of
https://github.com/penpot/penpot.git
synced 2025-05-23 12:56:10 +02:00
✨ Fix many reflection warnings.
This commit is contained in:
parent
de233d6778
commit
f2cb2c3791
18 changed files with 79 additions and 57 deletions
|
@ -15,4 +15,4 @@
|
||||||
|
|
||||||
(defstate system
|
(defstate system
|
||||||
:start (vc/system)
|
:start (vc/system)
|
||||||
:stop (.close system))
|
:stop (vc/stop system))
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
(defmethod handle-exception :service-error
|
(defmethod handle-exception :service-error
|
||||||
[err req]
|
[err req]
|
||||||
(handle-exception (.getCause err) req))
|
(handle-exception (.getCause ^Throwable err) req))
|
||||||
|
|
||||||
(defmethod handle-exception :parse
|
(defmethod handle-exception :parse
|
||||||
[err req]
|
[err req]
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
[err req]
|
[err req]
|
||||||
(log/error "Unhandled exception on request:" (:path req) "\n"
|
(log/error "Unhandled exception on request:" (:path req) "\n"
|
||||||
(with-out-str
|
(with-out-str
|
||||||
(.printStackTrace err (java.io.PrintWriter. *out*))))
|
(.printStackTrace ^Throwable err (java.io.PrintWriter. *out*))))
|
||||||
{:status 500
|
{:status 500
|
||||||
:body {:type :exception
|
:body {:type :exception
|
||||||
:message (ex-message err)
|
:message (ex-message err)
|
||||||
|
@ -66,5 +66,5 @@
|
||||||
[error req]
|
[error req]
|
||||||
(if (or (instance? java.util.concurrent.CompletionException error)
|
(if (or (instance? java.util.concurrent.CompletionException error)
|
||||||
(instance? java.util.concurrent.ExecutionException error))
|
(instance? java.util.concurrent.ExecutionException error))
|
||||||
(handle-exception (.getCause error) req)
|
(handle-exception (.getCause ^Throwable error) req)
|
||||||
(handle-exception error req)))
|
(handle-exception error req)))
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
;; --- Task Execution
|
;; --- Task Execution
|
||||||
|
|
||||||
(defn- string-strack-trace
|
(defn- string-strack-trace
|
||||||
[err]
|
[^Throwable err]
|
||||||
(with-out-str
|
(with-out-str
|
||||||
(.printStackTrace err (java.io.PrintWriter. *out*))))
|
(.printStackTrace err (java.io.PrintWriter. *out*))))
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
(decode-v1 data udata-len)))))
|
(decode-v1 data udata-len)))))
|
||||||
|
|
||||||
(defn- decode-v1
|
(defn- decode-v1
|
||||||
[data udata-len]
|
[^bytes data udata-len]
|
||||||
(let [^bytes output-ba (byte-array udata-len)]
|
(let [^bytes output-ba (byte-array udata-len)]
|
||||||
(Snappy/uncompress data 6 (- (alength data) 6) output-ba 0)
|
(Snappy/uncompress data 6 (- (alength data) 6) output-ba 0)
|
||||||
(t/decode output-ba {:type :json})))
|
(t/decode output-ba {:type :json})))
|
||||||
|
|
|
@ -100,7 +100,8 @@
|
||||||
f `(fn ~args ~@body)]
|
f `(fn ~args ~@body)]
|
||||||
`(do
|
`(do
|
||||||
(s/assert dispatcher? ~sym)
|
(s/assert dispatcher? ~sym)
|
||||||
(.add ~sym ~key ~f ~meta)
|
(.add ~(with-meta sym {:tag 'uxbox.util.dispatcher.IDispatcher})
|
||||||
|
~key ~f ~meta)
|
||||||
~sym)))
|
~sym)))
|
||||||
|
|
||||||
(def spec-interceptor
|
(def spec-interceptor
|
||||||
|
|
|
@ -17,8 +17,13 @@
|
||||||
io.vertx.core.AsyncResult
|
io.vertx.core.AsyncResult
|
||||||
io.vertx.core.buffer.Buffer
|
io.vertx.core.buffer.Buffer
|
||||||
io.vertx.pgclient.PgPool
|
io.vertx.pgclient.PgPool
|
||||||
|
io.vertx.pgclient.PgConnection
|
||||||
io.vertx.sqlclient.impl.ArrayTuple
|
io.vertx.sqlclient.impl.ArrayTuple
|
||||||
|
io.vertx.sqlclient.SqlClient
|
||||||
io.vertx.sqlclient.RowSet
|
io.vertx.sqlclient.RowSet
|
||||||
|
io.vertx.sqlclient.Row
|
||||||
|
io.vertx.sqlclient.Tuple
|
||||||
|
io.vertx.sqlclient.Transaction
|
||||||
io.vertx.sqlclient.PoolOptions))
|
io.vertx.sqlclient.PoolOptions))
|
||||||
|
|
||||||
(declare impl-execute)
|
(declare impl-execute)
|
||||||
|
@ -79,10 +84,10 @@
|
||||||
(p/map first (apply query args)))
|
(p/map first (apply query args)))
|
||||||
|
|
||||||
(defn row->map
|
(defn row->map
|
||||||
[row]
|
[^Row row]
|
||||||
(reduce (fn [acc index]
|
(reduce (fn [acc index]
|
||||||
(let [cname (.getColumnName row index)]
|
(let [cname (.getColumnName row index)]
|
||||||
(assoc acc cname (.getValue row index))))
|
(assoc acc cname (.getValue row ^int index))))
|
||||||
{}
|
{}
|
||||||
(range (.size row))))
|
(range (.size row))))
|
||||||
|
|
||||||
|
@ -102,18 +107,21 @@
|
||||||
[resolve reject]
|
[resolve reject]
|
||||||
(reify Handler
|
(reify Handler
|
||||||
(handle [_ ar]
|
(handle [_ ar]
|
||||||
(if (.failed ar)
|
(if (.failed ^AsyncResult ar)
|
||||||
(reject (.cause ar))
|
(reject (.cause ^AsyncResult ar))
|
||||||
(resolve (.result ar))))))
|
(resolve (.result ^AsyncResult ar))))))
|
||||||
|
|
||||||
(defn- impl-execute
|
(defn- impl-execute
|
||||||
[conn sql params]
|
[^SqlClient conn ^String sql params]
|
||||||
(if (seq params)
|
(if (seq params)
|
||||||
(p/create #(.preparedQuery conn sql (seqable->tuple params) (impl-handler %1 %2)))
|
(p/create #(.preparedQuery conn sql
|
||||||
(p/create #(.query conn sql (impl-handler %1 %2)))))
|
^Tuple (seqable->tuple params)
|
||||||
|
^Handler (impl-handler %1 %2)))
|
||||||
|
(p/create #(.query conn sql
|
||||||
|
^Handler (impl-handler %1 %2)))))
|
||||||
|
|
||||||
(defn- impl-query
|
(defn- impl-query
|
||||||
[conn sql params {:keys [xfm] :as opts}]
|
[^SqlClient conn ^String sql params {:keys [xfm] :as opts}]
|
||||||
(let [conn (if (instance? IDeref conn) @conn conn)]
|
(let [conn (if (instance? IDeref conn) @conn conn)]
|
||||||
(-> (impl-execute conn sql params)
|
(-> (impl-execute conn sql params)
|
||||||
(p/catch (fn [err]
|
(p/catch (fn [err]
|
||||||
|
@ -126,11 +134,11 @@
|
||||||
(defn impl-transact
|
(defn impl-transact
|
||||||
[pool f]
|
[pool f]
|
||||||
(let [pool (if (instance? IDeref pool) @pool pool)]
|
(let [pool (if (instance? IDeref pool) @pool pool)]
|
||||||
(letfn [(commit [tx]
|
(letfn [(commit [^Transaction tx]
|
||||||
(p/create #(.commit tx (impl-handler %1 %2))))
|
(p/create #(.commit tx (impl-handler %1 %2))))
|
||||||
(rollback [tx]
|
(rollback [^Transaction tx]
|
||||||
(p/create #(.rollback tx (impl-handler %1 %2))))
|
(p/create #(.rollback tx (impl-handler %1 %2))))
|
||||||
(on-connect [conn]
|
(on-connect [^PgConnection conn]
|
||||||
(let [tx (.begin conn)
|
(let [tx (.begin conn)
|
||||||
df (p/deferred)]
|
df (p/deferred)]
|
||||||
(-> (f conn)
|
(-> (f conn)
|
||||||
|
@ -147,6 +155,6 @@
|
||||||
(p/reject! df e')
|
(p/reject! df e')
|
||||||
(p/resolve! df v)))))))))
|
(p/resolve! df v)))))))))
|
||||||
df))]
|
df))]
|
||||||
(-> (p/create #(.getConnection pool (impl-handler %1 %2)))
|
(-> (p/create #(.getConnection ^PgPool pool (impl-handler %1 %2)))
|
||||||
(p/bind on-connect)))))
|
(p/bind on-connect)))))
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
path))
|
path))
|
||||||
|
|
||||||
(defn blob
|
(defn blob
|
||||||
[v]
|
[^String v]
|
||||||
(let [data (.getBytes v "UTF-8")]
|
(let [data (.getBytes v "UTF-8")]
|
||||||
(ByteArrayInputStream. ^bytes data)))
|
(ByteArrayInputStream. ^bytes data)))
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@
|
||||||
(def ^:private prng
|
(def ^:private prng
|
||||||
(delay
|
(delay
|
||||||
(doto (java.security.SecureRandom/getInstance "SHA1PRNG")
|
(doto (java.security.SecureRandom/getInstance "SHA1PRNG")
|
||||||
(.setSeed (sodi.prng/random-bytes 64)))))
|
(.setSeed ^bytes (sodi.prng/random-bytes 64)))))
|
||||||
|
|
||||||
(defn random-path
|
(defn random-path
|
||||||
[^Path path]
|
[^Path path]
|
||||||
|
|
|
@ -41,13 +41,13 @@
|
||||||
""))))
|
""))))
|
||||||
|
|
||||||
(or (vector? x) (list? x))
|
(or (vector? x) (list? x))
|
||||||
(java.util.ArrayList. x)
|
(java.util.ArrayList. ^java.util.List x)
|
||||||
|
|
||||||
(map? x)
|
(map? x)
|
||||||
(java.util.HashMap. x)
|
(java.util.HashMap. ^java.util.Map x)
|
||||||
|
|
||||||
(set? x)
|
(set? x)
|
||||||
(java.util.HashSet. x)
|
(java.util.HashSet. ^java.util.Set x)
|
||||||
|
|
||||||
:else
|
:else
|
||||||
x))
|
x))
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
(let [context (adapt-context context)
|
(let [context (adapt-context context)
|
||||||
template (.compile +mustache-factory+ path)]
|
template (.compile +mustache-factory+ path)]
|
||||||
(with-out-str
|
(with-out-str
|
||||||
(let [scope (HashMap. (walk/stringify-keys context))]
|
(let [scope (HashMap. ^java.util.Map (walk/stringify-keys context))]
|
||||||
(.execute ^Mustache template *out* scope))))
|
(.execute ^Mustache template *out* scope))))
|
||||||
(catch Exception cause
|
(catch Exception cause
|
||||||
(ex/raise :type :internal
|
(ex/raise :type :internal
|
||||||
|
|
|
@ -6,12 +6,14 @@
|
||||||
|
|
||||||
(ns uxbox.util.time
|
(ns uxbox.util.time
|
||||||
(:require
|
(:require
|
||||||
|
[clojure.spec.alpha :as s]
|
||||||
[uxbox.common.exceptions :as ex]
|
[uxbox.common.exceptions :as ex]
|
||||||
[cognitect.transit :as t])
|
[cognitect.transit :as t])
|
||||||
(:import
|
(:import
|
||||||
java.time.Instant
|
java.time.Instant
|
||||||
java.time.OffsetDateTime
|
java.time.OffsetDateTime
|
||||||
java.time.Duration
|
java.time.Duration
|
||||||
|
java.util.Date
|
||||||
org.apache.logging.log4j.core.util.CronExpression))
|
org.apache.logging.log4j.core.util.CronExpression))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@ -161,13 +163,18 @@
|
||||||
[v]
|
[v]
|
||||||
(instance? CronExpression v))
|
(instance? CronExpression v))
|
||||||
|
|
||||||
|
(defn next-valid-instant-from
|
||||||
|
[^CronExpression cron ^Instant now]
|
||||||
|
(s/assert cron? cron)
|
||||||
|
(.toInstant (.getNextValidTimeAfter cron (Date/from now))))
|
||||||
|
|
||||||
(defmethod print-method CronExpression
|
(defmethod print-method CronExpression
|
||||||
[mv ^java.io.Writer writer]
|
[mv ^java.io.Writer writer]
|
||||||
(.write writer (str "#uxbox/cron \"" (.toString mv) "\"")))
|
(.write writer (str "#uxbox/cron \"" (.toString ^CronExpression mv) "\"")))
|
||||||
|
|
||||||
(defmethod print-dup CronExpression
|
(defmethod print-dup CronExpression
|
||||||
[o w]
|
[o w]
|
||||||
(print-ctor o (fn [o w] (print-dup (.toString o) w)) w))
|
(print-ctor o (fn [o w] (print-dup (.toString ^CronExpression o) w)) w))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Serialization
|
;; Serialization
|
||||||
|
@ -178,12 +185,12 @@
|
||||||
(def ^:private instant-write-handler
|
(def ^:private instant-write-handler
|
||||||
(t/write-handler
|
(t/write-handler
|
||||||
(constantly "m")
|
(constantly "m")
|
||||||
(fn [v] (str (.toEpochMilli v)))))
|
(fn [v] (str (.toEpochMilli ^Instant v)))))
|
||||||
|
|
||||||
(def ^:private offset-datetime-write-handler
|
(def ^:private offset-datetime-write-handler
|
||||||
(t/write-handler
|
(t/write-handler
|
||||||
(constantly "m")
|
(constantly "m")
|
||||||
(fn [v] (str (.toEpochMilli (.toInstant v))))))
|
(fn [v] (str (.toEpochMilli (.toInstant ^OffsetDateTime v))))))
|
||||||
|
|
||||||
(def ^:private read-handler
|
(def ^:private read-handler
|
||||||
(t/read-handler
|
(t/read-handler
|
||||||
|
@ -199,7 +206,7 @@
|
||||||
|
|
||||||
(defmethod print-method Instant
|
(defmethod print-method Instant
|
||||||
[mv ^java.io.Writer writer]
|
[mv ^java.io.Writer writer]
|
||||||
(.write writer (str "#instant \"" (.toString mv) "\"")))
|
(.write writer (str "#instant \"" (.toString ^Instant mv) "\"")))
|
||||||
|
|
||||||
(defmethod print-dup Instant [o w]
|
(defmethod print-dup Instant [o w]
|
||||||
(print-method o w))
|
(print-method o w))
|
||||||
|
|
6
backend/vendor/sodi/src/sodi/prng.clj
vendored
6
backend/vendor/sodi/src/sodi/prng.clj
vendored
|
@ -23,7 +23,7 @@
|
||||||
iv/salt or arbitrary length."
|
iv/salt or arbitrary length."
|
||||||
([^long numbytes]
|
([^long numbytes]
|
||||||
(let [buffer (byte-array numbytes)]
|
(let [buffer (byte-array numbytes)]
|
||||||
(.nextBytes rng buffer)
|
(.nextBytes ^SecureRandom rng buffer)
|
||||||
buffer))
|
buffer))
|
||||||
([^SecureRandom rng ^long numbytes]
|
([^SecureRandom rng ^long numbytes]
|
||||||
(let [buffer (byte-array numbytes)]
|
(let [buffer (byte-array numbytes)]
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
generator. The minimum value is 8 bytes, and recommended
|
generator. The minimum value is 8 bytes, and recommended
|
||||||
minimum value is 32."
|
minimum value is 32."
|
||||||
[^long numbytes]
|
[^long numbytes]
|
||||||
(let [buffer (ByteBuffer/allocate numbytes)]
|
(let [^ByteBuffer buffer (ByteBuffer/allocate numbytes)]
|
||||||
(.putLong buffer (System/currentTimeMillis))
|
(.putLong buffer (System/currentTimeMillis))
|
||||||
(.put buffer (random-bytes (.remaining buffer)))
|
(.put buffer ^bytes (random-bytes (.remaining buffer)))
|
||||||
(.array buffer)))
|
(.array buffer)))
|
||||||
|
|
2
backend/vendor/sodi/src/sodi/pwhash.clj
vendored
2
backend/vendor/sodi/src/sodi/pwhash.clj
vendored
|
@ -51,7 +51,7 @@
|
||||||
[{:keys [alg password salt cpucost] :as options}]
|
[{:keys [alg password salt cpucost] :as options}]
|
||||||
(let [salt (or salt (rng/random-bytes 16))
|
(let [salt (or salt (rng/random-bytes 16))
|
||||||
cpucost (or cpucost 50000)
|
cpucost (or cpucost 50000)
|
||||||
pwd (.toCharArray password)
|
pwd (.toCharArray ^String password)
|
||||||
spec (PBEKeySpec. pwd salt cpucost 512)
|
spec (PBEKeySpec. pwd salt cpucost 512)
|
||||||
skf (SecretKeyFactory/getInstance "PBKDF2WithHmacSHA256")
|
skf (SecretKeyFactory/getInstance "PBKDF2WithHmacSHA256")
|
||||||
hash (.getEncoded (.generateSecret skf spec))]
|
hash (.getEncoded (.generateSecret skf spec))]
|
||||||
|
|
12
backend/vendor/vertx/src/vertx/core.clj
vendored
12
backend/vendor/vertx/src/vertx/core.clj
vendored
|
@ -45,6 +45,10 @@
|
||||||
(vxe/configure! vsm opts)
|
(vxe/configure! vsm opts)
|
||||||
vsm)))
|
vsm)))
|
||||||
|
|
||||||
|
(defn stop
|
||||||
|
[^Vertx o]
|
||||||
|
(.close o))
|
||||||
|
|
||||||
(defn get-or-create-context
|
(defn get-or-create-context
|
||||||
[vsm]
|
[vsm]
|
||||||
(.getOrCreateContext ^Vertx (vu/resolve-system vsm)))
|
(.getOrCreateContext ^Vertx (vu/resolve-system vsm)))
|
||||||
|
@ -64,7 +68,7 @@
|
||||||
(reify Handler
|
(reify Handler
|
||||||
(handle [_ prm]
|
(handle [_ prm]
|
||||||
(try
|
(try
|
||||||
(.resolve ^Promise prm (apply f args))
|
(.complete ^Promise prm (apply f args))
|
||||||
(catch Throwable e
|
(catch Throwable e
|
||||||
(.fail ^Promise prm e)))))
|
(.fail ^Promise prm e)))))
|
||||||
false
|
false
|
||||||
|
@ -191,7 +195,7 @@
|
||||||
(p/handle (fn [state error]
|
(p/handle (fn [state error]
|
||||||
(if error
|
(if error
|
||||||
(do
|
(do
|
||||||
(.fail o error)
|
(.fail o ^Throwable error)
|
||||||
(on-error @ctx error))
|
(on-error @ctx error))
|
||||||
(do
|
(do
|
||||||
(when (map? state)
|
(when (map? state)
|
||||||
|
@ -202,7 +206,7 @@
|
||||||
(fn [_ err]
|
(fn [_ err]
|
||||||
(if err
|
(if err
|
||||||
(do (on-error err)
|
(do (on-error err)
|
||||||
(.fail o err))
|
(.fail o ^Throwable err))
|
||||||
(.complete o))))))))
|
(.complete o))))))))
|
||||||
|
|
||||||
(defn- build-actor
|
(defn- build-actor
|
||||||
|
@ -244,7 +248,7 @@
|
||||||
(let [opts (VertxOptions.)]
|
(let [opts (VertxOptions.)]
|
||||||
(when threads (.setEventLoopPoolSize opts (int threads)))
|
(when threads (.setEventLoopPoolSize opts (int threads)))
|
||||||
(when worker-threads (.setWorkerPoolSize opts (int worker-threads)))
|
(when worker-threads (.setWorkerPoolSize opts (int worker-threads)))
|
||||||
(when on-error (.exceptionHandler (vu/fn->handler on-error)))
|
#_(when on-error (.exceptionHandler opts (vu/fn->handler on-error)))
|
||||||
opts))
|
opts))
|
||||||
|
|
||||||
|
|
||||||
|
|
9
backend/vendor/vertx/src/vertx/http.clj
vendored
9
backend/vendor/vertx/src/vertx/http.clj
vendored
|
@ -40,7 +40,7 @@
|
||||||
(loop [m (transient {})]
|
(loop [m (transient {})]
|
||||||
(if (.hasNext it)
|
(if (.hasNext it)
|
||||||
(let [^Map$Entry me (.next it)
|
(let [^Map$Entry me (.next it)
|
||||||
key (.toLowerCase (.getKey me))
|
key (.toLowerCase ^String (.getKey me))
|
||||||
val (.getValue me)]
|
val (.getValue me)]
|
||||||
(recur (assoc! m key val)))
|
(recur (assoc! m key val)))
|
||||||
(persistent! m)))))
|
(persistent! m)))))
|
||||||
|
@ -91,8 +91,8 @@
|
||||||
(.setReusePort opts true)
|
(.setReusePort opts true)
|
||||||
(.setTcpNoDelay opts true)
|
(.setTcpNoDelay opts true)
|
||||||
(.setTcpFastOpen opts true)
|
(.setTcpFastOpen opts true)
|
||||||
(when host (.setHost opts host))
|
(when host (.setHost opts ^String host))
|
||||||
(when port (.setPort opts port))
|
(when port (.setPort opts ^int port))
|
||||||
opts))
|
opts))
|
||||||
|
|
||||||
(defn- resolve-handler
|
(defn- resolve-handler
|
||||||
|
@ -135,7 +135,8 @@
|
||||||
(extend-protocol IAsyncBody
|
(extend-protocol IAsyncBody
|
||||||
(Class/forName "[B")
|
(Class/forName "[B")
|
||||||
(-handle-body [data res]
|
(-handle-body [data res]
|
||||||
(.end ^HttpServerResponse res (Buffer/buffer data)))
|
(.end ^HttpServerResponse res (Buffer/buffer ^bytes data)))
|
||||||
|
|
||||||
Buffer
|
Buffer
|
||||||
(-handle-body [data res]
|
(-handle-body [data res]
|
||||||
(.end ^HttpServerResponse res ^Buffer data))
|
(.end ^HttpServerResponse res ^Buffer data))
|
||||||
|
|
2
backend/vendor/vertx/src/vertx/timers.clj
vendored
2
backend/vendor/vertx/src/vertx/timers.clj
vendored
|
@ -72,5 +72,5 @@
|
||||||
java.lang.AutoCloseable
|
java.lang.AutoCloseable
|
||||||
(close [this]
|
(close [this]
|
||||||
(when (compare-and-set! state tid nil)
|
(when (compare-and-set! state tid nil)
|
||||||
(.cancelTimer system tid))))))
|
(.cancelTimer ^Vertx system tid))))))
|
||||||
|
|
||||||
|
|
19
backend/vendor/vertx/src/vertx/util.clj
vendored
19
backend/vendor/vertx/src/vertx/util.clj
vendored
|
@ -35,17 +35,18 @@
|
||||||
[d]
|
[d]
|
||||||
(reify Handler
|
(reify Handler
|
||||||
(handle [_ ar]
|
(handle [_ ar]
|
||||||
(if (.failed ar)
|
(if (.failed ^AsyncResult ar)
|
||||||
(p/reject! d (.cause ar))
|
(p/reject! d (.cause ^AsyncResult ar))
|
||||||
(p/resolve! d (.result ar))))))
|
(p/resolve! d (.result ^AsyncResult ar))))))
|
||||||
|
|
||||||
(defmacro doseq
|
(defmacro doseq
|
||||||
"A faster version of doseq."
|
"A faster version of doseq."
|
||||||
[[bsym csym] & body]
|
[[bsym csym] & body]
|
||||||
`(let [it# (.iterator ~csym)]
|
(let [itsym (gensym "iterator")]
|
||||||
(loop []
|
`(let [~itsym (.iterator ~(with-meta csym {:tag 'java.lang.Iterable}))]
|
||||||
(when (.hasNext it#)
|
(loop []
|
||||||
(let [~bsym (.next it#)]
|
(when (.hasNext ~(with-meta itsym {:tag 'java.util.Iterator}))
|
||||||
~@body
|
(let [~bsym (.next ~itsym)]
|
||||||
(recur))))))
|
~@body
|
||||||
|
(recur)))))))
|
||||||
|
|
||||||
|
|
4
backend/vendor/vertx/src/vertx/web.clj
vendored
4
backend/vendor/vertx/src/vertx/web.clj
vendored
|
@ -52,7 +52,7 @@
|
||||||
:method (-> request .rawMethod .toLowerCase keyword)
|
:method (-> request .rawMethod .toLowerCase keyword)
|
||||||
::vh/request request
|
::vh/request request
|
||||||
::vh/response response
|
::vh/response response
|
||||||
::execution-context (.getContext system)
|
;; ::execution-context (.getContext system)
|
||||||
::routing-context routing-context}))
|
::routing-context routing-context}))
|
||||||
|
|
||||||
(defn handler
|
(defn handler
|
||||||
|
@ -147,7 +147,7 @@
|
||||||
(let [req (->request rc)
|
(let [req (->request rc)
|
||||||
efn (fn [err]
|
efn (fn [err]
|
||||||
(.put ^RoutingContext rc "vertx$clj$req" req)
|
(.put ^RoutingContext rc "vertx$clj$req" req)
|
||||||
(.fail ^RoutingContext rc err))]
|
(.fail ^RoutingContext rc ^Throwable err))]
|
||||||
(try
|
(try
|
||||||
(-> (vh/-handle-response (f req) req)
|
(-> (vh/-handle-response (f req) req)
|
||||||
(p/catch' efn))
|
(p/catch' efn))
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
(defn get
|
(defn get
|
||||||
([session url] (get session url {}))
|
([session url] (get session url {}))
|
||||||
([session url opts]
|
([session url opts]
|
||||||
(let [^HttpRequest req (.getAbs session url)
|
(let [^HttpRequest req (.getAbs ^WebClientSession session url)
|
||||||
d (p/deferred)]
|
d (p/deferred)]
|
||||||
(.send req (vu/deferred->handler d))
|
(.send req (vu/deferred->handler d))
|
||||||
(p/then d (fn [^HttpResponse res]
|
(p/then d (fn [^HttpResponse res]
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
(loop [m (transient {})]
|
(loop [m (transient {})]
|
||||||
(if (.hasNext it)
|
(if (.hasNext it)
|
||||||
(let [^Map$Entry o (.next it)
|
(let [^Map$Entry o (.next it)
|
||||||
key (keyword (.toLowerCase (.getKey o)))
|
key (keyword (.toLowerCase ^String (.getKey o)))
|
||||||
prv (get m key ::default)
|
prv (get m key ::default)
|
||||||
val (.getValue o)]
|
val (.getValue o)]
|
||||||
(cond
|
(cond
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue