if (generics != null) serializer.setGenerics(kryo, generics);
if (canBeNull) {
kryo.writeObjectOrNull(output, value, serializer);
} else {
if (value == null) {
throw new KryoException("Field value is null but canBeNull is false: " + this + " ("
+ object.getClass().getName() + ")");
}
kryo.writeObject(output, value, serializer);
}
}
} catch (IllegalAccessException ex) {
throw new KryoException("Error accessing field: " + this + " (" + object.getClass().getName() + ")", ex);
} catch (KryoException ex) {
ex.addTrace(this + " (" + object.getClass().getName() + ")");
throw ex;
} catch (RuntimeException runtimeEx) {
KryoException ex = new KryoException(runtimeEx);
ex.addTrace(this + " (" + object.getClass().getName() + ")");
throw ex;
}
}