in xstream/src/java/com/thoughtworks/xstream/core/util/SerializationMembers.java [211:246]
public Map<String, ObjectStreamField> getSerializablePersistentFields(final Class<?> type) {
if (type == null) {
return null;
}
Map<String, ObjectStreamField> result = fieldCache.get(type.getName());
if (result == null) {
ErrorWritingException ex = null;
try {
final Field field = type.getDeclaredField("serialPersistentFields");
if ((field.getModifiers() & PERSISTENT_FIELDS_MODIFIER) == PERSISTENT_FIELDS_MODIFIER) {
field.setAccessible(true);
final ObjectStreamField[] fields = (ObjectStreamField[])field.get(null);
if (fields != null) {
result = new HashMap<>();
for (final ObjectStreamField f : fields) {
result.put(f.getName(), f);
}
}
}
} catch (final NoSuchFieldException e) {
} catch (final IllegalAccessException e) {
ex = new ObjectAccessException("Cannot get field", e);
} catch (final ClassCastException e) {
ex = new ConversionException("Incompatible field type", e);
}
if (ex != null) {
ex.add("field", type.getName() + ".serialPersistentFields");
throw ex;
}
if (result == null) {
result = NO_FIELDS;
}
fieldCache.putIfAbsent(type.getName(), result);
}
return result == NO_FIELDS ? null : result;
}