Skip to content

Commit 1e2a95a

Browse files
authored
Merge pull request #24 from markbastian/master
Fix for Java 13 compatibility #23
2 parents 895bbf2 + 735ef93 commit 1e2a95a

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ pom.xml.asc
1010
.DS_Store
1111
/doc
1212
push
13+
*.iml
14+
.idea/
1315
.clj-kondo/.cache
1416
.lsp/.cache
1517
.portal/vs-code.edn

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)