See https://stackoverflow.com/questions/47648689/sealed-classs-objects-mysteriously-becoming-null-when-referenced-by-other-compa (cherry picked from commit c0e2eb211d)
c0e2eb211d