Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Clojure by

Hello,

I'm working on a project that runs its test suite again Clojure 1.12.0-master-SNAPSHOT.

On this version of Clojure the form (drop Long/MAX_VALUE []) throws an ArithmeticException.

I tried it directly in the Clojure repository with commit 1b3a5065b7f533d4fd7109686fcc4489163b916c where it is also happening.

$ java -jar clojure.jar Clojure 1.12.0-master-SNAPSHOT user=> (drop Long/MAX_VALUE []) Execution error (ArithmeticException) at java.lang.Math/toIntExact (Math.java:1074). integer overflow

I just wanted to mention this, since I did not find an issue about this on JIRA.

by
As a note - due to the `IDrop` interface declaring its only method as `drop(int n)`, the `drop` function will fail for any value that doesn't fit into an integer, e.g. `(drop 2147483648 [])`.

2 Answers

+1 vote
by

Thanks, logged as https://clojure.atlassian.net/browse/CLJ-2787. We may decide not to fix this, but will look at it before 1.12 is released.

+1 vote
by

Do you have any more information about why this would be important? What is the scenario where you're seeing this?

by
Hi Alex,

thanks for looking into it. I was running into this in a generative smoke test, where I generated an options map for limit and offset values, which are passed to Clojure's take and drop functions.  

The test that was failing was this one here:
https://github.com/clojure-emacs/logjam/blob/master/test/logjam/event_test.clj#L17
...