// if field value is null, don't coerce or write the field
if (!isFieldTypeJavaPrimitive(field)) {
// ifNullGoto consumes the top of the stack, so we need to duplicate the value
write.dup();
write.ifNullGoto("field_is_null_" + field.getName());
}
// coerce value
if (field.getCoercion() != null) {
write.invokeStatic(field.getCoercion().getToThrift());