Details
Description
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 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)
};
// 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;
}
Activity
Field | Original Value | New Value |
---|---|---|
Attachment | xstream.xml.gz [ 67034 ] |
Resolution | Fixed [ 1 ] | |
Fix Version/s | 1.4.x Maintenance [ 19602 ] | |
Status | Open [ 1 ] | Resolved [ 5 ] |
Fix Version/s | 1.4.x Maintenance [ 19602 ] | |
Fix Version/s | 1.4.8 [ 20992 ] |
Status | Resolved [ 5 ] | Closed [ 6 ] |
generated XML