You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by he...@apache.org on 2016/01/22 18:03:06 UTC

svn commit: r1726257 - /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/introspection/Uberspect.java

Author: henrib
Date: Fri Jan 22 17:03:06 2016
New Revision: 1726257

URL: http://svn.apache.org/viewvc?rev=1726257&view=rev
Log:
JEXL-186: correcting arithmetic operator overloading caching / discovery

Modified:
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/introspection/Uberspect.java

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/introspection/Uberspect.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/introspection/Uberspect.java?rev=1726257&r1=1726256&r2=1726257&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/introspection/Uberspect.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/introspection/Uberspect.java Fri Jan 22 17:03:06 2016
@@ -429,7 +429,9 @@ public class Uberspect implements JexlUb
          */
         private ArithmeticUberspect(JexlArithmetic theArithmetic, Set<JexlOperator> theOverloads) {
             this.arithmetic = theArithmetic;
-            this.overloads = EnumSet.copyOf(theOverloads);
+            this.overloads = theOverloads == null || theOverloads.isEmpty()
+                             ? EnumSet.noneOf(JexlOperator.class)
+                             : EnumSet.copyOf(theOverloads);
             // register this arithmetic class in the operator map
             operatorMap.put(arithmetic.getClass(), overloads);
         }
@@ -479,9 +481,7 @@ public class Uberspect implements JexlUb
                     }
                 }
             }
-            if (!ops.isEmpty()) {
-                jau = new ArithmeticUberspect(arithmetic, ops);
-            }
+            jau = new ArithmeticUberspect(arithmetic, ops);
         }
         return jau;
     }