The JavaDoc for Map#merge mentions ClassCastException will be thrown:
if the class of the specified key or value prevents it from being stored in this ma