mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-12 04:55:14 +00:00
Add comments for [LANG-798] Use generics in SerializationUtils.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1310566 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e4fe677d6a
commit
e4794cddf8
@ -182,6 +182,9 @@ public static byte[] serialize(Serializable obj) {
|
||||
* @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 static <T> T deserialize(InputStream inputStream) {
|
||||
* @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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user