aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2011-06-30 16:34:42 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2011-06-30 16:34:42 +0200
commitc985950989482af485b0a16b479942770bfdcf57 (patch)
tree96ab03ab39ad0b6e2600c3e3886ec825d0968a03
parentd5d7922801c86dccea547016a66538432b97afe2 (diff)
downloadlombok-c985950989482af485b0a16b479942770bfdcf57.tar.gz
lombok-c985950989482af485b0a16b479942770bfdcf57.tar.bz2
lombok-c985950989482af485b0a16b479942770bfdcf57.zip
Added a note about serialVersionUID and @Synchronized to the feature docs.
-rw-r--r--website/features/Synchronized.html5
1 files changed, 5 insertions, 0 deletions
diff --git a/website/features/Synchronized.html b/website/features/Synchronized.html
index 69d9dcee..73622e3d 100644
--- a/website/features/Synchronized.html
+++ b/website/features/Synchronized.html
@@ -48,6 +48,11 @@
just a <code>new Object()</code> as most snippets showing this pattern in action use. Lombok does this because a new object is <em>NOT</em>
serializable, but 0-size array is. Therefore, using <code>@Synchronized</code> will not prevent your object from being serialized.
</p><p>
+ Having at least one <code>@Synchronized</code> method in your class means there will be a lock field, but if you later remove all such methods,
+ there will no longer be a lock field. That means your predetermined <code>serialVersionUID</code> changes. We suggest you <em>always</em> add
+ a <code>serialVersionUID</code> to your classes if you intend to store them long-term via java's serialization mechanism. If you do so, removing
+ all <code>@Synchronized</code> annotations from your method will not break serialization.
+ </p><p>
If you'd like to know why a field is not automatically generated when you choose your own name for the lock object: Because otherwise making a typo
in the field name will result in a <em>very</em> hard to find bug!
</p>