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

+1 vote
in Clojure by


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.

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

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

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

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: