Hi all,

I have an inexplicable runtime error with a leiningen-generated AOT uberjar 
that happens when using Clojure 1.10 that doesn't happen with 1.9 (I'm on 
Java 8 for both compilation and deployment).

The code in question looks like:

(defn make-apns-message [payload]
  (let [buffer (ByteBuffer/allocate 3072)]
    (doto buffer
      (.put (byte 2))
      (.position (int 5))  ;; this fails
      (.put (byte 1))                  

      ;;<more .put's etc>

      (.flip))
    (Unpooled/wrappedBuffer buffer)))

When compiled with Clojure 1.10, the call to .position triggers this at 
runtime:

java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/
ByteBuffer;
        at basis.apns$make_apns_message.invokeStatic(apns.clj:255)
        at basis.apns$make_apns_message.invoke(apns.clj:249)
        at basis.apns$send_queued_apns_messages.invokeStatic(apns.clj:162)
        at basis.apns$send_queued_apns_messages.invoke(apns.clj:157)
        at basis.apns$schedule_open_apns$fn__11654$fn__11655.invoke(apns.clj
:109)
        at clojure.core$binding_conveyor_fn$fn__5739.invoke(core.clj:2033)
        at clojure.lang.AFn.applyToHelper(AFn.java:154)
        at clojure.lang.RestFn.applyTo(RestFn.java:132)
        at clojure.lang.Agent$Action.doRun(Agent.java:114)
        at clojure.lang.Agent$Action.run(Agent.java:163)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(
ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(
ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)


It's very strange because there is only one variant of position 
<https://docs.oracle.com/javase/8/docs/api/java/nio/Buffer.html#position-int-> 
in a ByteBuffer that takes a parameter (and I'm compiling with 
*warn-on-reflection* set to catch this sort of thing). 

Any ideas?

Cheers,

Matt.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to