axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Canning (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Created: (AXIS-1843) Non-default constructor generated for complex type should take parameters to initialize base class properties
Date Sat, 05 Mar 2005 07:05:46 GMT
Non-default constructor generated for complex type should take parameters to initialize base
class properties
-------------------------------------------------------------------------------------------------------------

         Key: AXIS-1843
         URL: http://issues.apache.org/jira/browse/AXIS-1843
     Project: Axis
        Type: Bug
  Components: WSDL processing  
    Versions: 1.2RC2, 1.2RC3    
 Environment: Linux (debian testing distribution)
JDK 1.5.0_01
Axis 1.2RC3 
    Reporter: Peter Canning
 Attachments: test.wsdl

WSDL2Java creates a JavaBean class corresponding to a complexType in the WSDL. The JavaBean
class contains properties for each element in the complexType. The JavaBean class also contains
a default constructor as well as a constructor taking a parameter for each property.  However
when the complexType is an extension of another complexType the non-default constructor does
not take parameters for the properties of the corresponding base class.  This forces clients
to use property set methods to initialize the base class properties.  This is both inconvenient
and error prone.  The problem is even more serious when the complexType extension hierarchy
(and the corresponding class hierarchy) is multiple levels deep.

For example, when processing the attached WSDL file with

java -cp $AXISRC3_JARS org.apache.axis.wsdl.WSDL2Java -O -1 -p org.imaginary.test -o axis_stubs
test.wsdl

it produces constructors
    public Base(
           java.lang.String x,
           int y) {
           this.x = x;
           this.y = y;
    }
and
    public Derived(
           java.lang.String a,
           java.lang.String b,
           java.lang.Boolean c) {
           this.a = a;
           this.b = b;
           this.c = c;
    }
The second constructor should be
    public Derived(
           java.lang.String x,
           int y,
           java.lang.String a,
           java.lang.String b,
           java.lang.Boolean c) {
           super(x, y);
           this.a = a;
           this.b = b;
           this.c = c;
    }
This would (1) allow use of the constructor to guarantee that all the properties are initialized,
and (2) allow creating instances of class Derived in a declarative manner.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Mime
View raw message