commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hen...@apache.org
Subject svn commit: r1735973 - /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/internal/introspection/Uberspect.java
Date Mon, 21 Mar 2016 13:42:34 GMT
Author: henrib
Date: Mon Mar 21 13:42:34 2016
New Revision: 1735973

URL: http://svn.apache.org/viewvc?rev=1735973&view=rev
Log:
JEXL-186:
Cleaner arithmetic * operators handling

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=1735973&r1=1735972&r2=1735973&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
Mon Mar 21 13:42:34 2016
@@ -424,7 +424,7 @@ public class Uberspect implements JexlUb
         /** The arithmetic instance being analyzed. */
         private final JexlArithmetic arithmetic;
         /** The set of overloaded operators. */
-        private final EnumSet<JexlOperator> overloads;
+        private final Set<JexlOperator> overloads;
 
         /**
          * Creates an instance.
@@ -433,11 +433,7 @@ public class Uberspect implements JexlUb
          */
         private ArithmeticUberspect(JexlArithmetic theArithmetic, Set<JexlOperator>
theOverloads) {
             this.arithmetic = theArithmetic;
-            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);
+            this.overloads = theOverloads;
         }
 
         @Override
@@ -460,7 +456,8 @@ public class Uberspect implements JexlUb
     public JexlArithmetic.Uberspect getArithmetic(JexlArithmetic arithmetic) {
         JexlArithmetic.Uberspect jau = null;
         if (arithmetic != null) {
-            Set<JexlOperator> ops = operatorMap.get(arithmetic.getClass());
+            final Class<? extends JexlArithmetic> aclass = arithmetic.getClass();
+            Set<JexlOperator> ops = operatorMap.get(aclass);
             if (ops == null) {
                 ops = EnumSet.noneOf(JexlOperator.class);
                 for (JexlOperator op : JexlOperator.values()) {
@@ -484,6 +481,8 @@ public class Uberspect implements JexlUb
                         }
                     }
                 }
+                // register this arithmetic class in the operator map
+                operatorMap.put(aclass, ops);
             }
             jau = new ArithmeticUberspect(arithmetic, ops);
         }



Mime
View raw message