[ https://issues.apache.org/jira/browse/XMLBEANS-205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Cezar Andrei resolved XMLBEANS-205. ----------------------------------- Resolution: Fixed Fix Version/s: Version 2.2.1 Fix committed with revision 530540 > using configuration file with extention interfaces restricted names of > methods in interfaces > -------------------------------------------------------------------------------------------- > > Key: XMLBEANS-205 > URL: https://issues.apache.org/jira/browse/XMLBEANS-205 > Project: XMLBeans > Issue Type: Bug > Components: Compiler > Affects Versions: Version 2 > Environment: Does not related to platform > Reporter: Denis Anisimov > Fix For: Version 2.2.1 > > > Use .xsdconfig file. > Create two different interfaces with common method name. F.e. > interface First { > void get(); > } > interface Second { > void get(); > } > Create two instructions in .xsdconfig for various bean neames from schema > file for extending these interfaces with different handlers. > F.e. > <xb:extension for="test.First"> > <xb:interface name="schema.OneEntity"> > <xb:staticHandler>handlers.FirstHandler<xb:staticHandler> > </xb:interface> > </xb:extension> > <xb:extension for="test.Second"> > <xb:interface name="schema.AnotherEntity"> > <xb:staticHandler>handlers.SecondHandler<xb:staticHandler> > </xb:interface> > </xb:extension> > You will get error about method names collisions. > Compiler will tell to you that you have collide methods in SecondHandler and > FirstHandler. > This is consequence of calling method void secondPhaseValidation() in > BindingConfigImpl.java > And this is consequence wrong comparing algorithm for MethodSignatureImpl > class. > Original equals() and hashCode() methods don't perform comparing Handler > names. So they use just method names and signature. > I suggest that those methods should be : > private boolean interfacesEqual(MethodSignature signature){ > if ( getInterfaceName()==null ){ > if (((MethodSignatureImpl)signature).getInterfaceName()!= null > ){ > return false; > } > } > else if ( > !getInterfaceName().equals(((MethodSignatureImpl)signature).getInterfaceName())){ > return false; > } > return true; > } > > private boolean lightEqual(MethodSignature signature){ > if (!signature.getName().equals(getName()) ) > return false; > String[] params = getParameterTypes(); > String[] msParams = signature.getParameterTypes(); > if (msParams.length != params.length ) > return false; > for (int i = 0; i < params.length; i++) > { > if (!msParams[i].equals(params[i])) > return false; > } > return true; > } > public boolean equals(Object o) > { > if ( !(o instanceof MethodSignature)) > return false; > MethodSignature ms = (MethodSignature)o; > > if ( !interfacesEqual(ms ) ){ > return false; > } > return lightEqual( ms ); > } > public int hashCode() > { > if (_hashCode!=NOTINITIALIZED) > return _hashCode; > int hash = getName().hashCode(); > > if (getInterfaceName() != null) { > hash *= 19; > hash += getInterfaceName().hashCode(); > } > String[] params = getParameterTypes(); > for (int i = 0; i < params.length; i++) > { > hash *= 19; > hash += params[i].hashCode(); > } > _hashCode = hash; > return _hashCode; > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]