From 4c2c4c17bedb0627f6caaa44b0ab4c58a8949b71 Mon Sep 17 00:00:00 2001 From: Stefan Zeiger Date: Tue, 26 Jul 2016 18:21:48 +0200 Subject: SI-8576 Minimal changes for `-Xcheckinit` compatibility As explained in https://issues.scala-lang.org/browse/SI-8576, I expect serialization compatibility between builds with and without `-Xcheckinit` to be unattainable. This commit contains some minor fixes for issues discovered while running builds with `-Xcheckinit`: - Add `@SerialVersionUID` to `scala.collection.immutable.Vector`, as requested in SI-8576. Note that this does not make `Vector` serialization compatible. - Use lazy initialization for `global` in `PresentationCompilation`. It used to access the uninitialized `self` variable (which seems to be inconsequential in practice and only fails under `-Xcheckinit`). We should consider using `Externalizable` instead of `Serializable` for collections in 2.13 to make collection classes serialization compatible. --- src/repl/scala/tools/nsc/interpreter/PresentationCompilation.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/repl/scala/tools') diff --git a/src/repl/scala/tools/nsc/interpreter/PresentationCompilation.scala b/src/repl/scala/tools/nsc/interpreter/PresentationCompilation.scala index b9a4054ffc..d675563bc9 100644 --- a/src/repl/scala/tools/nsc/interpreter/PresentationCompilation.scala +++ b/src/repl/scala/tools/nsc/interpreter/PresentationCompilation.scala @@ -69,7 +69,7 @@ trait PresentationCompilation { val interactiveGlobal = new interactive.Global(copySettings, storeReporter) { self => override lazy val platform: ThisPlatform = { new JavaPlatform { - val global: self.type = self + lazy val global: self.type = self override private[nsc] lazy val classPath: ClassPath = mergedFlatClasspath } } -- cgit v1.2.3