summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-10-03 18:29:45 +0000
committerPaul Phillips <paulp@improving.org>2011-10-03 18:29:45 +0000
commit2b4b8bbe9ddf86bfbc1500cdab404fac2b687c14 (patch)
tree7b772ff373411e2aa3185e1950f9b914b3ab8299 /src
parent3503dac97172bbecbd886c0b6f77cf298bcc3af4 (diff)
downloadscala-2b4b8bbe9ddf86bfbc1500cdab404fac2b687c14.tar.gz
scala-2b4b8bbe9ddf86bfbc1500cdab404fac2b687c14.tar.bz2
scala-2b4b8bbe9ddf86bfbc1500cdab404fac2b687c14.zip
Repairing bitrot with serialization.
The comment in SyntheticMethods and the comment in the serialization test said exactly opposite things. The logic at work all seems to be invalid anyway since nested objects are not treated like lazy vals, they have no bitmap. Serialize everything serializable. Review by plocinic.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
index 95fb104f5f..eca33b1aa7 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
@@ -340,18 +340,13 @@ trait SyntheticMethods extends ast.TreeDSL {
)
/** If you serialize a singleton and then deserialize it twice,
- * you will have two instances of your singleton, unless you implement
- * the readResolve() method (see http://www.javaworld.com/javaworld/
- * jw-04-2003/jw-0425-designpatterns_p.html)
+ * you will have two instances of your singleton unless you implement
+ * readResolve. Here it is implemented for all objects which have
+ * no implementation and which are marked serializable (which is true
+ * for all case objects.)
*/
-
- // Only nested objects inside objects should get readResolve automatically.
- // Otherwise, after de-serialization we get null references for lazy accessors
- // (nested object -> lazy val + class def) since the bitmap gets serialized but
- // the moduleVar not.
def needsReadResolve = (
clazz.isModuleClass
- && clazz.owner.isModuleClass
&& clazz.isSerializable
&& !hasConcreteImpl(nme.readResolve)
)