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 via email to