Index: InstanceUtils.java
===================================================================
--- InstanceUtils.java	(revision 47377)
+++ InstanceUtils.java	(revision 47378)
@@ -17,10 +17,36 @@
         if( instance==null ) {
             throw new NullPointerException("An object pointer was expected to invoke method "+methodName+" and a null was received");
         }
-        Class[] parameterTypes = new Class[args.length];
-        Object[] parameters = new Object[args.length];
+        Class<?> theClass = instance.getClass();
+        Method method = getMethod(theClass, methodName, createParameterTypesAccurate(args));
+        if( method == null ) {
+            method = getMethod(theClass, methodName, createParameterTypesFuzzy(theClass, methodName, args));
+        }
+        if( method == null ) {
+            method = getMethod(theClass, methodName, createParameterTypesAllObjects(args));
+        }
+        if( method == null ) {
+            method = getMethod(theClass, methodName, createParameterTypesFromMethodNameAndParametersCount(theClass, methodName, args));
+        }
+        Object value = method.invoke(instance, args);
+        return value;
+    }
+    
+    private static Method getMethod(Class theClass, String methodName, Class[] parameterTypes) {
+        if( parameterTypes==null ) {
+            return null;
+        }
+        try {
+            return theClass.getMethod(methodName, parameterTypes);
+        } catch(NoSuchMethodException ex) {
+        }
+        return null;
+    }
+    
+    private static Class[] createParameterTypesAccurate(Object[] parameters) {
+        Class[] parameterTypes = new Class[parameters.length];
         for (int i = 0; i < parameters.length; i++) {
-            Object parameter = args[i];
+            Object parameter = parameters[i];
             parameters[i] = parameter;
             if( parameter==null ) {
                 parameterTypes[i] = null;
@@ -28,45 +54,65 @@
                 parameterTypes[i] = parameter.getClass();
             }
         }
-        Class<?> theClass = instance.getClass();
-        Method method = null;
-        try {
-            method = theClass.getMethod(methodName, parameterTypes);
-        } catch(NoSuchMethodException ex) {
+        return parameterTypes;
+    }
+    
+    private static Class[] createParameterTypesAllObjects(Object[] parameters) {
+        Class[] parameterTypes = new Class[parameters.length];
+        for (int i = 0; i < parameters.length; i++) {
+            Object parameter = parameters[i];
+            parameters[i] = parameter;
+            if( parameter==null ) {
+                parameterTypes[i] = null;
+            } else {
+                parameterTypes[i] = Object.class;
+            }
         }
-        if( method == null ) {
-            // Uf esto arregla cosas de StringBuilder.append, pero no
-            // crea que sea correcto.
-            for (int i = 0; i < parameters.length; i++) {
-                Object parameter = args[i];
-                parameters[i] = parameter;
-                if( parameter==null ) {
-                    parameterTypes[i] = null;
-                } else {
-                    parameterTypes[i] = Object.class;
-                }
+        return parameterTypes;
+    }
+    
+    private static Class[] createParameterTypesFromMethodNameAndParametersCount(Class theClass, String methodName, Object[] parameters) {
+        for (Method m : theClass.getMethods()) {
+            if( StringUtils.equals(m.getName(), methodName) && parameters.length == m.getParameterTypes().length) {
+                return m.getParameterTypes();
             }
         }
-        try {
-            method = theClass.getMethod(methodName, parameterTypes);
-        } catch(NoSuchMethodException ex) {
-        }
-        if( method == null ) {
-            // Esto es para esquivar casos como tener un ArrayList de objects y 
-            // hacer algo como  arr.add(10). Dice que no hay ningun metodo add
-            // que reciba un Integer, por que realmente el add esta declarado como
-            // que recibe un object.
-            // Ver TestInterpreter metodo testListAppend.
-            for (Method m : theClass.getMethods()) {
-                if( StringUtils.equals(m.getName(), methodName) && parameterTypes.length == m.getParameterTypes().length) {
-                    parameterTypes = m.getParameterTypes();
+        return null;
+    }
+    
+    private static Class[] createParameterTypesFuzzy(Class theClass, String methodName, Object[] parameters) {
+        for (Method m : theClass.getMethods()) {
+            if( StringUtils.equals(m.getName(), methodName) && parameters.length == m.getParameterTypes().length) {
+                int n = 0;
+                Class[] parameterTypes = new Class[parameters.length];
+                for (Class<?> expectedType : m.getParameterTypes()) {
+                    Class<? extends Object> paramType = parameters[n].getClass();
+                    if( expectedType == paramType ) {
+                        parameterTypes[n++] = expectedType;
+                        continue;
+                    }
+                    if( expectedType == Object.class ) {
+                        parameterTypes[n++] = Object.class;
+                        continue;
+                    }
+                    
+                    //
+                    // Aqui probablemente habria que hacer algunas otras 
+                    // comprobaciones, por ejemplo, si expected es double y
+                    // recibimos un entero, long o float... ¿ deberiamos
+                    // aceptar ? ¿ Habria que convertir el valor a double ?
+                    //
+                    parameterTypes = null;
                     break;
                 }
+                if( parameterTypes!=null ) {
+                    return parameterTypes;
+                }
             }
-            method = theClass.getMethod(methodName, parameterTypes);
         }
-        Object value = method.invoke(instance, parameters);
-        return value;
+        return null;
     }
     
+    
+    
 }
