Issue 94 in google-collections: Static factory methods can return non-serializable predicates

0 views
Skip to first unread message

codesite...@google.com

unread,
Aug 21, 2008, 12:51:42 PM8/21/08
to google-coll...@googlegroups.com
Issue 94: Static factory methods can return non-serializable predicates
http://code.google.com/p/google-collections/issues/detail?id=94

New issue report by marti.th:
Hello

Some of the static factory methods, for instance Predicates.isEqualTo(),
can return non-serializable predicates when called with a parameter that
doesn't implement Serializable.

Example:
---------------------------------------------------------
Object predicateObj = Predicates.isEqualTo(new Object());
ObjectOutput objectOut = new ObjectOutputStream(new
FileOutputStream("predicate.ser"));
objectOut.writeObject(predicateObj);


Exception in thread "main" java.io.NotSerializableException:
java.lang.Object
---------------------------------------------------------


In my opinion this should at least be mentioned in the javadocs...

Bye, Thomas


Issue attributes:
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

codesite...@google.com

unread,
Aug 21, 2008, 2:18:15 PM8/21/08
to google-coll...@googlegroups.com
Issue 94: Static factory methods can return non-serializable predicates
http://code.google.com/p/google-collections/issues/detail?id=94

Comment #1 by jared.l.levy:
Thanks for pointing this out.

I'll keep the current behavior of returning instances that aren't
serializable but
satisfy the Serializable interface. However, documenting that behavior is a
good
idea. That approach is consistent with JDK methods like
Collections.unmodifiableCollection().

Issue attribute updates:
Status: Accepted
Owner: jared.l.levy

codesite...@google.com

unread,
Aug 21, 2008, 2:18:15 PM8/21/08
to google-coll...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages