Skip to content

Commit 7f362ab

Browse files
committed
Fix for Java 13 compatiblity #23. Added type hints to resolve breaking code.
1 parent 83452cb commit 7f362ab

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ pom.xml.asc
99
/.nrepl-port
1010
.DS_Store
1111
/doc
12-
push
12+
push
13+
*.iml
14+
.idea/

src/durable_queue.clj

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,11 @@
174174
(with-buffer [buf slab]
175175
(reset! status s)
176176
(.put buf (p/+ offset 1)
177-
(case s
178-
:incomplete 0
179-
:in-progress 1
180-
:complete 2))
177+
(byte
178+
(case s
179+
:incomplete 0
180+
:in-progress 1
181+
:complete 2)))
181182
(invalidate slab (p/+ offset 1) 1)
182183
nil)))
183184

@@ -190,9 +191,9 @@
190191
(fn []
191192
(with-buffer [buf slab]
192193
(let [^ByteBuffer buf (-> buf
193-
(.position offset)
194+
(.position ^Long offset)
194195
^ByteBuffer
195-
(.limit (+ offset len))
196+
(.limit ^Long (+ offset len))
196197
.slice)
197198
checksum' (.getLong buf 2)
198199
ary (bs/to-byte-array (.position buf header-size))]
@@ -303,17 +304,17 @@
303304
(let [ary (nippy/freeze descriptor)
304305
cnt (count ary)
305306
pos @position
306-
^ByteBuffer buf (.position buf pos)]
307+
^ByteBuffer buf (.position buf ^Long pos)]
307308

308309
(when (> (.remaining buf) (+ (count ary) header-size))
309310
;; write to the buffer
310311
(doto buf
311-
(.position pos)
312+
(.position ^Long pos)
312313
(.put (byte 1)) ;; exists
313314
(.put (byte 0)) ;; incomplete
314315
(.putLong (checksum cnt ary))
315316
(.putInt cnt)
316-
(.put ary)
317+
(.put ^bytes ary)
317318
(.put (byte 0))) ;; next doesn't exist
318319

319320
(swap! position + header-size cnt)

0 commit comments

Comments
 (0)