google / google/auto

Serializable builder should be used as proxy

Open
#402 0 comments 0 reactions 0 assignees View on GitHub
Component: value P3 type=addition
Dominant language
Java
Stars
10.6k
Forks
1.2k
Avg merge
6h 32m
Merged PRs (30d)
13

Description

Effective Java, 2nd Ed. recommends (item 78) that proxy classes be used for serialization in many situations. It would make sense for a value class's builder to be a serialization proxy, since it ensures that validation, format conversion and defensive copying are reused. Why not generate readResolve and writeReplace methods that use the builder as a proxy whenever the builder is also Serializable?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.