public class CompilerIndependentOuterClassFieldMapper
extends com.thoughtworks.xstream.mapper.MapperWrapper
implements com.thoughtworks.xstream.core.Caching
Compiler independent outer class field mapper.
Different compilers generate different indexes for the names of outer class reference field (this$N) leading to deserialization errors.
The mapper will be able to update field names for instances with a single this$N field only (including those from parent classes).
For difference between generated field names compare
src/test/java/brooklyn/util/xstream/compiler_compatibility_eclipse.xml
and
src/test/java/brooklyn/util/xstream/compiler_compatibility_oracle.xml
,
generated from brooklyn.util.xstream.CompilerCompatibilityTest
JLS 1.1 relevant section, copied verbatim for a lack of reliable URL:
Java 1.1 compilers are strongly encouraged, though not required, to use the following naming conventions when implementing inner classes. Compilers may not use synthetic names of the forms defined here for any other purposes.
A synthetic field pointing to the outermost enclosing instance is named this$0. The next-outermost enclosing instance is this$1, and so forth. (At most one such field is necessary in any given inner class.) A synthetic field containing a copy of a constant v is named val$v. These fields are final.
Currently available at http://web.archive.org/web/20000830111107/http://java.sun.com/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc10.html
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOG |
Constructor and Description |
---|
CompilerIndependentOuterClassFieldMapper(com.thoughtworks.xstream.mapper.Mapper wrapped) |
Modifier and Type | Method and Description |
---|---|
void |
flushCache() |
java.lang.String |
realMember(java.lang.Class type,
java.lang.String serialized) |
aliasForAttribute, aliasForAttribute, aliasForSystemAttribute, attributeForAlias, attributeForAlias, defaultImplementationOf, getConverterFromAttribute, getConverterFromAttribute, getConverterFromAttribute, getConverterFromItemType, getConverterFromItemType, getConverterFromItemType, getFieldNameForItemTypeAndName, getImplicitCollectionDefForFieldName, getItemTypeForItemFieldName, getLocalConverter, isImmutableValueType, lookupMapperOfType, realClass, serializedClass, serializedMember, shouldSerializeMember
public CompilerIndependentOuterClassFieldMapper(com.thoughtworks.xstream.mapper.Mapper wrapped)
public java.lang.String realMember(java.lang.Class type, java.lang.String serialized)
realMember
in interface com.thoughtworks.xstream.mapper.Mapper
realMember
in class com.thoughtworks.xstream.mapper.MapperWrapper
public void flushCache()
flushCache
in interface com.thoughtworks.xstream.core.Caching