Lambda deserialization failing with XStream 1.4.7 and JDK 1.8ea40 (64-bit)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Lambda deserialization failing with XStream 1.4.7 and JDK 1.8ea40 (64-bit)

Tobias Gierke
Hi,

It seems we're not able to deserialize Lambda expressions with XStream 1.4.7

The code in question looks roughly like this:

@FunctionalInterface
public interface Visible extends Serializable {
     public boolean isVisible();
}

public interface IMenuItem extends Serializable {
     // ... stuff omitted ...
}

public abstract class AbstractMenuItem implements IMenuItem {
     private final Visible visibilityFunction;
     // ... stuff omitted ...
}

The method that is invoked with lambda expressions (that later get
stored in the 'visibilityFunction' field of an AbstractMenuItem subclass
instance) looks like this:

public <T extends Page> void addEntry(String resourceLabel , Class<T>
pageClazz,Visible visibilityFunction);

Since the Visible interface extends Serializable , the compiler
generates code for a serializable Lambda (and in fact it does, I checked
the generated .class file with javap).

The code used to setup XStream looks like this:

     private XStream createXStream()
     {
         final XStream xstream = new XStream( new StaxDriver() ) {
             @Override
             protected MapperWrapper wrapMapper(MapperWrapper next) {
                 return new WicketProxyMapper( new CGLIBMapper( new
HibernateMapper(next) ) ); //
             }
         };

         // override the built-in DynamicProxyConverter that chokes on
Apache Wicket proxies
          xstream.registerConverter( new WicketProxyConverter() ,
XStream.PRIORITY_VERY_HIGH );

         // register Hibernate-specific converters
         xstream.registerConverter(new HibernateProxyConverter());
         xstream.registerConverter(new
HibernatePersistentCollectionConverter(xstream.getMapper()));
         xstream.registerConverter(new
HibernatePersistentMapConverter(xstream.getMapper()));
         xstream.registerConverter(new
HibernatePersistentSortedMapConverter(xstream.getMapper()));
         xstream.registerConverter(new
HibernatePersistentSortedSetConverter(xstream.getMapper()));

         // register CGLLib converters
         xstream.registerConverter(new
CGLIBEnhancedConverter(xstream.getMapper(),
xstream.getReflectionProvider() , getClass().getClassLoader() ) );

         return xstream;
     }


Before I start diving into the world of invokedynamic and method handles
, did anybody else encounter this issue and knows how to solve it ?

Cheers,
Tobias


com.thoughtworks.xstream.converters.ConversionException:
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
:
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
---- Debugging information ----
message             :
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
cause-exception     :
com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       :
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
class               :
com.vodecc.voipmng.boundary.wicket.general.PageWithHeaderAndFooter$11
required-type       :
com.vodecc.voipmng.boundary.wicket.general.PageWithHeaderAndFooter$11
converter-type      :
com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path                :
/com.vodecc.voipmng.boundary.wicket.trunkmonitor.TrunkMonitorPage/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1$1[2]/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SubMenuList/children/children/org.apache.wicket.markup.html.list.ListItem/children/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$NestedListEntry$1/children/org.apache.wicket.markup.html.list.ListItem[3]/children/children/val$visibilityFunction
line number         : 1
class[1]            :
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SimpleListEntry
class[2]            : org.apache.wicket.markup.html.list.ListItem
class[3]            : [Ljava.lang.Object;
converter-type[1]   :
com.thoughtworks.xstream.converters.collections.ArrayConverter
class[4]            :
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$NestedListEntry$1
class[5]            :
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$NestedListEntry
class[6]            :
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SubMenuList$1
class[7]            :
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SubMenuList
class[8]            :
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1$1
class[9]            :
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1
class[10]           :
com.vodecc.voipmng.boundary.wicket.trunkmonitor.TrunkMonitorPage
version             : not available
-------------------------------


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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Lambda deserialization failing with XStream 1.4.7 and JDK 1.8ea40 (64-bit)

Tobias Gierke
Sorry, forgot to add stack trace (added to end of mail).

> Hi,
>
> It seems we're not able to deserialize Lambda expressions with XStream
> 1.4.7
>
> The code in question looks roughly like this:
>
> @FunctionalInterface
> public interface Visible extends Serializable {
>     public boolean isVisible();
> }
>
> public interface IMenuItem extends Serializable {
>     // ... stuff omitted ...
> }
>
> public abstract class AbstractMenuItem implements IMenuItem {
>     private final Visible visibilityFunction;
>     // ... stuff omitted ...
> }
>
> The method that is invoked with lambda expressions (that later get
> stored in the 'visibilityFunction' field of an AbstractMenuItem
> subclass instance) looks like this:
>
> public <T extends Page> void addEntry(String resourceLabel , Class<T>
> pageClazz,Visible visibilityFunction);
>
> Since the Visible interface extends Serializable , the compiler
> generates code for a serializable Lambda (and in fact it does, I
> checked the generated .class file with javap).
>
> The code used to setup XStream looks like this:
>
>     private XStream createXStream()
>     {
>         final XStream xstream = new XStream( new StaxDriver() ) {
>             @Override
>             protected MapperWrapper wrapMapper(MapperWrapper next) {
>                 return new WicketProxyMapper( new CGLIBMapper( new
> HibernateMapper(next) ) ); //
>             }
>         };
>
>         // override the built-in DynamicProxyConverter that chokes on
> Apache Wicket proxies
>          xstream.registerConverter( new WicketProxyConverter() ,
> XStream.PRIORITY_VERY_HIGH );
>
>         // register Hibernate-specific converters
>         xstream.registerConverter(new HibernateProxyConverter());
>         xstream.registerConverter(new
> HibernatePersistentCollectionConverter(xstream.getMapper()));
>         xstream.registerConverter(new
> HibernatePersistentMapConverter(xstream.getMapper()));
>         xstream.registerConverter(new
> HibernatePersistentSortedMapConverter(xstream.getMapper()));
>         xstream.registerConverter(new
> HibernatePersistentSortedSetConverter(xstream.getMapper()));
>
>         // register CGLLib converters
>         xstream.registerConverter(new
> CGLIBEnhancedConverter(xstream.getMapper(),
> xstream.getReflectionProvider() , getClass().getClassLoader() ) );
>
>         return xstream;
>     }
>
>
> Before I start diving into the world of invokedynamic and method
> handles , did anybody else encounter this issue and knows how to solve
> it ?
>
> Cheers,
> Tobias
>
>
> com.thoughtworks.xstream.converters.ConversionException:
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
> :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
> ---- Debugging information ----
> message             :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
> cause-exception     :
> com.thoughtworks.xstream.mapper.CannotResolveClassException
> cause-message       :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
> class               :
> com.vodecc.voipmng.boundary.wicket.general.PageWithHeaderAndFooter$11
> required-type       :
> com.vodecc.voipmng.boundary.wicket.general.PageWithHeaderAndFooter$11
> converter-type      :
> com.thoughtworks.xstream.converters.reflection.ReflectionConverter
> path                :
> /com.vodecc.voipmng.boundary.wicket.trunkmonitor.TrunkMonitorPage/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1$1[2]/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SubMenuList/children/children/org.apache.wicket.markup.html.list.ListItem/children/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$NestedListEntry$1/children/org.apache.wicket.markup.html.list.ListItem[3]/children/children/val$visibilityFunction
> line number         : 1
> class[1]            :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SimpleListEntry
> class[2]            : org.apache.wicket.markup.html.list.ListItem
> class[3]            : [Ljava.lang.Object;
> converter-type[1]   :
> com.thoughtworks.xstream.converters.collections.ArrayConverter
> class[4]            :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$NestedListEntry$1
> class[5]            :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$NestedListEntry
> class[6]            :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SubMenuList$1
> class[7]            :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SubMenuList
> class[8]            :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1$1
> class[9]            :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1
> class[10]           :
> com.vodecc.voipmng.boundary.wicket.trunkmonitor.TrunkMonitorPage
> version             : not available
> -------------------------------
>
Caused by: com.thoughtworks.xstream.mapper.CannotResolveClassException:
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$129/1127212197
     at
com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:79)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:55)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.PackageAliasingMapper.realClass(PackageAliasingMapper.java:88)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.ClassAliasingMapper.realClass(ClassAliasingMapper.java:79)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.ArrayMapper.realClass(ArrayMapper.java:74)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.SecurityMapper.realClass(SecurityMapper.java:71)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.CGLIBMapper.realClass(CGLIBMapper.java:55)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.voipfuture.voipmng.core.util.xstream.WicketProxyMapper.realClass(WicketProxyMapper.java:46)
     at
com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
     at
com.thoughtworks.xstream.mapper.CachingMapper.realClass(CachingMapper.java:47)
     at
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:401)
     at
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:257)
     at
com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
     ... 153 more


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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Lambda deserialization failing with XStream 1.4.7 and JDK 1.8ea40 (64-bit)

Jörg Schaible-2
In reply to this post by Tobias Gierke
Hi Tobias,

it seems you're the first one who tries to serialize something like that.
Please open a JIRA issue and I try to look into it in the next two weeks.

Cheers,
Jörg

Tobias Gierke wrote:

> Hi,
>
> It seems we're not able to deserialize Lambda expressions with XStream
> 1.4.7
>
> The code in question looks roughly like this:
>
> @FunctionalInterface
> public interface Visible extends Serializable {
>      public boolean isVisible();
> }
>
> public interface IMenuItem extends Serializable {
>      // ... stuff omitted ...
> }
>
> public abstract class AbstractMenuItem implements IMenuItem {
>      private final Visible visibilityFunction;
>      // ... stuff omitted ...
> }
>
> The method that is invoked with lambda expressions (that later get
> stored in the 'visibilityFunction' field of an AbstractMenuItem subclass
> instance) looks like this:
>
> public <T extends Page> void addEntry(String resourceLabel , Class<T>
> pageClazz,Visible visibilityFunction);
>
> Since the Visible interface extends Serializable , the compiler
> generates code for a serializable Lambda (and in fact it does, I checked
> the generated .class file with javap).
>
> The code used to setup XStream looks like this:
>
>      private XStream createXStream()
>      {
>          final XStream xstream = new XStream( new StaxDriver() ) {
>              @Override
>              protected MapperWrapper wrapMapper(MapperWrapper next) {
>                  return new WicketProxyMapper( new CGLIBMapper( new
> HibernateMapper(next) ) ); //
>              }
>          };
>
>          // override the built-in DynamicProxyConverter that chokes on
> Apache Wicket proxies
>           xstream.registerConverter( new WicketProxyConverter() ,
> XStream.PRIORITY_VERY_HIGH );
>
>          // register Hibernate-specific converters
>          xstream.registerConverter(new HibernateProxyConverter());
>          xstream.registerConverter(new
> HibernatePersistentCollectionConverter(xstream.getMapper()));
>          xstream.registerConverter(new
> HibernatePersistentMapConverter(xstream.getMapper()));
>          xstream.registerConverter(new
> HibernatePersistentSortedMapConverter(xstream.getMapper()));
>          xstream.registerConverter(new
> HibernatePersistentSortedSetConverter(xstream.getMapper()));
>
>          // register CGLLib converters
>          xstream.registerConverter(new
> CGLIBEnhancedConverter(xstream.getMapper(),
> xstream.getReflectionProvider() , getClass().getClassLoader() ) );
>
>          return xstream;
>      }
>
>
> Before I start diving into the world of invokedynamic and method handles
> , did anybody else encounter this issue and knows how to solve it ?
>
> Cheers,
> Tobias
>
>
> com.thoughtworks.xstream.converters.ConversionException:
>
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
> :
>
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
> ---- Debugging information ----
> message             :
>
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
> cause-exception     :
> com.thoughtworks.xstream.mapper.CannotResolveClassException
> cause-message       :
>
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
> class               :
> com.vodecc.voipmng.boundary.wicket.general.PageWithHeaderAndFooter$11
> required-type       :
> com.vodecc.voipmng.boundary.wicket.general.PageWithHeaderAndFooter$11
> converter-type      :
> com.thoughtworks.xstream.converters.reflection.ReflectionConverter
> path                :
>
/com.vodecc.voipmng.boundary.wicket.trunkmonitor.TrunkMonitorPage/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1$1[2]/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SubMenuList/children/children/org.apache.wicket.markup.html.list.ListItem/children/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$NestedListEntry$1/children/org.apache.wicket.markup.html.list.ListItem[3]/children/children/val$visibilityFunction

> line number         : 1
> class[1]            :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SimpleListEntry
> class[2]            : org.apache.wicket.markup.html.list.ListItem
> class[3]            : [Ljava.lang.Object;
> converter-type[1]   :
> com.thoughtworks.xstream.converters.collections.ArrayConverter
> class[4]            :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$NestedListEntry$1
> class[5]            :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$NestedListEntry
> class[6]            :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SubMenuList$1
> class[7]            :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SubMenuList
> class[8]            :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1$1
> class[9]            :
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1
> class[10]           :
> com.vodecc.voipmng.boundary.wicket.trunkmonitor.TrunkMonitorPage
> version             : not available
> -------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email



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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Lambda deserialization failing with XStream 1.4.7 and JDK 1.8ea40 (64-bit)

Tobias Gierke
Hi Jörg,

I created a JIRA issue: http://jira.codehaus.org/browse/XSTR-767

Thanks for looking into this!

Cheers,
Tobias


> Hi Tobias,
>
> it seems you're the first one who tries to serialize something like that.
> Please open a JIRA issue and I try to look into it in the next two weeks.
>
> Cheers,
> Jörg
>
> Tobias Gierke wrote:
>
>> Hi,
>>
>> It seems we're not able to deserialize Lambda expressions with XStream
>> 1.4.7
>>
>> The code in question looks roughly like this:
>>
>> @FunctionalInterface
>> public interface Visible extends Serializable {
>>       public boolean isVisible();
>> }
>>
>> public interface IMenuItem extends Serializable {
>>       // ... stuff omitted ...
>> }
>>
>> public abstract class AbstractMenuItem implements IMenuItem {
>>       private final Visible visibilityFunction;
>>       // ... stuff omitted ...
>> }
>>
>> The method that is invoked with lambda expressions (that later get
>> stored in the 'visibilityFunction' field of an AbstractMenuItem subclass
>> instance) looks like this:
>>
>> public <T extends Page> void addEntry(String resourceLabel , Class<T>
>> pageClazz,Visible visibilityFunction);
>>
>> Since the Visible interface extends Serializable , the compiler
>> generates code for a serializable Lambda (and in fact it does, I checked
>> the generated .class file with javap).
>>
>> The code used to setup XStream looks like this:
>>
>>       private XStream createXStream()
>>       {
>>           final XStream xstream = new XStream( new StaxDriver() ) {
>>               @Override
>>               protected MapperWrapper wrapMapper(MapperWrapper next) {
>>                   return new WicketProxyMapper( new CGLIBMapper( new
>> HibernateMapper(next) ) ); //
>>               }
>>           };
>>
>>           // override the built-in DynamicProxyConverter that chokes on
>> Apache Wicket proxies
>>            xstream.registerConverter( new WicketProxyConverter() ,
>> XStream.PRIORITY_VERY_HIGH );
>>
>>           // register Hibernate-specific converters
>>           xstream.registerConverter(new HibernateProxyConverter());
>>           xstream.registerConverter(new
>> HibernatePersistentCollectionConverter(xstream.getMapper()));
>>           xstream.registerConverter(new
>> HibernatePersistentMapConverter(xstream.getMapper()));
>>           xstream.registerConverter(new
>> HibernatePersistentSortedMapConverter(xstream.getMapper()));
>>           xstream.registerConverter(new
>> HibernatePersistentSortedSetConverter(xstream.getMapper()));
>>
>>           // register CGLLib converters
>>           xstream.registerConverter(new
>> CGLIBEnhancedConverter(xstream.getMapper(),
>> xstream.getReflectionProvider() , getClass().getClassLoader() ) );
>>
>>           return xstream;
>>       }
>>
>>
>> Before I start diving into the world of invokedynamic and method handles
>> , did anybody else encounter this issue and knows how to solve it ?
>>
>> Cheers,
>> Tobias
>>
>>
>> com.thoughtworks.xstream.converters.ConversionException:
>>
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
>> :
>>
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
>> ---- Debugging information ----
>> message             :
>>
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
>> cause-exception     :
>> com.thoughtworks.xstream.mapper.CannotResolveClassException
>> cause-message       :
>>
> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
>> class               :
>> com.vodecc.voipmng.boundary.wicket.general.PageWithHeaderAndFooter$11
>> required-type       :
>> com.vodecc.voipmng.boundary.wicket.general.PageWithHeaderAndFooter$11
>> converter-type      :
>> com.thoughtworks.xstream.converters.reflection.ReflectionConverter
>> path                :
>>
> /com.vodecc.voipmng.boundary.wicket.trunkmonitor.TrunkMonitorPage/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1$1[2]/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SubMenuList/children/children/org.apache.wicket.markup.html.list.ListItem/children/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$NestedListEntry$1/children/org.apache.wicket.markup.html.list.ListItem[3]/children/children/val$visibilityFunction
>> line number         : 1
>> class[1]            :
>> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SimpleListEntry
>> class[2]            : org.apache.wicket.markup.html.list.ListItem
>> class[3]            : [Ljava.lang.Object;
>> converter-type[1]   :
>> com.thoughtworks.xstream.converters.collections.ArrayConverter
>> class[4]            :
>> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$NestedListEntry$1
>> class[5]            :
>> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$NestedListEntry
>> class[6]            :
>> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SubMenuList$1
>> class[7]            :
>> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SubMenuList
>> class[8]            :
>> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1$1
>> class[9]            :
>> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1
>> class[10]           :
>> com.vodecc.voipmng.boundary.wicket.trunkmonitor.TrunkMonitorPage
>> version             : not available
>> -------------------------------
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>      http://xircles.codehaus.org/manage_email
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>      http://xircles.codehaus.org/manage_email
>
>


--
Tobias Gierke
Development

VOIPFUTURE GmbH   Wendenstraße 4   20097 Hamburg,  Germany
Phone +49 40 688 900 164 Fax +49 40 688 900 199
Email [hidden email]   Web http://www.voipfuture.com
 
CEO Jan Bastian
       
Commercial Court AG Hamburg   HRB 109896, VAT ID DE263738086



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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Re: Lambda deserialization failing with XStream 1.4.7 and JDK 1.8ea40 (64-bit)

Jörg Schaible-2
Hi Tobias,

Tobias Gierke wrote:

> Hi Jörg,
>
> I created a JIRA issue: http://jira.codehaus.org/browse/XSTR-767

thanks. Can you also provide the generated XML for the relevant structure?

> Thanks for looking into this!

Cheers,
Jörg

>
> Cheers,
> Tobias
>
>
>> Hi Tobias,
>>
>> it seems you're the first one who tries to serialize something like that.
>> Please open a JIRA issue and I try to look into it in the next two weeks.
>>
>> Cheers,
>> Jörg
>>
>> Tobias Gierke wrote:
>>
>>> Hi,
>>>
>>> It seems we're not able to deserialize Lambda expressions with XStream
>>> 1.4.7
>>>
>>> The code in question looks roughly like this:
>>>
>>> @FunctionalInterface
>>> public interface Visible extends Serializable {
>>>       public boolean isVisible();
>>> }
>>>
>>> public interface IMenuItem extends Serializable {
>>>       // ... stuff omitted ...
>>> }
>>>
>>> public abstract class AbstractMenuItem implements IMenuItem {
>>>       private final Visible visibilityFunction;
>>>       // ... stuff omitted ...
>>> }
>>>
>>> The method that is invoked with lambda expressions (that later get
>>> stored in the 'visibilityFunction' field of an AbstractMenuItem subclass
>>> instance) looks like this:
>>>
>>> public <T extends Page> void addEntry(String resourceLabel , Class<T>
>>> pageClazz,Visible visibilityFunction);
>>>
>>> Since the Visible interface extends Serializable , the compiler
>>> generates code for a serializable Lambda (and in fact it does, I checked
>>> the generated .class file with javap).
>>>
>>> The code used to setup XStream looks like this:
>>>
>>>       private XStream createXStream()
>>>       {
>>>           final XStream xstream = new XStream( new StaxDriver() ) {
>>>               @Override
>>>               protected MapperWrapper wrapMapper(MapperWrapper next) {
>>>                   return new WicketProxyMapper( new CGLIBMapper( new
>>> HibernateMapper(next) ) ); //
>>>               }
>>>           };
>>>
>>>           // override the built-in DynamicProxyConverter that chokes on
>>> Apache Wicket proxies
>>>            xstream.registerConverter( new WicketProxyConverter() ,
>>> XStream.PRIORITY_VERY_HIGH );
>>>
>>>           // register Hibernate-specific converters
>>>           xstream.registerConverter(new HibernateProxyConverter());
>>>           xstream.registerConverter(new
>>> HibernatePersistentCollectionConverter(xstream.getMapper()));
>>>           xstream.registerConverter(new
>>> HibernatePersistentMapConverter(xstream.getMapper()));
>>>           xstream.registerConverter(new
>>> HibernatePersistentSortedMapConverter(xstream.getMapper()));
>>>           xstream.registerConverter(new
>>> HibernatePersistentSortedSetConverter(xstream.getMapper()));
>>>
>>>           // register CGLLib converters
>>>           xstream.registerConverter(new
>>> CGLIBEnhancedConverter(xstream.getMapper(),
>>> xstream.getReflectionProvider() , getClass().getClassLoader() ) );
>>>
>>>           return xstream;
>>>       }
>>>
>>>
>>> Before I start diving into the world of invokedynamic and method handles
>>> , did anybody else encounter this issue and knows how to solve it ?
>>>
>>> Cheers,
>>> Tobias
>>>
>>>
>>> com.thoughtworks.xstream.converters.ConversionException:
>>>
>>
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
>>> :
>>>
>>
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
>>> ---- Debugging information ----
>>> message             :
>>>
>>
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
>>> cause-exception     :
>>> com.thoughtworks.xstream.mapper.CannotResolveClassException
>>> cause-message       :
>>>
>>
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$$Lambda$124/1803727536
>>> class               :
>>> com.vodecc.voipmng.boundary.wicket.general.PageWithHeaderAndFooter$11
>>> required-type       :
>>> com.vodecc.voipmng.boundary.wicket.general.PageWithHeaderAndFooter$11
>>> converter-type      :
>>> com.thoughtworks.xstream.converters.reflection.ReflectionConverter
>>> path                :
>>>
>>
/com.vodecc.voipmng.boundary.wicket.trunkmonitor.TrunkMonitorPage/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1$1[2]/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SubMenuList/children/children/org.apache.wicket.markup.html.list.ListItem/children/children/com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$NestedListEntry$1/children/org.apache.wicket.markup.html.list.ListItem[3]/children/children/val$visibilityFunction
>>> line number         : 1
>>> class[1]            :
>>> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SimpleListEntry
>>> class[2]            : org.apache.wicket.markup.html.list.ListItem
>>> class[3]            : [Ljava.lang.Object;
>>> converter-type[1]   :
>>> com.thoughtworks.xstream.converters.collections.ArrayConverter
>>> class[4]            :
>>>
com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$NestedListEntry$1

>>> class[5]            :
>>> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$NestedListEntry
>>> class[6]            :
>>> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SubMenuList$1
>>> class[7]            :
>>> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$SubMenuList
>>> class[8]            :
>>> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1$1
>>> class[9]            :
>>> com.vodecc.voipmng.boundary.wicket.general.PageWithMenu$1
>>> class[10]           :
>>> com.vodecc.voipmng.boundary.wicket.trunkmonitor.TrunkMonitorPage
>>> version             : not available
>>> -------------------------------
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>      http://xircles.codehaus.org/manage_email
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>      http://xircles.codehaus.org/manage_email
>>
>>
>
>



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

    http://xircles.codehaus.org/manage_email