Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a couple of reflection warnings. #6

Merged
merged 1 commit into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/elle/consistency_model.clj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
(:import (java.util.function Function)
(io.lacuna.bifurcan Graphs)))

(set! *warn-on-reflection* true)

(def implied-anomalies
"We have lots of different types of anomalies. Some of them imply others--for
example, when we detect an :internal anomaly, that's *also* a sign of G1a:
Expand Down
2 changes: 2 additions & 0 deletions src/elle/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
; are Bifurcan DirectedGraphs. Explainers have a protocol, because we're going
; to pack some cached state into them.

(set! *warn-on-reflection* true)

(defprotocol Anomalies
"There are several points in an analysis where we want to construct some
intermediate data, like a version graph, for later. However, it might be that
Expand Down
2 changes: 2 additions & 0 deletions src/elle/explanation.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
protocol supports constructing inferences which can be rendered as data
structures or text.")

(set! *warn-on-reflection* true)

(defprotocol Explanation
(->data [ex] "Converts the explanation to a data structure.")
(->text [ex] "Converts the explanation to plain text."))
Expand Down
2 changes: 2 additions & 0 deletions src/elle/history.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
including identifying keys, known-committed, and known-aborted operations."
(:require [knossos [op :as op]]))

(set! *warn-on-reflection* true)

(defn known-committed
"Returns a sequence of operations which are known to be
committed."
Expand Down
10 changes: 6 additions & 4 deletions src/elle/list_append.clj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
Set
SortedMap)))

(set! *warn-on-reflection* true)

(defn verify-mop-types
"Takes a history where operation values are transactions. Verifies that the
history contains only reads [:r k v] and appends [:append k v]. Returns nil
Expand Down Expand Up @@ -564,8 +566,8 @@
:key k
:value prev-v
:value' v
:a-mop-index (.indexOf (:value a) [:append k prev-v])
:b-mop-index (.indexOf (:value b) b-mop)}))))))
:a-mop-index (.indexOf ^clojure.lang.PersistentVector (:value a) [:append k prev-v])
:b-mop-index (.indexOf ^clojure.lang.PersistentVector (:value b) b-mop)}))))))
first))

(render-explanation [_ {:keys [key value value'] :as m} a-name b-name]
Expand Down Expand Up @@ -603,8 +605,8 @@
{:type :wr
:key k
:value (peek v)
:a-mop-index (.indexOf (:value a) [:append k (peek v)])
:b-mop-index (.indexOf (:value b) mop)})))))
:a-mop-index (.indexOf ^clojure.lang.PersistentVector (:value a) [:append k (peek v)])
:b-mop-index (.indexOf ^clojure.lang.PersistentVector (:value b) mop)})))))
first))

(render-explanation [_ {:keys [key value]} a-name b-name]
Expand Down
2 changes: 2 additions & 0 deletions src/elle/recovery.clj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
[jepsen [txn :as txn]]
[knossos [op :as op]]))

(set! *warn-on-reflection* true)

(defprotocol WriteRecovery
"Maps between writes and versions."
(write->version [r mop]
Expand Down
14 changes: 8 additions & 6 deletions src/elle/rw_register.clj
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
Map
Set)))

(set! *warn-on-reflection* true)

(defn op-internal-case
"Given an op, returns a map describing internal consistency violations, or
nil otherwise. Our maps are:
Expand Down Expand Up @@ -587,8 +589,8 @@
version-graphs txn/ext-writes a txn/ext-writes b)]
(assoc e
:type :ww
:a-mop-index (.indexOf (:value a) [:w key value])
:b-mop-index (.indexOf (:value b) [:w key value']))))
:a-mop-index (.indexOf ^clojure.lang.PersistentVector (:value a) [:w key value])
:b-mop-index (.indexOf ^clojure.lang.PersistentVector (:value b) [:w key value']))))

(render-explanation [_ {:keys [key value value'] :as m} a-name b-name]
(str a-name " set key " (pr-str key) " to " (pr-str value) ", and "
Expand All @@ -603,8 +605,8 @@
txn/ext-reads a txn/ext-writes b)]
(assoc e
:type :rw
:a-mop-index (.indexOf (:value a) [:r key value])
:b-mop-index (.indexOf (:value b) [:w key value']))))
:a-mop-index (.indexOf ^clojure.lang.PersistentVector (:value a) [:r key value])
:b-mop-index (.indexOf ^clojure.lang.PersistentVector (:value b) [:w key value']))))

(render-explanation [_ {:keys [key value value'] :as m} a-name b-name]
(str a-name " read key " (pr-str key) " = " (pr-str value) ", and "
Expand Down Expand Up @@ -644,8 +646,8 @@
{:type :wr
:key k
:value v
:a-mop-index (.indexOf (:value a) [:w k v])
:b-mop-index (.indexOf (:value b) [:r k v])})))
:a-mop-index (.indexOf ^clojure.lang.PersistentVector (:value a) [:w k v])
:b-mop-index (.indexOf ^clojure.lang.PersistentVector (:value b) [:r k v])})))
nil
writes)))

Expand Down
2 changes: 2 additions & 0 deletions src/elle/set_add.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
[knossos.op :as op])
(:import (io.lacuna.bifurcan IntSet)))

(set! *warn-on-reflection* true)

; When deriving a subset graph, we're going to do a bunch of subset
; comparisons, hashing, and equality checking. To speed this up, we map raw
; Clojure sets into compact, optimized data structures which support fast
Expand Down
1 change: 1 addition & 0 deletions src/elle/txn.clj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
(:import (io.lacuna.bifurcan LinearMap
Map)))

(set! *warn-on-reflection* true)

(start-logging! {:console "%p [%d] %t - %c %m%n"})

Expand Down
2 changes: 2 additions & 0 deletions src/elle/util.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
[clojure.tools.logging :refer [info warn]])
(:import (java.util.concurrent ExecutionException)))

(set! *warn-on-reflection* true)

(defn nanos->secs [nanos] (/ nanos 1e9))

(defn maybe-interrupt
Expand Down
2 changes: 2 additions & 0 deletions src/elle/version_graph.clj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

That transaction graph, can, in turn, expand the version graph.")

(set! *warn-on-reflection* true)

(defprotocol VersionGraph
"This protocol identifies the relationships between versions, and can justify
those relationships."
Expand Down
2 changes: 2 additions & 0 deletions src/elle/version_order.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
[recovery :as rec]
[version-graph :as vg]]))

(set! *warn-on-reflection* true)

(defprotocol VersionOrder
(all-keys [_]
"Returns the set of all keys in this version order.")
Expand Down
2 changes: 2 additions & 0 deletions src/elle/viz.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
[rhizome [dot :as dot]
[viz :as rv]]))

(set! *warn-on-reflection* true)

(def ^:private escapable-characters "\\|{}\"")

(defn escape-string
Expand Down