I think I understand this question, although it could be said less vaguely. When you deserialize, you can use for raw, ArrayListand as long as it doesn't throw away ClassCastException, you know that you have this part; but if you add more ArrayList<String>(or List<String>), you will receive a warning that this is unsafe. A collection can contain integers, and only this tide will not catch it.
The usual best course of action is simply to fully align your serialization and deserialization code with each other and suppress the warnings that produce the result.
source
share