You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2017/08/01 19:01:00 UTC

[jira] [Resolved] (CXF-7426) CLONE - wsdl2java command generated nested inner classes with same name

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

Daniel Kulp resolved CXF-7426.
------------------------------
    Resolution: Not A Problem
      Assignee: Daniel Kulp

Resolving as "Not a Problem", though it probably should be "Won't Fix".   Couple reasons:

1) This is a JAXB issue as we pass the schema off to JAXB to generate the code and JAXB does whatever it does according to the JAXB spec.

2) Both JAXB and JAX-WS specifically have cases that will generate code that is invalid and won't compile.   The generated code is per-spec, but still won't compile.  This is one of those cases.   To get it to generate compilable code, you MUST use a customization file to customize the class name that is generated.

> 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
>            Assignee: Daniel Kulp
>             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)