If we have class Foo with method:
public class Foo {
public void bar(Object a, String b) {}
}
then MethodCall fails if we invoke:
dispatcher.callRemoteMethods(null, "bar", new Object[]
{"hello", "world"}, new Class[]
{String.class,String.class}, ...);
because the first formal parameter of foo() is an Object and the arg a String, and we do an equals() on the 2 classes.
Solution: use Class.isAssignableFrom(Class)