Guava不可变集合的序列化是否稳定? [英] Is the serialization of Guava immutable collections stable?

查看:85
本文介绍了Guava不可变集合的序列化是否稳定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

警告我不要在串行通信中使用的对象中使用Guava不可变集合,因为如果一端的Guava版本被更新,则可能存在序列化版本不兼容的问题.这是一个有效的担忧吗?

I was warned against using Guava immutable collections in objects used in serialized communication because if the version of Guava on one end were updated, there could be serialization version incompatibility issues. Is this a valid concern?

推荐答案

是的,这是一个有效的问题.

Yes, that is a valid concern.

从Guava项目主页(http://code.google.com/p/guava-libraries/):

From the Guava project homepage (http://code.google.com/p/guava-libraries/):

所有对象的序列化形式可能会更改.不要持久保留这些,并假定它们可以在该库的将来版本中读取.

Serialized forms of ALL objects are subject to change. Do not persist these and assume they can be read by a future version of the library.

如果您使用的是Java本机序列化,那么Guava并不是一个不错的选择.

If you're using Java native serialization Guava is not a good choice.

这篇关于Guava不可变集合的序列化是否稳定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆