serialization - Java unchecked or unsafe operations message -
i getting following error when compiling java class in bluej.
auctionmanager.java uses unchecked or unsafe operations.
this error displayed when following deserialization code in 1 of functions:
try { objectinputstream in = new objectinputstream(new fileinputstream(filename)); arraylist<auctionitem> auctionlist = (arraylist<auctionitem>) in.readobject(); in.close(); } catch (exception e) { e.printstacktrace(); }
can please have information why error being displayed, , use deserialization code without error.
first message not error, warning; doesn't prevent program compiling, or running.
as source, line:
arraylist<auctionitem> auctionlist = (arraylist<auctionitem>) in.readobject();
since casting object (readobject
returns object
) parameterized type (arraylist<auctionitem>
).
Comments
Post a Comment