For now I have worked around this by adding some code to ProxyBuilder.addServiceMethods that avoids that methods are being added twice. Not sure if this is a good patch, as addServiceMethods should probably check, if these methods are really defined in different interfaces. But works for now. Code below.

This issue is related to issue 39 (http://issues.apache.org/jira/browse/HIVEMIND-39). Here combining two interfaces into one was suggested as a way to write a service that has multiple interfaces, but the fact that two interfaces ARE ALLOWED to have similar methods was not taken into account.

My new ProxyBuilder.addServiceMethods():

   public void addServiceMethods(String indirection)
   {
       // use a local map to remember all method signatures
       java.util.Map methodMap = new java.util.HashMap();
       BodyBuilder builder = new BodyBuilder();
       boolean toString = false;

Method[] methods = _serviceInterface.getMethods();
for (int i = 0; i < methods.length; i++)
{
Method m = methods[i];
builder.clear();
builder.begin();
builder.add("return ($r) ");
builder.add(indirection);
builder.add(".");
builder.add(m.getName());
builder.addln("($$);");
builder.end();
// only add new methods, ignore ones with signatures that have already been added to proxy.
if (!methodMap.containsKey(new MethodSignature(m))) {
methodMap.put(new MethodSignature(m), null);
_classFab.addMethod(Modifier.PUBLIC, new MethodSignature(m), builder.toString());
}
toString |= ClassFabUtils.isToString(m);
}


       if (!toString)
           ClassFabUtils.addToStringMethod(
               _classFab,
               "<"
                   + _type
                   + " for "
                   + _point.getExtensionPointId()
                   + "("
                   + _serviceInterface.getName()
                   + ")>");
   }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to