Hi,

Zdenko wrote:

> Hi,
> When deserializing following XML
> <Outer type="1">
>    <Inner>
>    </Inner>
> <Outer>
> 
> this pointer of enclosing object is null.
>  Java classes:
> class Outer {
>    String type;
>    class Inner {
> 
>       void Outer getOuterObject() {
>          return Outer.this;
>       }
>    }
> }
> 
> Java compiler will create implicit constructor. Something like this:
> class Outer {
>    String type;
>    class Inner {
>       Outer this$0;
>       Inner(Outer th) {
>          super();
>          this$0 = th;
>       }
>       void Outer getOuterObject() {
>          return Outer.this;
>       }
>    }
> }
> 
> XStream creates Inner object by not invoking proper constructor (my
> guess). Proper way of initialization should be:
> Outer outer = new Outer();
> Inner inner = outer.new Inner();

XStream does not call any constructor (just like Java serialization), it 
does not have to:
http://xstream.codehaus.org/faq.html#Serialization_no_ctor_running

- Jörg


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to