On Thu, Aug 26, 2010 at 5:04 AM, Henri Yandell <flame...@gmail.com> wrote: > > I wonder if this could be a findbugs/checkstyle/pmd rule? >
Why use findbugs for something like this when it's completely obvious why it's okay? When you serialize an object and then deserialize it, you can be pretty sure you're going to get back the same type of object. Complaining about this particular piece of code it just plain nitpicking, IMHO. I would argue that the deserialize() method should be genericized as such: public static <T extends Serializable> T deserialize(byte[] bytes); This way, you could do: Person p = SerializableUtils.deserialize(bytes); No casting! Now, if the bytes don't represent a Person object, then you'll get a ClassCastException, but that's exactly the same thing that would happen if you did this (with the current API): Person p = (Person)SerializableUtils.deserialize(bytes); So, we make it easier to use the API by avoiding a cast. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org