This was already working for accessor-based properties because the assertions were already generated into corresponding accessors, but for fields we must manually check the value against null