Clojure 1.11.3
Clojure 1.11.3 is now available. CLJ-2843 - Reflective calls to Java methods that take primitive long or double now work when passed a narrower boxed number at runtime (Integer, Short, Byte, Float). Previously, these methods were not matched during reflection and an error was thrown. Java 21 added an overload to the method Thread/sleep in the 1-arity. When upgrading to Java 21, existing Clojure calls to Thread/sleep become reflective, but continue to work. As usual, you can detect reflection with *warn-on-reflection* and address with a type hint (here, ^long ) to choose the desired overload. Previously, passing a Short or Integer value to a reflective call like Thread/sleep that takes a long would not match, that has been corrected.

Clojure 1.11.3 has been released, bringing a significant improvement in how reflective calls to Java methods handle primitive long and double types. This version addresses the issue outlined in CLJ-2843, which previously caused errors when passing narrower boxed numbers like Integer, Short, Byte, or Float to methods expecting a primitive long or double during runtime.
In Clojure 1.11.3, reflective calls now correctly match and work with these narrower boxed numbers. This means that developers no longer encounter errors when using such values with Java methods that expect a primitive long or double. This enhancement ensures smoother interoperability between Clojure and Java, allowing for more flexible and efficient programming.
Another notable change in this release is related to Java 21's addition of an overload to the Thread/sleep method in the 1-arity. When upgrading to Java 21, existing Clojure calls to Thread/sleep become reflective. Despite this change, the calls continue to function as expected. However, developers can still detect reflection using *warn-on-reflection* and address it by providing a type hint, such as ^long, to select the desired overload.
Prior to this release, passing a Short or Integer value to a reflective call like Thread/sleep that takes a long would not match, leading to potential issues. Clojure 1.11.3 resolves this problem, ensuring that such calls are now correctly handled.
This update underscores Clojure's commitment to maintaining strong compatibility with evolving Java versions while enhancing the language's reflective capabilities. As always, Clojure's design philosophy prioritizes simplicity, expressiveness, and robustness, making it a popular choice for developers seeking a powerful and flexible functional programming language.
For those already using Clojure, upgrading to version 1.11.3 is highly recommended to take advantage of these improvements. The enhancements not only address existing issues but also future-proof Clojure applications by ensuring compatibility with newer Java releases.
In summary, Clojure 1.11.3 introduces critical updates that improve reflective calls to Java methods, particularly those involving primitive long and double types. By addressing CLJ-2843 and adapting to Java 21's changes, this version offers enhanced stability and compatibility. As Clojure continues to evolve, its focus on seamless integration with Java remains a key strength, making it a reliable and versatile tool for developers.









