Edward, thanks for sending the patch, I modified the check to avoid the case when there are different return types but to allow your scenario.
Cezar > -----Original Message----- > From: Edward Frederick [mailto:[EMAIL PROTECTED] > Sent: Saturday, January 21, 2006 7:11 PM > To: dev@xmlbeans.apache.org > Subject: Bug in Extensions Validation > > Hello, > > As you may recall from my previous messages, I'm using the new > extensions to add a method to a hierarchy of types. > > I think I've discovered a bug in the validation for method > collisions--I'm able to get my desired functionality, but only after > commenting out a chunk of validation code in > org.apache.xmlbeans.impl.config.BindingConfigImpl: > > /* > if (methodSignatures.containsKey(methods[j])) > { > > InterfaceExtensionImpl.MethodSignatureImpl ms2 = > (InterfaceExtensionImpl.MethodSignatureImpl) > methodSignatures.get(methods[j]); > BindingConfigImpl.error("Colliding methods '" + > ms.getSignature() + "' in interfaces " + > ms.getInterfaceName() + " and " + > ms2.getInterfaceName() + ".", null); > > return; > } > */ > > > An error is falsely detected when one type extends another and they > both implement the same extension interface but with a different > static handler. > > Example: > > XSD: > > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > > <xsd:element name="base-instance" type="base-type"/> > <xsd:element name="child-instance" type="child-type"/> > > <xsd:complexType name="base-type"> > <xsd:sequence> > <xsd:element name="baseString" type="xsd:string"/> > </xsd:sequence> > </xsd:complexType> > > <xsd:complexType name="child-type"> > <xsd:complexContent> > <xsd:extension base="base-type"> > <xsd:sequence> > <xsd:element name="childString" type="xsd:string"/> > </xsd:sequence> > </xsd:extension> > </xsd:complexContent> > </xsd:complexType> > > </xsd:schema> > > > XSDCONFIG: > > <xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config"> > > <xb:extension for="noNamespace.BaseType"> > <xb:interface name="ExtIf"> > <xb:staticHandler>Handler</xb:staticHandler> > </xb:interface> > </xb:extension> > <xb:extension for="noNamespace.ChildType"> > <xb:interface name="ExtIf"> > <xb:staticHandler>Handler2</xb:staticHandler> > </xb:interface> > </xb:extension> > </xb:config> > > ExtIf.java: > > public interface ExtIf { > > public void delegate(); > } > > > Handler.java: > > import org.apache.xmlbeans.XmlObject; > > public class Handler { > public static void delegate(XmlObject xo){} > } > > > Handler2.java: > > import org.apache.xmlbeans.XmlObject; > > public class Handler2 { > public static void delegate(XmlObject xo){} > } > > > > When I compile the above scheme with the trunk, I get a collision > error. If I comment out the validation, I get the expected (and > desired) result: > > noNamespace/impl/BaseTypeImpl.java: > > ... > public void delegate() > { > Handler.delegate(this); > } > .. > > > noNamespace/impl/ChildTypeImpl.java: > > ... > public void delegate() > { > Handler2.delegate(this); > } > .. > > > I think this behavior is important so that you can get nice > polymorphism at the XmlObject level even when using static handlers. > > I'd like to submit a patch to fix the validation, but I don't think I > am sophisticated enough (with respect to XMLBeans) to pull it off > right now. > > Any ideas? > > Thanks, > > Ed > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]