On 25 August 2010 17:15, <[email protected]> wrote:
> Author: mbenson
> Date: Wed Aug 25 16:15:44 2010
> New Revision: 989199
>
> URL: http://svn.apache.org/viewvc?rev=989199&view=rev
> Log:
> make SerializationUtils.clone() type-safe
>
> Modified:
>
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SerializationUtils.java
>
> commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
>
> Modified:
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SerializationUtils.java
> URL:
> http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SerializationUtils.java?rev=989199&r1=989198&r2=989199&view=diff
> ==============================================================================
> ---
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SerializationUtils.java
> (original)
> +++
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SerializationUtils.java
> Wed Aug 25 16:15:44 2010
> @@ -77,8 +77,9 @@ public class SerializationUtils {
> * @return the cloned object
> * @throws SerializationException (runtime) if the serialization fails
> */
> - public static Object clone(Serializable object) {
> - return deserialize(serialize(object));
> + �...@suppresswarnings("unchecked")
Why is it safe to suppress the warning?
Please can you add a // comment to explain the reason?
> + public static <T extends Serializable> T clone(T object) {
> + return (T) deserialize(serialize(object));
> }
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]