Author: ggregory
Date: Fri Apr 6 20:03:55 2012
New Revision: 1310566
URL: http://svn.apache.org/viewvc?rev=1310566&view=rev
Log:
Add comments for [LANG-798] Use generics in SerializationUtils.
Modified:
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SerializationUtils.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=1310566&r1=1310565&r2=1310566&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
Fri Apr 6 20:03:55 2012
@@ -182,6 +182,9 @@ public class SerializationUtils {
* @throws SerializationException (runtime) if the serialization fails
*/
@SuppressWarnings("unchecked")
+ // Don't warn about "(T) deserialize" because we want the avoid type
casting call sites.
+ // If the call site incorrectly types the return value, a
ClassCastException is thrown.
+ // Without Generics in this declaration, the call site must type cast and
can cause the same ClassCastException.
public static <T> T deserialize(InputStream inputStream) {
if (inputStream == null) {
throw new IllegalArgumentException("The InputStream must not be
null");
@@ -216,6 +219,9 @@ public class SerializationUtils {
* @throws SerializationException (runtime) if the serialization fails
*/
@SuppressWarnings("unchecked")
+ // Don't warn about "(T) deserialize" because we want the avoid type
casting call sites.
+ // If the call site incorrectly types the return value, a
ClassCastException is thrown.
+ // Without Generics in this declaration, the call site must type cast and
can cause the same ClassCastException.
public static <T> T deserialize(byte[] objectData) {
if (objectData == null) {
throw new IllegalArgumentException("The byte[] must not be null");