cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kosta Krauth (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CXF-5824) cxf-xjc-dv generates code that cannot be compiled
Date Thu, 26 Jun 2014 11:04:24 GMT

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

Kosta Krauth updated CXF-5824:
------------------------------

    Description: 
After updating to CXF 3.0.0 I noticed compile errors in classes generated from XSDs using
wsdl2java with cxf-xjc-dv plugin.

The problematic piece of generated code showed up in a couple of places and looked like this:
{code}
protected List<ExternalItem> redemptions = new List<ExternalItem>();
{code}

Resulting in "Cannot instantiate the type List" error. The type list in this case was not
a custom class but the standard java collections interface java.util.List.

My setup is (roughly) as follows:

*Schema definition*

{code}
<s:element name="itemRedemption">
    <s:complexType>
      <s:sequence>
        <s:element name="userId" type="s:string" />
        <s:element name="redemptions" maxOccurs="unbounded" type="tns:externalItem" />
      </s:sequence>
    </s:complexType>
  </s:element>
  
  <s:complexType name="externalItem">
    <s:sequence>
      <s:element minOccurs="0" name="redemptionNumber" type="s:string" />
    </s:sequence>
  </s:complexType>
{code}

*Maven config*


{code}
...
  <properties>
    <cxf.version>3.0.0</cxf.version>
  </properties>
...
<plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-codegen-plugin</artifactId>
        <version>${cxf.version}</version>

        <configuration>
          <encoding>UTF-8</encoding>
          <wsdlRoot>${basedir}/src/main/webapp/WEB-INF/wsdl</wsdlRoot>
          <includes>
            <include>*Service.wsdl</include>
          </includes>
          <defaultOptions>
            <bareMethods />
            <extraargs>
              <extraarg>-xjc-b,${basedir}/src/main/resources/jaxb-bindings.xml</extraarg>
              <extraarg>-xjc-Xdv</extraarg> <!-- Activates plugin for default
value support -->
              <extraarg>-xjc-Xbgi</extraarg> <!-- Creates both get/is methods
for booleans -->
            </extraargs>
          </defaultOptions>
        </configuration>

        <executions>
          <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>wsdl2java</goal>
            </goals>
          </execution>
        </executions>

        <dependencies>
          <dependency>
            <groupId>org.apache.cxf.xjcplugins</groupId>
            <artifactId>cxf-xjc-dv</artifactId>
            <version>${cxf.version}</version>
          </dependency>
          <dependency>
            <groupId>org.apache.cxf.xjcplugins</groupId>
            <artifactId>cxf-xjc-boolean</artifactId>
            <version>${cxf.version}</version>
          </dependency>
        </dependencies>
      </plugin>
{code}

If I change the version of cxf-xjc-dv to 2.7.0, this problem does not happen.

  was:
After updating to CXF 3.0.0 I noticed compile errors in classes generated from XSDs using
wsdl2java with cxf-xjc-dv plugin.

The problematic piece of generated code showed up in a couple of places and looked like this:
{code}
protected List<ExternalItem> redemptions = new List<ExternalItem>();
{code}

Resulting in "Cannot instantiate the type List" error. The type list in this case was not
a custom class but the standard java collections interface java.util.List.

My setup is (roughly) as follows:

*Schema definition*

{code}
<s:element name="itemRedemption">
    <s:complexType>
      <s:sequence>
        <s:element name="userId" type="s:string" />
        <s:element name="redemptions" maxOccurs="unbounded" type="tns:externalItem" />
      </s:sequence>
    </s:complexType>
  </s:element>
  
  <s:complexType name="externalItem">
    <s:sequence>
      <s:element minOccurs="0" name="redemptionNumber" type="s:string" />
    </s:sequence>
  </s:complexType>
{code}

* Maven config *


{code}
...
  <properties>
    <cxf.version>3.0.0</cxf.version>
  </properties>
...
<plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-codegen-plugin</artifactId>
        <version>${cxf.version}</version>

        <configuration>
          <encoding>UTF-8</encoding>
          <wsdlRoot>${basedir}/src/main/webapp/WEB-INF/wsdl</wsdlRoot>
          <includes>
            <include>*Service.wsdl</include>
          </includes>
          <defaultOptions>
            <bareMethods />
            <extraargs>
              <extraarg>-xjc-b,${basedir}/src/main/resources/jaxb-bindings.xml</extraarg>
              <extraarg>-xjc-Xdv</extraarg> <!-- Activates plugin for default
value support -->
              <extraarg>-xjc-Xbgi</extraarg> <!-- Creates both get/is methods
for booleans -->
            </extraargs>
          </defaultOptions>
        </configuration>

        <executions>
          <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>wsdl2java</goal>
            </goals>
          </execution>
        </executions>

        <dependencies>
          <dependency>
            <groupId>org.apache.cxf.xjcplugins</groupId>
            <artifactId>cxf-xjc-dv</artifactId>
            <version>${cxf.version}</version>
          </dependency>
          <dependency>
            <groupId>org.apache.cxf.xjcplugins</groupId>
            <artifactId>cxf-xjc-boolean</artifactId>
            <version>${cxf.version}</version>
          </dependency>
        </dependencies>
      </plugin>
{code}

If I change the version of cxf-xjc-dv to 2.7.0, this problem does not happen.


> cxf-xjc-dv generates code that cannot be compiled
> -------------------------------------------------
>
>                 Key: CXF-5824
>                 URL: https://issues.apache.org/jira/browse/CXF-5824
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 3.0.0
>            Reporter: Kosta Krauth
>
> After updating to CXF 3.0.0 I noticed compile errors in classes generated from XSDs using
wsdl2java with cxf-xjc-dv plugin.
> The problematic piece of generated code showed up in a couple of places and looked like
this:
> {code}
> protected List<ExternalItem> redemptions = new List<ExternalItem>();
> {code}
> Resulting in "Cannot instantiate the type List" error. The type list in this case was
not a custom class but the standard java collections interface java.util.List.
> My setup is (roughly) as follows:
> *Schema definition*
> {code}
> <s:element name="itemRedemption">
>     <s:complexType>
>       <s:sequence>
>         <s:element name="userId" type="s:string" />
>         <s:element name="redemptions" maxOccurs="unbounded" type="tns:externalItem"
/>
>       </s:sequence>
>     </s:complexType>
>   </s:element>
>   
>   <s:complexType name="externalItem">
>     <s:sequence>
>       <s:element minOccurs="0" name="redemptionNumber" type="s:string" />
>     </s:sequence>
>   </s:complexType>
> {code}
> *Maven config*
> {code}
> ...
>   <properties>
>     <cxf.version>3.0.0</cxf.version>
>   </properties>
> ...
> <plugin>
>         <groupId>org.apache.cxf</groupId>
>         <artifactId>cxf-codegen-plugin</artifactId>
>         <version>${cxf.version}</version>
>         <configuration>
>           <encoding>UTF-8</encoding>
>           <wsdlRoot>${basedir}/src/main/webapp/WEB-INF/wsdl</wsdlRoot>
>           <includes>
>             <include>*Service.wsdl</include>
>           </includes>
>           <defaultOptions>
>             <bareMethods />
>             <extraargs>
>               <extraarg>-xjc-b,${basedir}/src/main/resources/jaxb-bindings.xml</extraarg>
>               <extraarg>-xjc-Xdv</extraarg> <!-- Activates plugin for
default value support -->
>               <extraarg>-xjc-Xbgi</extraarg> <!-- Creates both get/is
methods for booleans -->
>             </extraargs>
>           </defaultOptions>
>         </configuration>
>         <executions>
>           <execution>
>             <id>generate-sources</id>
>             <phase>generate-sources</phase>
>             <goals>
>               <goal>wsdl2java</goal>
>             </goals>
>           </execution>
>         </executions>
>         <dependencies>
>           <dependency>
>             <groupId>org.apache.cxf.xjcplugins</groupId>
>             <artifactId>cxf-xjc-dv</artifactId>
>             <version>${cxf.version}</version>
>           </dependency>
>           <dependency>
>             <groupId>org.apache.cxf.xjcplugins</groupId>
>             <artifactId>cxf-xjc-boolean</artifactId>
>             <version>${cxf.version}</version>
>           </dependency>
>         </dependencies>
>       </plugin>
> {code}
> If I change the version of cxf-xjc-dv to 2.7.0, this problem does not happen.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message