This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jexl.git


The following commit(s) were added to refs/heads/master by this push:
     new 9f3a7978 Reuse BigInteger constants instead of creating new instances 
in org.apache.commons.jexl3.JexlArithmetic.toBigInteger(Object)
     new 77a8bb66 Merge branch 'master' of 
https://gitbox.apache.org/repos/asf/commons-jexl.git
9f3a7978 is described below

commit 9f3a7978eb394afb14de4e27c506c4df9a5871b2
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat May 31 08:51:27 2025 -0400

    Reuse BigInteger constants instead of creating new instances in
    org.apache.commons.jexl3.JexlArithmetic.toBigInteger(Object)
---
 src/changes/changes.xml                                    | 1 +
 src/main/java/org/apache/commons/jexl3/JexlArithmetic.java | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 2d139002..d1615c09 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -30,6 +30,7 @@
         <release version="3.5.1" date="YYYY-MM-DD" description="This is a 
feature and maintenance release. Java 8 or later is required.">
           <!-- FIX -->
           <action type="fix" dev="ggregory" due-to="Gary 
Gregory">org.apache.commons.jexl3.internal.introspection.AbstractExecutor.initMarker(Class,
 String, Class...) throws IllegalArgumentException instead of Error.</action>
+          <action type="fix" dev="ggregory" due-to="Gary Gregory">Reuse 
BigInteger constants instead of creating new instances in 
org.apache.commons.jexl3.JexlArithmetic.toBigInteger(Object).</action>
           <!-- ADD -->
           <!-- UPDATE -->
           <action type="update" dev="ggregory" due-to="Gary Gregory, 
Dependabot">Bump org.apache.commons:commons-parent from 81 to 84 #344.</action>
diff --git a/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java 
b/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java
index 32cec2e2..f62d1e5c 100644
--- a/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java
+++ b/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java
@@ -2098,10 +2098,10 @@ public class JexlArithmetic {
             return BigInteger.valueOf(((Number) val).longValue());
         }
         if (val instanceof Boolean) {
-            return BigInteger.valueOf((boolean) val ? 1L : 0L);
+            return (boolean) val ? BigInteger.ONE : BigInteger.ZERO;
         }
         if (val instanceof AtomicBoolean) {
-            return BigInteger.valueOf(((AtomicBoolean) val).get() ? 1L : 0L);
+            return ((AtomicBoolean) val).get() ? BigInteger.ONE : 
BigInteger.ZERO;
         }
         if (val instanceof String) {
             return parseBigInteger((String) val);

Reply via email to