Hi Keith,

Thanks a lot - the generated source now compiles! (Still didn't have a chance to test 
with it, but I have confidence it will work)

great thanks,

--Tim

-----Original Message-----
From: Keith Visco [mailto:[EMAIL PROTECTED]
Sent: dinsdag 24 februari 2004 22:21
To: castor-dev
Subject: Re: [castor-dev] Castor 0.9.5.3 RC2 generates uncompilable code
for JDK1.3!




Tim,

Can you retry this, I placed a new copy of the 0.9.5.3 RC2 jar amd zip
on the ftp site that contains a fix for this issue....it changes the
generated code from:

return java.lang.Boolean.valueOf(fieldName);

to:

return (fieldName ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);

This way were still prevent the creation new Boolean instances
unecessarily and it should be backward compatible with all JDK versions.

Thanks,

--Keith


"Leeuw van der, Tim" wrote:
> 
> Hi,
> 
> I just downloaded the latest RC, re-built my code with the SourceGenerator, and now 
> I get a compile-error.
> 
> The XML Schema specifies a boolean type for field 'windbackInd'.
> 
>         <xsd:complexType name="RequestEnvelope">
>                 <xsd:sequence>
> [...]
>                         <xsd:element name="windbackInd" type="boolean"/>
>                 </xsd:sequence>
>         </xsd:complexType>
> 
> For this, the RC1 generated a RequestEnvelopeDescriptor containing the following 
> declaration for field windbackInd:
> 
>         handler = (new org.exolab.castor.xml.XMLFieldHandler() {
>             public java.lang.Object getValue( java.lang.Object object )
>                 throws IllegalStateException
>             {
>                 RequestEnvelope target = (RequestEnvelope) object;
>                 if(!target.hasWindbackInd())
>                     return null;
>                 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>                 // This is the relevant bit!!
>                 return new java.lang.Boolean(target.getWindbackInd());
>                 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>             }
>             public void setValue( java.lang.Object object, java.lang.Object value)
>                 throws IllegalStateException, IllegalArgumentException
>             {
>                 try {
>                     RequestEnvelope target = (RequestEnvelope) object;
>                     // ignore null values for non optional primitives
>                     if (value == null) return;
> 
>                     target.setWindbackInd( 
> ((java.lang.Boolean)value).booleanValue());
>                 }
>                 catch (java.lang.Exception ex) {
>                     throw new IllegalStateException(ex.toString());
>                 }
>             }
>             public java.lang.Object newInstance( java.lang.Object parent ) {
>                 return null;
>             }
>         } );
> 
> With the new RC2 the following code is generated:
> 
>         handler = (new org.exolab.castor.xml.XMLFieldHandler() {
>             public java.lang.Object getValue( java.lang.Object object )
>                 throws IllegalStateException
>             {
>                 RequestEnvelope target = (RequestEnvelope) object;
>                 if(!target.hasWindbackInd())
>                     return null;
>                 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>                 // This is the bit which my compiler doesn't like  !!
>                 return java.lang.Boolean.valueOf(target.getWindbackInd());
>                 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>             }
>             public void setValue( java.lang.Object object, java.lang.Object value)
>                 throws IllegalStateException, IllegalArgumentException
>             {
>                 try {
>                     RequestEnvelope target = (RequestEnvelope) object;
>                     // ignore null values for non optional primitives
>                     if (value == null) return;
> 
>                     target.setWindbackInd( 
> ((java.lang.Boolean)value).booleanValue());
>                 }
>                 catch (java.lang.Exception ex) {
>                     throw new IllegalStateException(ex.toString());
>                 }
>             }
>             public java.lang.Object newInstance( java.lang.Object parent ) {
>                 return null;
>             }
>         } );
> 
> Checking the JDK javadoc, the method Boolean.valueOf(boolean b) is new since jdk 
> 1.4, so my jdk 1.3 level compiler complains about it.
> 
> I'm not aware of any 'target-jdk' parameter for SourceGenerator, but perhaps it 
> should be added so that more efficient code can be generated for the new JDK only, 
> and not for those of us stuck on the older JDKs?
> 
> With regards,
> 
> --Tim
> 
> -----Original Message-----
> From: Keith Visco [mailto:[EMAIL PROTECTED]
> Sent: maandag 23 februari 2004 22:00
> To: castor-dev
> Subject: [castor-dev] Castor 0.9.5.3 RC2
> 
> Hi all,
> 
> Thanks for the feedback on Castor 0.9.5.3 RC1, We've fixed some
> regression issues and I've put a copy of Castor 0.9.5.3 RC2 on the ftp
> server. I'll update the website soon to indicate this.
> 
> Please try this release and report any regression issues that you
> experience.
> 
> ftp://ftp.exolab.org/pub/castor/castor_0.9.5.3/
> 
> Thanks,
> 
> --Keith
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to