[ 
https://issues.apache.org/jira/browse/CXF-7426?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ruslan Stelmachenko updated CXF-7426:
-------------------------------------
    Description: 
_The original issue is not mine but was closed, so I created a new issue 
because the bug still exists._

Same problem here.
Apache CXF 3.1.11 generates Java classes that have nested static classes with 
same simple name.

For example:

{code:java}
public class UserIdentificators {
    public static class Extension {
        public static class Extension {
        }
    }
}
{code}

This code doesn't compile because according to [JSL 
Specification|http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.1]
bq. It is a compile-time error if a class has the same simple name as any of 
its enclosing classes or interfaces.

I can't attach the full source WSDL. It has many imports from closed resources.
I think, the relevant part is:

{code:xml}
  <xsd:complexType name="UserIdentificators">
    <xsd:sequence>
      <xsd:element ref="ns1:userId" minOccurs="0" maxOccurs="1"/>
      <xsd:element name="extension" minOccurs="0" maxOccurs="1">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element ref="tns:anotherUserId" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="extension" minOccurs="0" maxOccurs="1">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:any processContents="lax" namespace="##any" 
minOccurs="0" maxOccurs="unbounded"/>
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>
{code}

  was:
We are using wsdl2java command for generating java classes from a wsdl url. The 
details are:

Apache CXF version: 2.7.2
Java version: 1.7.0_10

The CA certificate for specified hostname in the wsdl url is added to 
jre/lib/security/cacerts trusted store, and the wsdl2java using the same java 
command. The command we are executing given below:

>./wsdl2java -d /home/ibs01/generated/ <wsdlurl> 

The wsdlurl looks like : https://hostaname/aa/XXX_BookingManager?WSDL

Note: For security issues we cannot publish the full url

The command executed successfully and generated java classes output to 
specified directory. But some of the classes doesn’t compile due to following 
issues;

1.      Some classes contain nested inner classes (static) with same name

Eg: 

Class Response {

        public static class AbcType{

                                 @XmlElement(name = "AbcType", nillable = true)
               protected AbcType abcType;;

                public static class AbcType { //Duplicated inner class

}


}



}
2.      Some classes refer static variable from non-static manner

Can you please guide us to resolve this issue. We are sure the web services 
implementation must be perfect (it is a production environment and using by 
many consumers). We suspect we missed something here, if anyone came across 
with this type of issue please help us. If we missed any option in wsdl2java 
command or missed any configuration please guide. We get to know that the web 
services implemented in .Net framework.



> CLONE - wsdl2java command generated nested inner classes with same name
> -----------------------------------------------------------------------
>
>                 Key: CXF-7426
>                 URL: https://issues.apache.org/jira/browse/CXF-7426
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.7.2
>         Environment: Windows and Unix
>            Reporter: Ruslan Stelmachenko
>             Fix For: Invalid
>
>
> _The original issue is not mine but was closed, so I created a new issue 
> because the bug still exists._
> Same problem here.
> Apache CXF 3.1.11 generates Java classes that have nested static classes with 
> same simple name.
> For example:
> {code:java}
> public class UserIdentificators {
>     public static class Extension {
>         public static class Extension {
>         }
>     }
> }
> {code}
> This code doesn't compile because according to [JSL 
> Specification|http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.1]
> bq. It is a compile-time error if a class has the same simple name as any of 
> its enclosing classes or interfaces.
> I can't attach the full source WSDL. It has many imports from closed 
> resources.
> I think, the relevant part is:
> {code:xml}
>   <xsd:complexType name="UserIdentificators">
>     <xsd:sequence>
>       <xsd:element ref="ns1:userId" minOccurs="0" maxOccurs="1"/>
>       <xsd:element name="extension" minOccurs="0" maxOccurs="1">
>         <xsd:complexType>
>           <xsd:sequence>
>             <xsd:element ref="tns:anotherUserId" minOccurs="0" maxOccurs="1"/>
>             <xsd:element name="extension" minOccurs="0" maxOccurs="1">
>               <xsd:complexType>
>                 <xsd:sequence>
>                   <xsd:any processContents="lax" namespace="##any" 
> minOccurs="0" maxOccurs="unbounded"/>
>                 </xsd:sequence>
>               </xsd:complexType>
>             </xsd:element>
>           </xsd:sequence>
>         </xsd:complexType>
>       </xsd:element>
>     </xsd:sequence>
>   </xsd:complexType>
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to