groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Minor refactoring: remove duplicated code of number calculation
Date Fri, 09 Mar 2018 04:54:18 GMT
Repository: groovy
Updated Branches:
  refs/heads/master 3bbd5a75f -> f73d55170


Minor refactoring: remove duplicated code of number calculation


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/f73d5517
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/f73d5517
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/f73d5517

Branch: refs/heads/master
Commit: f73d551703ecdca943fe442572608352aa77656b
Parents: 3bbd5a7
Author: sunlan <sunlan@apache.org>
Authored: Fri Mar 9 12:54:10 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Fri Mar 9 12:54:10 2018 +0800

----------------------------------------------------------------------
 .../groovy/runtime/dgmimpl/NumberNumberDiv.java | 87 ++++++++++++-------
 .../runtime/dgmimpl/NumberNumberMetaMethod.java | 78 +++++++++++++++++
 .../runtime/dgmimpl/NumberNumberMinus.java      | 91 +++++++++++---------
 .../runtime/dgmimpl/NumberNumberMultiply.java   | 91 +++++++++++---------
 .../runtime/dgmimpl/NumberNumberPlus.java       | 91 +++++++++++---------
 5 files changed, 282 insertions(+), 156 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/f73d5517/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberDiv.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberDiv.java b/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberDiv.java
index b20d4fe..443d970 100644
--- a/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberDiv.java
+++ b/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberDiv.java
@@ -46,51 +46,72 @@ public final class NumberNumberDiv extends NumberNumberMetaMethod {
         return NumberMath.divide(left, right);
     }
 
-    public CallSite createPojoCallSite(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
-        if (receiver instanceof Integer) {
-            if (args[0] instanceof Float)
-                return new IntegerFloat(site, metaClass, metaMethod, params, receiver, args);
 
-            if (args[0] instanceof Double)
-                return new IntegerDouble(site, metaClass, metaMethod, params, receiver, args);
-            }
+    public CallSite createIntegerInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return createNumberNumber(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-        if (receiver instanceof Long) {
-            if (args[0] instanceof Float)
-                return new LongFloat(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createIntegerLong(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return createNumberNumber(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Double)
-                return new LongDouble(site, metaClass, metaMethod, params, receiver, args);
-            }
+    public CallSite createIntegerFloat(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new IntegerFloat(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-        if (receiver instanceof Float) {
-            if (args[0] instanceof Integer)
-                return new FloatInteger(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createIntegerDouble(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new IntegerDouble(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Long)
-                return new FloatLong(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createLongInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return createNumberNumber(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Float)
-                return new FloatFloat(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createLongLong(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return createNumberNumber(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Double)
-                return new FloatDouble(site, metaClass, metaMethod, params, receiver, args);
-            }
+    public CallSite createLongFloat(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new LongFloat(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-        if (receiver instanceof Double) {
-            if (args[0] instanceof Integer)
-                return new DoubleInteger(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createLongDouble(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new LongDouble(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Long)
-                return new DoubleLong(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createFloatInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new FloatInteger(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Float)
-                return new DoubleFloat(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createFloatLong(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new FloatLong(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Double)
-                return new DoubleDouble(site, metaClass, metaMethod, params, receiver, args);
-            }
+    public CallSite createFloatFloat(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new FloatFloat(site, metaClass, metaMethod, params, receiver, args);
+    }
+
+    public CallSite createFloatDouble(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new FloatDouble(site, metaClass, metaMethod, params, receiver, args);
+    }
+
+    public CallSite createDoubleInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new DoubleInteger(site, metaClass, metaMethod, params, receiver, args);
+    }
+
+    public CallSite createDoubleLong(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new DoubleLong(site, metaClass, metaMethod, params, receiver, args);
+    }
+
+    public CallSite createDoubleFloat(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new DoubleFloat(site, metaClass, metaMethod, params, receiver, args);
+    }
+
+    public CallSite createDoubleDouble(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new DoubleDouble(site, metaClass, metaMethod, params, receiver, args);
+    }
 
+    public CallSite createNumberNumber(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
         return new NumberNumber(site, metaClass, metaMethod, params, receiver, args);
     }
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/f73d5517/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMetaMethod.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMetaMethod.java
b/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMetaMethod.java
index 1d945fc..7e588cc 100644
--- a/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMetaMethod.java
+++ b/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMetaMethod.java
@@ -58,4 +58,82 @@ public abstract class NumberNumberMetaMethod extends CallSiteAwareMetaMethod
{
             math = NumberMath.getMath(receiver,arg);
         }
     }
+
+    public CallSite createPojoCallSite(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        if (receiver instanceof Integer) {
+            if (args[0] instanceof Integer)
+                return createIntegerInteger(site, metaClass, metaMethod, params, receiver,
args);
+
+            if (args[0] instanceof Long)
+                return createIntegerLong(site, metaClass, metaMethod, params, receiver, args);
+
+            if (args[0] instanceof Float)
+                return createIntegerFloat(site, metaClass, metaMethod, params, receiver,
args);
+
+            if (args[0] instanceof Double)
+                return createIntegerDouble(site, metaClass, metaMethod, params, receiver,
args);
+        }
+
+        if (receiver instanceof Long) {
+            if (args[0] instanceof Integer)
+                return createLongInteger(site, metaClass, metaMethod, params, receiver, args);
+
+            if (args[0] instanceof Long)
+                return createLongLong(site, metaClass, metaMethod, params, receiver, args);
+
+            if (args[0] instanceof Float)
+                return createLongFloat(site, metaClass, metaMethod, params, receiver, args);
+
+            if (args[0] instanceof Double)
+                return createLongDouble(site, metaClass, metaMethod, params, receiver, args);
+        }
+
+        if (receiver instanceof Float) {
+            if (args[0] instanceof Integer)
+                return createFloatInteger(site, metaClass, metaMethod, params, receiver,
args);
+
+            if (args[0] instanceof Long)
+                return createFloatLong(site, metaClass, metaMethod, params, receiver, args);
+
+            if (args[0] instanceof Float)
+                return createFloatFloat(site, metaClass, metaMethod, params, receiver, args);
+
+            if (args[0] instanceof Double)
+                return createFloatDouble(site, metaClass, metaMethod, params, receiver, args);
+        }
+
+        if (receiver instanceof Double) {
+            if (args[0] instanceof Integer)
+                return createDoubleInteger(site, metaClass, metaMethod, params, receiver,
args);
+
+            if (args[0] instanceof Long)
+                return createDoubleLong(site, metaClass, metaMethod, params, receiver, args);
+
+            if (args[0] instanceof Float)
+                return createDoubleFloat(site, metaClass, metaMethod, params, receiver, args);
+
+            if (args[0] instanceof Double)
+                return createDoubleDouble(site, metaClass, metaMethod, params, receiver,
args);
+        }
+
+        return createNumberNumber(site, metaClass, metaMethod, params, receiver, args);
+    }
+
+    public abstract CallSite createIntegerInteger(CallSite site, MetaClassImpl metaClass,
MetaMethod metaMethod, Class[] params, Object receiver, Object[] args);
+    public abstract CallSite createIntegerLong(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args);
+    public abstract CallSite createIntegerFloat(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args);
+    public abstract CallSite createIntegerDouble(CallSite site, MetaClassImpl metaClass,
MetaMethod metaMethod, Class[] params, Object receiver, Object[] args);
+    public abstract CallSite createLongInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args);
+    public abstract CallSite createLongLong(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args);
+    public abstract CallSite createLongFloat(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args);
+    public abstract CallSite createLongDouble(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args);
+    public abstract CallSite createFloatInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args);
+    public abstract CallSite createFloatLong(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args);
+    public abstract CallSite createFloatFloat(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args);
+    public abstract CallSite createFloatDouble(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args);
+    public abstract CallSite createDoubleInteger(CallSite site, MetaClassImpl metaClass,
MetaMethod metaMethod, Class[] params, Object receiver, Object[] args);
+    public abstract CallSite createDoubleLong(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args);
+    public abstract CallSite createDoubleFloat(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args);
+    public abstract CallSite createDoubleDouble(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args);
+    public abstract CallSite createNumberNumber(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args);
 }

http://git-wip-us.apache.org/repos/asf/groovy/blob/f73d5517/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMinus.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMinus.java b/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMinus.java
index 81fe53d..573634c 100644
--- a/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMinus.java
+++ b/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMinus.java
@@ -43,63 +43,72 @@ public final class NumberNumberMinus extends NumberNumberMetaMethod {
         return NumberMath.subtract(left, right);
     }
 
-    public CallSite createPojoCallSite(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
-        if (receiver instanceof Integer) {
-            if (args[0] instanceof Integer)
-                return new IntegerInteger(site, metaClass, metaMethod, params, receiver,
args);
 
-            if (args[0] instanceof Long)
-                return new IntegerLong(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createIntegerInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new IntegerInteger(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Float)
-                return new IntegerFloat(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createIntegerLong(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new IntegerLong(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Double)
-                return new IntegerDouble(site, metaClass, metaMethod, params, receiver, args);
-            }
+    public CallSite createIntegerFloat(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new IntegerFloat(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-        if (receiver instanceof Long) {
-            if (args[0] instanceof Integer)
-                return new LongInteger(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createIntegerDouble(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new IntegerDouble(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Long)
-                return new LongLong(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createLongInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new LongInteger(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Float)
-                return new LongFloat(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createLongLong(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new LongLong(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Double)
-                return new LongDouble(site, metaClass, metaMethod, params, receiver, args);
-            }
+    public CallSite createLongFloat(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new LongFloat(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-        if (receiver instanceof Float) {
-            if (args[0] instanceof Integer)
-                return new FloatInteger(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createLongDouble(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new LongDouble(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Long)
-                return new FloatLong(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createFloatInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new FloatInteger(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Float)
-                return new FloatFloat(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createFloatLong(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new FloatLong(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Double)
-                return new FloatDouble(site, metaClass, metaMethod, params, receiver, args);
-            }
+    public CallSite createFloatFloat(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new FloatFloat(site, metaClass, metaMethod, params, receiver, args);
+    }
+
+    public CallSite createFloatDouble(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new FloatDouble(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-        if (receiver instanceof Double) {
-            if (args[0] instanceof Integer)
-                return new DoubleInteger(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createDoubleInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new DoubleInteger(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Long)
-                return new DoubleLong(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createDoubleLong(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new DoubleLong(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Float)
-                return new DoubleFloat(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createDoubleFloat(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new DoubleFloat(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Double)
-                return new DoubleDouble(site, metaClass, metaMethod, params, receiver, args);
-            }
+    public CallSite createDoubleDouble(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new DoubleDouble(site, metaClass, metaMethod, params, receiver, args);
+    }
 
+    public CallSite createNumberNumber(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
         return new NumberNumber(site, metaClass, metaMethod, params, receiver, args);
     }
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/f73d5517/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMultiply.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMultiply.java b/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMultiply.java
index 2f170e1..a326515 100644
--- a/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMultiply.java
+++ b/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberMultiply.java
@@ -45,63 +45,72 @@ public final class NumberNumberMultiply extends NumberNumberMetaMethod
{
         return NumberMath.multiply(left, right);
     }
 
-    public CallSite createPojoCallSite(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
-        if (receiver instanceof Integer) {
-            if (args[0] instanceof Integer)
-                return new IntegerInteger(site, metaClass, metaMethod, params, receiver,
args);
 
-            if (args[0] instanceof Long)
-                return new IntegerLong(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createIntegerInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new IntegerInteger(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Float)
-                return new IntegerFloat(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createIntegerLong(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new IntegerLong(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Double)
-                return new IntegerDouble(site, metaClass, metaMethod, params, receiver, args);
-            }
+    public CallSite createIntegerFloat(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new IntegerFloat(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-        if (receiver instanceof Long) {
-            if (args[0] instanceof Integer)
-                return new LongInteger(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createIntegerDouble(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new IntegerDouble(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Long)
-                return new LongLong(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createLongInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new LongInteger(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Float)
-                return new LongFloat(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createLongLong(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new LongLong(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Double)
-                return new LongDouble(site, metaClass, metaMethod, params, receiver, args);
-            }
+    public CallSite createLongFloat(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new LongFloat(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-        if (receiver instanceof Float) {
-            if (args[0] instanceof Integer)
-                return new FloatInteger(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createLongDouble(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new LongDouble(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Long)
-                return new FloatLong(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createFloatInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new FloatInteger(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Float)
-                return new FloatFloat(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createFloatLong(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new FloatLong(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Double)
-                return new FloatDouble(site, metaClass, metaMethod, params, receiver, args);
-            }
+    public CallSite createFloatFloat(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new FloatFloat(site, metaClass, metaMethod, params, receiver, args);
+    }
+
+    public CallSite createFloatDouble(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new FloatDouble(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-        if (receiver instanceof Double) {
-            if (args[0] instanceof Integer)
-                return new DoubleInteger(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createDoubleInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new DoubleInteger(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Long)
-                return new DoubleLong(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createDoubleLong(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new DoubleLong(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Float)
-                return new DoubleFloat(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createDoubleFloat(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new DoubleFloat(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Double)
-                return new DoubleDouble(site, metaClass, metaMethod, params, receiver, args);
-            }
+    public CallSite createDoubleDouble(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new DoubleDouble(site, metaClass, metaMethod, params, receiver, args);
+    }
 
+    public CallSite createNumberNumber(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
         return new NumberNumber(site, metaClass, metaMethod, params, receiver, args);
     }
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/f73d5517/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberPlus.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberPlus.java b/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberPlus.java
index b5b0761..33e2128 100644
--- a/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberPlus.java
+++ b/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberPlus.java
@@ -43,63 +43,71 @@ public final class NumberNumberPlus extends NumberNumberMetaMethod {
         return NumberMath.add(left, right);
     }
 
-    public CallSite createPojoCallSite(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
-        if (receiver instanceof Integer) {
-            if (args[0] instanceof Integer)
-                return new IntegerInteger(site, metaClass, metaMethod, params, receiver,
args);
+    public CallSite createIntegerInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new IntegerInteger(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Long)
-                return new IntegerLong(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createIntegerLong(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new IntegerLong(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Float)
-                return new IntegerFloat(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createIntegerFloat(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new IntegerFloat(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Double)
-                return new IntegerDouble(site, metaClass, metaMethod, params, receiver, args);
-        }
+    public CallSite createIntegerDouble(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new IntegerDouble(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-        if (receiver instanceof Long) {
-            if (args[0] instanceof Integer)
-                return new LongInteger(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createLongInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new LongInteger(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Long)
-                return new LongLong(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createLongLong(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new LongLong(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Float)
-                return new LongFloat(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createLongFloat(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new LongFloat(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Double)
-                return new LongDouble(site, metaClass, metaMethod, params, receiver, args);
-        }
+    public CallSite createLongDouble(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new LongDouble(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-        if (receiver instanceof Float) {
-            if (args[0] instanceof Integer)
-                return new FloatInteger(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createFloatInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new FloatInteger(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Long)
-                return new FloatLong(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createFloatLong(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new FloatLong(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Float)
-                return new FloatFloat(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createFloatFloat(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new FloatFloat(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Double)
-                return new FloatDouble(site, metaClass, metaMethod, params, receiver, args);
-        }
+    public CallSite createFloatDouble(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new FloatDouble(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-        if (receiver instanceof Double) {
-            if (args[0] instanceof Integer)
-                return new DoubleInteger(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createDoubleInteger(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new DoubleInteger(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Long)
-                return new DoubleLong(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createDoubleLong(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
+        return new DoubleLong(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Float)
-                return new DoubleFloat(site, metaClass, metaMethod, params, receiver, args);
+    public CallSite createDoubleFloat(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new DoubleFloat(site, metaClass, metaMethod, params, receiver, args);
+    }
 
-            if (args[0] instanceof Double)
-                return new DoubleDouble(site, metaClass, metaMethod, params, receiver, args);
-        }
+    public CallSite createDoubleDouble(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
+        return new DoubleDouble(site, metaClass, metaMethod, params, receiver, args);
+    }
 
+    public CallSite createNumberNumber(CallSite site, MetaClassImpl metaClass, MetaMethod
metaMethod, Class[] params, Object receiver, Object[] args) {
         return new NumberNumberCallSite(site, metaClass, metaMethod, params, (Number) receiver,
(Number) args[0]) {
             public Object invoke(Object receiver, Object[] args) {
                 return math.addImpl((Number) receiver, (Number) args[0]);
@@ -111,6 +119,7 @@ public final class NumberNumberPlus extends NumberNumberMetaMethod {
         };
     }
 
+
     private static class DoubleDouble extends NumberNumberCallSite {
         public DoubleDouble(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params, Object receiver, Object[] args) {
             super(site, metaClass, metaMethod, params, (Number) receiver, (Number) args[0]);


Mime
View raw message