A
Andrew Lee
Hi,
I am using JDK1.5 and am wondering if it is possible to deserialize an
Object and not get an unchecked cast warning from the compiler when I
cast it to another type. In my code I deserialize an Object and cast
it to Hashtable<Integer, String> and I get an unchecked cast warning.
If I cast it to just a Hashtable object I don't get the warning until
I actually try and use it (e.g. with the "put" method).
I understand that I am casting an Object to a type that could cause a
runtime error (hence the warning), but how can I deserialize a
Hashtable directly?
I would like to create warning-free code for JDK1.5 and am hoping this
is not stopping me from doing it.
Thanks in advance.
I am using JDK1.5 and am wondering if it is possible to deserialize an
Object and not get an unchecked cast warning from the compiler when I
cast it to another type. In my code I deserialize an Object and cast
it to Hashtable<Integer, String> and I get an unchecked cast warning.
If I cast it to just a Hashtable object I don't get the warning until
I actually try and use it (e.g. with the "put" method).
I understand that I am casting an Object to a type that could cause a
runtime error (hence the warning), but how can I deserialize a
Hashtable directly?
I would like to create warning-free code for JDK1.5 and am hoping this
is not stopping me from doing it.
Thanks in advance.