serialized objects

本文讨论了serialVersionUID在Java序列化中的作用及最佳实践。详细解释了如何通过控制serialVersionUID来管理类的兼容性变更,并提供了生成serialVersionUID的方法。
This started again... a thread from *****:

What do you consider a best practice for serialVersionUID?

T

______________________________________________
From: *******
Sent: Thursday, November 15, 2007 10:45 AM
To: *******
Cc: *******
Subject: serilaVersionUID

Hi, *****, I realized that you changed the servialVersionUID in 11 TOs and make them unique. What is the purpose to make them unique?

Once the serilaVersionUID in TO is modified, both BPM and rule engine has to be deployed again. Now Dev rule engine is broken, and I am afraid Dev BPM (if it is running) also need redeploy.

*******


So after doing research again here is what I (*****) thinks:

The purpose of the serialVersionUID is to give the developer the control of when a class is compatible with previous versions and when not.
The consequence of this is that when the class changes, the developer needs to check that if the new class has compatible changes with previous versions, then keep the same number, if changes are not compatible, then change the number.
you can use the command: serialver to generate a serial version uid.
Articles:

[url=http://www.javaworld.com/javaworld/jw-02-2006/jw-0227-control.html?page=1]JavaWorld[/url]
[url=http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/class.html#5421]Java Object Serialization Specification version 1.5.0[/url]
> remotes::install_local("C:/Users/lenovo/Downloads/jlaffy-scalop-951d10f.tar.gz",upgrade = F,dependencies = T) ── R CMD build ─────────────────────────────────────────────── ✔ checking for file 'C:\Users\lenovo\AppData\Local\Temp\Rtmp4cfrUA\remotes3de079dc1d03\jlaffy-scalop-951d10f/DESCRIPTION' ─ preparing 'scalop': (3.4s) ✔ checking DESCRIPTION meta-information ... ─ cleaning src Warning in person1(given = given[[i]], family = family[[i]], middle = middle[[i]], : Invalid ORCID iD: 'YOUR-ORCID-ID'. ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories NB: this package now depends on R (>= 3.5.0) WARNING: Added dependency on R >= 3.5.0 because serialized objects in serialize/load version 3 cannot be read in older versions of R. File(s) containing such objects: 'scalop/data/palBuRd.rda' ─ building 'scalop_1.1.0.tar.gz' (819ms) 将程序包安装入‘C:/Users/lenovo/AppData/Local/R/win-library/4.5’ (因为‘lib’没有被指定) * installing *source* package 'scalop' ... ** this is package 'scalop' version '1.1.0' ** using staged installation Warning in person1(given = given[[i]], family = family[[i]], middle = middle[[i]], : Invalid ORCID iD: 'YOUR-ORCID-ID'. ** libs using C compiler: 'gcc.exe (GCC) 14.2.0' gcc -I"C:/PROGRA~1/R/R-45~1.0/include" -DNDEBUG -I'C:/Users/lenovo/AppData/Local/R/win-library/4.5/Rcpp/include' -I"C:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -std=gnu2x -mfpmath=sse -msse2 -mstackrealign -c init.c -o init.o gcc -I"C:/PROGRA~1/R/R-45~1.0/include" -DNDEBUG -I'C:/Users/lenovo/AppData/Local/R/win-library/4.5/Rcpp/include' -I"C:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -std=gnu2x -mfpmath=sse -msse2 -mstackrealign -c nd.c -o nd.o gcc -I"C:/PROGRA~1/R/R-45~1.0/include" -DNDEBUG -I'C:/Users/lenovo/AppData/Local/R/win-library/4.5/Rcpp/include' -I"C:/rtools45/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -std=gnu2x -mfpmath=sse -msse2 -mstackrealign -c rowttests.c -o rowttests.o gcc -shared -s -static-libgcc -o scalop.dll tmp.def init.o nd.o rowttests.o -LC:/rtools45/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/rtools45/x86_64-w64-mingw32.static.posix/lib -LC:/PROGRA~1/R/R-45~1.0/bin/x64 -lR installing to C:/Users/lenovo/AppData/Local/R/win-library/4.5/00LOCK-scalop/00new/scalop/libs/x64 ** R ** data *** moving datasets to lazyload DB ** inst ** byte-compile and prepare package for lazy loading Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : there is no package called 'Homo.sapiens' Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart Execution halted ERROR: lazy loading failed for package 'scalop' * removing 'C:/Users/lenovo/AppData/Local/R/win-library/4.5/scalop' 警告信息: In i.p(...) : 安装程序包‘C:/Users/lenovo/AppData/Local/Temp/Rtmp4cfrUA/file3de063377fcf/scalop_1.1.0.tar.gz’时退出狀態的值不是0
最新发布
09-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值