[prev in list] [next in list] [prev in thread] [next in thread]
List: xmlbeans-dev
Subject: RE: Bug in Extensions Validation
From: "Cezar Andrei" <cezar () bea ! com>
Date: 2006-01-23 22:40:54
Message-ID: 99479F4D39C9244F8E17E688193A3DD81F0A18 () repbex02 ! amer ! bea ! com
[Download RAW message or body]
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:epfrederick@gmail.com]
> 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: dev-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: dev-help@xmlbeans.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic