Skip to content

Commit db51983

Browse files
committed
remove :redef on protocol methods, they are never direct-linked
1 parent 0163271 commit db51983

File tree

6 files changed

+54
-52
lines changed

6 files changed

+54
-52
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## NEXT
44

5+
- remove `:redef` on protocol methods, they are never direct-linked: https://ask.clojure.org/index.php/10967/are-protocol-methods-guaranteed-to-not-be-directly-linked?show=10990#a10990
6+
57
## 1.2.0
68

79
- [#95](https://github.com/dm3/clojure.java-time/issues/95) work around [CLJ-1796](https://clojure.atlassian.net/browse/CLJ-1796)

src/java_time/core.clj

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,86 +4,86 @@
44
[java.time.chrono Chronology]))
55

66
(defprotocol Amount
7-
(^:redef zero? [a]
7+
(zero? [a]
88
"True if the amount is zero")
9-
(^:redef negative? [a]
9+
(negative? [a]
1010
"True if the amount is negative")
11-
(^:redef negate [a]
11+
(negate [a]
1212
"Negates a temporal amount:
1313
1414
(negate (negate x)) == x")
15-
(^:redef abs [a]
15+
(abs [a]
1616
"Returns the absolute value of a temporal amount:
1717
1818
(abs (negate x)) == (abs x)"))
1919

2020
(defprotocol Supporting
21-
(^:redef supports? [o p]
21+
(supports? [o p]
2222
"True if the `o` entity supports the `p` property"))
2323

2424
(defprotocol HasChronology
25-
(^:redef ^java.time.chrono.Chronology chronology [o]
25+
(^java.time.chrono.Chronology chronology [o]
2626
"The `Chronology` of the entity"))
2727

2828
(defprotocol HasFields
29-
(^:redef fields [o]
29+
(fields [o]
3030
"Fields present in this temporal entity")
31-
(^:redef field* [o k]
31+
(field* [o k]
3232
"Internal use"))
3333

3434
(defprotocol HasUnits
35-
(^:redef units [o]
35+
(units [o]
3636
"Units present in this temporal entity.")
37-
(^:redef unit* [o k]
37+
(unit* [o k]
3838
"Internal use"))
3939

4040
(defprotocol HasProperties
41-
(^:redef properties [o]
41+
(properties [o]
4242
"Map of properties present in this temporal entity")
43-
(^:redef property [o k]
43+
(property [o k]
4444
"Property of this temporal entity under key `k`"))
4545

4646
(defprotocol As
47-
(^:redef as* [o k]
47+
(as* [o k]
4848
"Value of property/unit identified by key/object `k` of the temporal
4949
entity `o`"))
5050

5151
(defprotocol ReadableProperty
52-
(^:redef value [p]
52+
(value [p]
5353
"Value of the property"))
5454

5555
(defprotocol ReadableRangeProperty
56-
(^:redef range [p]
56+
(range [p]
5757
"Range of values for this property")
58-
(^:redef min-value [p]
58+
(min-value [p]
5959
"Minimum value of this property")
60-
(^:redef largest-min-value [p]
60+
(largest-min-value [p]
6161
"Largest minimum value of this property")
62-
(^:redef smallest-max-value [p]
62+
(smallest-max-value [p]
6363
"Smallest maximum value of this property, e.g. 28th of February for months")
64-
(^:redef max-value [p]
64+
(max-value [p]
6565
"Maximum value of this property, e.g. 29th of February for months"))
6666

6767
(defprotocol WritableProperty
68-
(^:redef with-value [p v]
68+
(with-value [p v]
6969
"Underlying temporal entity with the value of this property set to `v`"))
7070

7171
(defprotocol WritableRangeProperty
72-
(^:redef with-min-value [p]
72+
(with-min-value [p]
7373
"Underlying temporal entity with the value set to the minimum available for
7474
this property")
75-
(^:redef with-largest-min-value [p]
75+
(with-largest-min-value [p]
7676
"Underlying temporal entity with the value set to the largest minimum
7777
available for this property")
78-
(^:redef with-smallest-max-value [p]
78+
(with-smallest-max-value [p]
7979
"Underlying temporal entity with the value set to the smallest maximum
8080
available for this property")
81-
(^:redef with-max-value [p]
81+
(with-max-value [p]
8282
"Underlying temporal entity with the value set to the maximum
8383
available for this property"))
8484

8585
(defprotocol KnowsTimeBetween
86-
(^:redef time-between [o e u]
86+
(time-between [o e u]
8787
"Time between temporal entities `o` and `e` in unit `u`.
8888
8989
```
@@ -95,34 +95,34 @@
9595
```"))
9696

9797
(defprotocol KnowsIfLeap
98-
(^:redef leap? [o]
98+
(leap? [o]
9999
"True if the year of this entity is a leap year."))
100100

101101
(defprotocol Truncatable
102-
(^:redef truncate-to [o u]
102+
(truncate-to [o u]
103103
"Truncates this entity to the specified time unit. Only works for units that
104104
divide into the length of standard day without remainder (up to `:days`)."))
105105

106106
(defprotocol HasZone
107-
(^:redef with-zone [o z]
107+
(with-zone [o z]
108108
"Returns this temporal entity with the specified `ZoneId`"))
109109

110110
(defprotocol Plusable
111111
"Internal"
112-
(^:redef seq-plus [o os]))
112+
(seq-plus [o os]))
113113

114114
(defprotocol Minusable
115115
"Internal"
116-
(^:redef seq-minus [o os]))
116+
(seq-minus [o os]))
117117

118118
(defprotocol Multipliable
119-
(^:redef multiply-by [o v]
119+
(multiply-by [o v]
120120
"Entity `o` multiplied by the value `v`"))
121121

122122
(defprotocol Ordered
123-
(^:redef single-before? [a b]
123+
(single-before? [a b]
124124
"Internal use")
125-
(^:redef single-after? [a b]
125+
(single-after? [a b]
126126
"Internal use"))
127127

128128
(defn as

src/java_time/graph.cljc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@
7777
true))))))))))
7878

7979
(defprotocol IConversionGraph
80-
(^:redef get-conversion [_ src dst])
81-
(^:redef assoc-conversion [_ src dst f cost])
82-
(^:redef equivalent-targets [_ dst])
83-
(^:redef possible-sources [_])
84-
(^:redef possible-conversions [_ src]))
80+
(get-conversion [_ src dst])
81+
(assoc-conversion [_ src dst f cost])
82+
(equivalent-targets [_ dst])
83+
(possible-sources [_])
84+
(possible-conversions [_ src]))
8585

8686
(defn- expand [[a b]]
8787
(when-some [[bf & br] (seq b)]

src/java_time/interval.clj

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
(:import [java.time Instant Duration]))
88

99
(defprotocol ^:private AnyInterval
10-
(^:redef seq-move-start-by [i os]
10+
(seq-move-start-by [i os]
1111
"Use `move-start-by` with vararags")
12-
(^:redef seq-move-end-by [i os]
12+
(seq-move-end-by [i os]
1313
"Use `move-end-by` with vararags")
14-
(^:redef move-start-to [i new-start]
14+
(move-start-to [i new-start]
1515
"Moves the start instant of the interval to the given instant (or something
1616
convertible to an instant):
1717
@@ -26,7 +26,7 @@
2626
(move-start-to (interval 0 10000) (millis 15000))
2727
=> DateTimeException...
2828
```")
29-
(^:redef move-end-to [i new-end]
29+
(move-end-to [i new-end]
3030
"Moves the end of the interval to the given instant (or something
3131
convertible to an instant):
3232
@@ -41,13 +41,13 @@
4141
(move-end-to (interval 0 10000) (millis -1))
4242
=> DateTimeException...
4343
```")
44-
(^:redef start [i] "Gets the start instant of the interval")
45-
(^:redef end [i] "Gets the end instant of the interval")
46-
(^:redef contains? [i o] "True if the interval contains the given instant or interval")
47-
(^:redef overlaps? [i oi] "True if this interval overlaps the other one")
48-
(^:redef abuts? [i oi] "True if this interval abut with the other one")
49-
(^:redef overlap [i oi] "Gets the overlap between this interval and the other one or `nil`")
50-
(^:redef gap [i oi] "Gets the gap between this interval and the other one or `nil`"))
44+
(start [i] "Gets the start instant of the interval")
45+
(end [i] "Gets the end instant of the interval")
46+
(contains? [i o] "True if the interval contains the given instant or interval")
47+
(overlaps? [i oi] "True if this interval overlaps the other one")
48+
(abuts? [i oi] "True if this interval abut with the other one")
49+
(overlap [i oi] "Gets the overlap between this interval and the other one or `nil`")
50+
(gap [i oi] "Gets the gap between this interval and the other one or `nil`"))
5151

5252
;;;;;;;;;;;;; ReadableInterval
5353

src/java_time/temporal.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
;;;;; FACTORY
136136

137137
(defprotocol PropertyFactory
138-
(^:redef mk-property [factory entity prop-key prop-obj]))
138+
(mk-property [factory entity prop-key prop-obj]))
139139

140140
(def default-field-property-factory
141141
(reify PropertyFactory

src/java_time/zone.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,15 +316,15 @@
316316
(.toZonedDateTime cal))))
317317

318318
(defprotocol HasOffset
319-
(^:redef with-offset [o offset]
319+
(with-offset [o offset]
320320
"Sets the offset to the specified value ensuring that the local time stays
321321
the same.
322322
323323
(offset-time 10 30 0 0 +2)
324324
=> #<java.time.OffsetTime 10:30+02:00>
325325
(with-offset *1 +3)
326326
=> #<java.time.OffsetTime 10:30+03:00>")
327-
(^:redef with-offset-same-instant [o offset]
327+
(with-offset-same-instant [o offset]
328328
"Sets the offset to the specified value ensuring that the result has the same instant, e.g.:
329329
330330
(offset-time 10 30 0 0 +2)

0 commit comments

Comments
 (0)