Since API version 1.4, NullPointerException is thrown for casts of null to any type instead of TypeCastException.