<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged regression</title>
<link>https://ask.clojure.org/index.php/tag/regression</link>
<description></description>
<item>
<title>Breaking change in 1.12.0 - a static field is always preferred to a static function with the same name</title>
<link>https://ask.clojure.org/index.php/14435/breaking-change-static-field-always-preferred-static-function</link>
<description>&lt;p&gt;In 1.11.4, if a class has a static field and a static method with the same name, attempting to use the method as a function works as expected.&lt;/p&gt;
&lt;p&gt;In 1.12.0, the static field is always returned instead.&lt;/p&gt;
&lt;p&gt;A CLI reproduction case:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.12.0
user=&amp;gt; (add-lib 'com.badlogicgames.gdx/gdx)
[com.badlogicgames.gdx/gdx com.badlogicgames.gdx/gdx-jnigen-loader]
user=&amp;gt; (import '(com.badlogic.gdx.math MathUtils))
com.badlogic.gdx.math.MathUtils
user=&amp;gt; MathUtils/random
#object[com.badlogic.gdx.math.RandomXS128 0x3df978b9 &quot;com.badlogic.gdx.math.RandomXS128@3df978b9&quot;]
user=&amp;gt; (MathUtils/random)
#object[com.badlogic.gdx.math.RandomXS128 0x3df978b9 &quot;com.badlogic.gdx.math.RandomXS128@3df978b9&quot;]
user=&amp;gt; (MathUtils/random 0 10)
#object[com.badlogic.gdx.math.RandomXS128 0x3df978b9 &quot;com.badlogic.gdx.math.RandomXS128@3df978b9&quot;]


Clojure 1.11.4
user=&amp;gt; (import '(com.badlogic.gdx.math MathUtils))
com.badlogic.gdx.math.MathUtils
user=&amp;gt; MathUtils/random
#object[com.badlogic.gdx.math.RandomXS128 0x71c905a3 &quot;com.badlogic.gdx.math.RandomXS128@71c905a3&quot;]
user=&amp;gt; (MathUtils/random)
0.37632704
user=&amp;gt; (MathUtils/random 0 10)
0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A potential test case:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;diff --git a/test/clojure/test_clojure/java_interop.clj b/test/clojure/test_clojure/java_interop.clj
index 4a503884..c99370a3 100644
--- a/test/clojure/test_clojure/java_interop.clj
+++ b/test/clojure/test_clojure/java_interop.clj
@@ -20,7 +20,7 @@
             [clojure.test-helper :refer [should-not-reflect]])
   (:import java.util.Base64
            (java.io File FileFilter FilenameFilter)
-           (java.util UUID)
+           (java.util ArrayList Collections$UnmodifiableCollection UUID)
            (java.util.concurrent.atomic AtomicLong AtomicInteger)
            (clojure.test FIConstructor FIStatic FunctionalTester AdapterExerciser)))
 
@@ -783,6 +783,16 @@
   (def fi-static (FIStatic/numbers (fn [i] (&amp;lt; i 0))))
   (is (= [-2 -1] fi-static)))
 
+(deftest static-field-and-method
+  (let [fv FIStatic/numbers
+        mv0 (FIStatic/numbers)
+        mv1 (FIStatic/numbers neg?)]
+    (is (= [-2 -1 0 1 2] fv))
+    (is (instance? Collections$UnmodifiableCollection fv))
+    (is (= [-2 -1 0 1 2] mv0))
+    (is (instance? ArrayList mv0))
+    (is (= [-2 -1] mv1))))
+
 ;; newDirectoryStream is overloaded, takes ^[Path String] or ^[Path DirectoryStream$Filter]
 ;; so this method will reflect
 (defn get-dir-stream [^java.nio.file.Path dir-path glob-pattern]
diff --git a/test/java/clojure/test/FIStatic.java b/test/java/clojure/test/FIStatic.java
index 8273c357..4a8198ae 100644
--- a/test/java/clojure/test/FIStatic.java
+++ b/test/java/clojure/test/FIStatic.java
@@ -1,13 +1,20 @@
 package clojure.test;
 
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.function.Predicate;
 
 public class FIStatic {
 
+    public static List&amp;lt;Integer&amp;gt; numbers = Collections.unmodifiableList(Arrays.asList(-2, -1, 0, 1, 2));
+
+    public static List&amp;lt;Object&amp;gt; numbers () {
+        return new ArrayList&amp;lt;&amp;gt;(numbers);
+    }
+
     public static List&amp;lt;Object&amp;gt; numbers(Predicate&amp;lt;Integer&amp;gt; pred) {
-        List&amp;lt;Integer&amp;gt; numbers = Arrays.asList(-2, -1, 0, 1, 2);
         Object[] filteredNumbers =  numbers.stream().filter(pred).toArray();
         return Arrays.asList(filteredNumbers);
     }
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14435/breaking-change-static-field-always-preferred-static-function</guid>
<pubDate>Fri, 28 Feb 2025 20:06:59 +0000</pubDate>
</item>
<item>
<title>Clojure 1.12 breaks Serialization for records implementing IFn</title>
<link>https://ask.clojure.org/index.php/14410/clojure-breaks-serialization-for-records-implementing-ifn</link>
<description>&lt;p&gt;If you have a class/record that implements a functional interface AND &lt;code&gt;IFn&lt;/code&gt;, serializing it will throw the same error as CLJ-2880. Here's a repro&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [^java.util.function.Function my-f
      (reify
        Serializable
        java.util.function.Function
        clojure.lang.IFn
        )]
  (with-open [os (java.io.ObjectOutputStream. (java.io.ByteArrayOutputStream.))]
    (.writeObject os my-f)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Will throw &lt;code&gt;java.io.NotSerializableException&lt;/code&gt;. If you comment out &lt;code&gt;clojure.lang.IFn&lt;/code&gt;, this code works.&lt;/p&gt;
&lt;p&gt;This is a regression from 1.11.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14410/clojure-breaks-serialization-for-records-implementing-ifn</guid>
<pubDate>Fri, 21 Feb 2025 20:51:39 +0000</pubDate>
</item>
<item>
<title>Pushback buffer overflow reading large json file with clojure.data.json 2.1.0</title>
<link>https://ask.clojure.org/index.php/10443/pushback-buffer-overflow-reading-large-json-file-with-clojure</link>
<description>&lt;p&gt;The following works with clojure.data.json version 1.0.0, but throws an exception in 2.0.2 and 2.1.0 (other versions not tested):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn read-json []
  (clojure.data.json/read
   (clojure.java.io/reader
    (clojure.java.io/as-url
     &quot;https://github.com/phronmophobic/clj-cef/raw/main/resources/cef.json&quot;))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The exception:&lt;br&gt;
&lt;code&gt;Execution error (IOException) at java.io.PushbackReader/unread (PushbackReader.java:179).
Pushback buffer overflow&lt;/code&gt;`&lt;/p&gt;
&lt;p&gt;It also throws the exception when reading from the file locally.&lt;/p&gt;
</description>
<category>data.json</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10443/pushback-buffer-overflow-reading-large-json-file-with-clojure</guid>
<pubDate>Fri, 09 Apr 2021 19:39:47 +0000</pubDate>
</item>
</channel>
</rss>