Skip to content

Commit

Permalink
Add @transient to make the serialization check happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
He-Pin committed Jan 12, 2019
1 parent 972ccdd commit 4c24b94
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/library/scala/collection/concurrent/TrieMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ final class TrieMap[K, V] private (r: AnyRef, rtupd: AtomicReferenceFieldUpdater

private[this] var hashingobj = if (hashf.isInstanceOf[Hashing.Default[_]]) new TrieMap.MangledHashing[K] else hashf
private[this] var equalityobj = ef
@transient
private[this] var rootupdater = rtupd
def hashing = hashingobj
def equality = equalityobj
Expand Down Expand Up @@ -1026,6 +1027,7 @@ object TrieMap extends MapFactory[TrieMap] {

def newBuilder[K, V] = new GrowableBuilder(empty[K, V])

@transient
val inodeupdater = AtomicReferenceFieldUpdater.newUpdater(classOf[INodeBase[_, _]], classOf[MainNode[_, _]], "mainnode")

class MangledHashing[K] extends Hashing[K] {
Expand Down
5 changes: 3 additions & 2 deletions src/library/scala/collection/immutable/HashMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ private final class BitmapIndexedMapNode[K, +V](
}
}
}

def sizePredicate: Int =
if (nodeArity == 0) payloadArity match {
case 0 => SizeEmpty
Expand Down Expand Up @@ -1521,6 +1521,7 @@ object HashMap extends MapFactory[HashMap] {
private[HashMap] def apply[K, V](rootNode: MapNode[K, V]) =
new HashMap[K, V](rootNode)

@transient
private final val EmptyMap = new HashMap(MapNode.empty)

def empty[K, V]: HashMap[K, V] =
Expand Down Expand Up @@ -1746,4 +1747,4 @@ private[immutable] final class HashMapBuilder[K, V] extends Builder[(K, V), Hash
}

private[collection] def size: Int = rootNode.size
}
}
1 change: 1 addition & 0 deletions src/library/scala/collection/immutable/HashSet.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,7 @@ object HashSet extends IterableFactory[HashSet] {
private[HashSet] def apply[A](rootNode: SetNode[A], cachedJavaHashCode: Int) =
new HashSet[A](rootNode)

@transient
private final val EmptySet = new HashSet(SetNode.empty)

def empty[A]: HashSet[A] =
Expand Down
1 change: 1 addition & 0 deletions src/library/scala/collection/immutable/List.scala
Original file line number Diff line number Diff line change
Expand Up @@ -611,5 +611,6 @@ object List extends StrictOptimizedSeqFactory[List] {

def empty[A]: List[A] = Nil

@transient
private[collection] val partialNotApplied = new Function1[Any, Any] { def apply(x: Any): Any = this }
}
1 change: 1 addition & 0 deletions src/library/scala/collection/immutable/Vector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ object Vector extends StrictOptimizedSeqFactory[Vector] {

def newBuilder[A]: Builder[A, Vector[A]] = new VectorBuilder[A]

@transient
private[immutable] val NIL = new Vector[Nothing](0, 0, 0)

private val defaultApplyPreferredMaxLength: Int =
Expand Down

0 comments on commit 4c24b94

Please sign in to comment.