Skip to content

Commit c365508

Browse files
committed
Clean some unnecessary .nn
1 parent 8d42211 commit c365508

36 files changed

+314
-311
lines changed

library/src/scala/collection/Iterator.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ trait Iterator[+A] extends IterableOnce[A] with IterableOnceOps[A, Iterator, Ite
279279
else if (buffer.nn.length == size) Array.copy(src = buffer.nn, srcPos = step, dest = prev.nn, destPos = 0, length = size - step)
280280
else prev = null
281281
}
282-
val res = immutable.ArraySeq.unsafeWrapArray(buffer.nn).asInstanceOf[immutable.ArraySeq[B]]
282+
val res = immutable.ArraySeq.unsafeWrapArray(buffer).asInstanceOf[immutable.ArraySeq[B]]
283283
buffer = null
284284
first = false
285285
res
@@ -1189,9 +1189,9 @@ object Iterator extends IterableFactory[Iterator] {
11891189
false
11901190
}
11911191
else {
1192-
current = tail.nn.headIterator
1192+
current = tail.headIterator
11931193
if (last eq tail) last = last.nn.tail
1194-
tail = tail.nn.tail
1194+
tail = tail.tail
11951195
merge()
11961196
if (currentHasNextChecked) true
11971197
else if (current != null && current.hasNext) {

library/src/scala/collection/View.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,8 @@ object View extends IterableFactory[View] {
459459
len = 0
460460
while(underlying.hasNext) {
461461
val n = underlying.next().asInstanceOf[AnyRef]
462-
if(pos >= buf.nn.length) buf.nn.addOne(n)
463-
else buf.nn(pos) = n
462+
if(pos >= buf.length) buf.addOne(n)
463+
else buf(pos) = n
464464
pos += 1
465465
if(pos == maxlen) pos = 0
466466
len += 1
@@ -513,7 +513,7 @@ object View extends IterableFactory[View] {
513513
def init(): Unit = if(buf eq null) {
514514
buf = new ArrayBuffer[AnyRef](maxlen min 256)
515515
while(pos < maxlen && underlying.hasNext) {
516-
buf.nn.addOne(underlying.next().asInstanceOf[AnyRef])
516+
buf.addOne(underlying.next().asInstanceOf[AnyRef])
517517
pos += 1
518518
}
519519
if(!underlying.hasNext) len = 0

library/src/scala/collection/concurrent/TrieMap.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ private[concurrent] object CNode {
673673
}
674674

675675

676-
private[concurrent] case class RDCSS_Descriptor[K, V](old: INode[K, V], expectedmain: MainNode[K, V], nv: INode[K, V]) {
676+
private[concurrent] case class RDCSS_Descriptor[K, V](old: INode[K, V], expectedmain: MainNode[K, V] | Null, nv: INode[K, V]) {
677677
@volatile var committed = false
678678
}
679679

@@ -788,7 +788,7 @@ final class TrieMap[K, V] private (r: AnyRef, rtupd: AtomicReferenceFieldUpdater
788788
}
789789

790790
private def RDCSS_ROOT(ov: INode[K, V], expectedmain: MainNode[K, V] | Null, nv: INode[K, V]): Boolean = {
791-
val desc = RDCSS_Descriptor(ov, expectedmain.nn, nv)
791+
val desc = RDCSS_Descriptor(ov, expectedmain, nv)
792792
if (CAS_ROOT(ov, desc)) {
793793
RDCSS_Complete(abort = false)
794794
/*READ*/desc.committed
@@ -858,7 +858,7 @@ final class TrieMap[K, V] private (r: AnyRef, rtupd: AtomicReferenceFieldUpdater
858858
@tailrec def snapshot(): TrieMap[K, V] = {
859859
val r = RDCSS_READ_ROOT()
860860
val expmain = r.gcasRead(this)
861-
if (RDCSS_ROOT(r, expmain, r.copyToGen(new Gen, this))) new TrieMap(r.copyToGen(new Gen, this), rootupdater.nn, hashing, equality)
861+
if (RDCSS_ROOT(r, expmain, r.copyToGen(new Gen, this))) new TrieMap(r.copyToGen(new Gen, this), rootupdater, hashing, equality)
862862
else snapshot()
863863
}
864864

@@ -1084,13 +1084,13 @@ private[collection] class TrieMapIterator[K, V](var level: Int, private var ct:
10841084
def next() = if (hasNext) {
10851085
var r: (K, V) | Null = null
10861086
if (subiter ne null) {
1087-
r = subiter.nn.next()
1087+
r = subiter.next()
10881088
checkSubiter()
10891089
} else {
10901090
r = current.nn.kvPair
10911091
advance()
10921092
}
1093-
r.nn
1093+
r
10941094
} else Iterator.empty.next()
10951095

10961096
private def readin(in: INode[K, V]) = in.gcasRead(ct) match {
@@ -1152,7 +1152,7 @@ private[collection] class TrieMapIterator[K, V](var level: Int, private var ct:
11521152
// this one needs to be evaluated
11531153
if (this.subiter == null) it.subiter = null
11541154
else {
1155-
val lst = this.subiter.nn.to(immutable.List)
1155+
val lst = this.subiter.to(immutable.List)
11561156
this.subiter = lst.iterator
11571157
it.subiter = lst.iterator
11581158
}

library/src/scala/collection/convert/AsScalaConverters.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,6 @@ trait AsScalaConverters {
206206
*/
207207
def asScala(p: ju.Properties | Null): mutable.Map[String, String] | Null = p match {
208208
case null => null
209-
case _ => new JPropertiesWrapper(p.nn)
209+
case _ => new JPropertiesWrapper(p)
210210
}
211211
}

library/src/scala/collection/convert/impl/IteratorStepper.scala

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ private[collection] class AnyIteratorStepper[A](_underlying: Iterator[A] | Null)
2424
with AnyStepper[A] {
2525
protected def semiclone(): AnyIteratorStepper[A] = new AnyIteratorStepper(null)
2626

27-
def nextStep(): A = if (proxied ne null) proxied.nn.nextStep() else underlying.nn.next()
27+
def nextStep(): A = if (proxied ne null) proxied.nextStep() else underlying.nn.next()
2828

29-
def trySplit(): AnyStepper[A] | Null = if (proxied ne null) proxied.nn.trySplit() else {
29+
def trySplit(): AnyStepper[A] | Null = if (proxied ne null) proxied.trySplit() else {
3030
val acc = new AnyAccumulator[A]
3131
var i = 0
3232
val n = nextChunkSize & 0xFFFFFFFC
3333
while (i < n && underlying.nn.hasNext) { acc += underlying.nn.next(); i += 1 }
3434
if (i < n || !underlying.nn.hasNext) {
3535
proxied = acc.stepper
36-
proxied.nn.trySplit()
36+
proxied.trySplit()
3737
}
3838
else {
3939
val ans = semiclone()
@@ -49,16 +49,16 @@ private[collection] class DoubleIteratorStepper(_underlying: Iterator[Double] |
4949
with DoubleStepper {
5050
protected def semiclone(): DoubleIteratorStepper = new DoubleIteratorStepper(null)
5151

52-
def nextStep(): Double = if (proxied ne null) proxied.nn.nextStep() else underlying.nn.next()
52+
def nextStep(): Double = if (proxied ne null) proxied.nextStep() else underlying.nn.next()
5353

54-
def trySplit(): DoubleStepper | Null = if (proxied ne null) proxied.nn.trySplit() else {
54+
def trySplit(): DoubleStepper | Null = if (proxied ne null) proxied.trySplit() else {
5555
val acc = new DoubleAccumulator
5656
var i = 0
5757
val n = nextChunkSize & 0xFFFFFFFC
5858
while (i < n && underlying.nn.hasNext) { acc += underlying.nn.next(); i += 1 }
5959
if (i < n || !underlying.nn.hasNext) {
6060
proxied = acc.stepper
61-
proxied.nn.trySplit()
61+
proxied.trySplit()
6262
}
6363
else {
6464
val ans = semiclone()
@@ -74,16 +74,16 @@ private[collection] class IntIteratorStepper(_underlying: Iterator[Int] | Null)
7474
with IntStepper {
7575
protected def semiclone(): IntIteratorStepper = new IntIteratorStepper(null)
7676

77-
def nextStep(): Int = if (proxied ne null) proxied.nn.nextStep() else underlying.nn.next()
77+
def nextStep(): Int = if (proxied ne null) proxied.nextStep() else underlying.nn.next()
7878

79-
def trySplit(): IntStepper | Null = if (proxied ne null) proxied.nn.trySplit() else {
79+
def trySplit(): IntStepper | Null = if (proxied ne null) proxied.trySplit() else {
8080
val acc = new IntAccumulator
8181
var i = 0
8282
val n = nextChunkSize & 0xFFFFFFFC
8383
while (i < n && underlying.nn.hasNext) { acc += underlying.nn.next(); i += 1 }
8484
if (i < n || !underlying.nn.hasNext) {
8585
proxied = acc.stepper
86-
proxied.nn.trySplit()
86+
proxied.trySplit()
8787
}
8888
else {
8989
val ans = semiclone()
@@ -99,16 +99,16 @@ private[collection] class LongIteratorStepper(_underlying: Iterator[Long] | Null
9999
with LongStepper {
100100
protected def semiclone(): LongIteratorStepper = new LongIteratorStepper(null)
101101

102-
def nextStep(): Long = if (proxied ne null) proxied.nn.nextStep() else underlying.nn.next()
102+
def nextStep(): Long = if (proxied ne null) proxied.nextStep() else underlying.nn.next()
103103

104-
def trySplit(): LongStepper | Null = if (proxied ne null) proxied.nn.trySplit() else {
104+
def trySplit(): LongStepper | Null = if (proxied ne null) proxied.trySplit() else {
105105
val acc = new LongAccumulator
106106
var i = 0
107107
val n = nextChunkSize & 0xFFFFFFFC
108108
while (i < n && underlying.nn.hasNext) { acc += underlying.nn.next(); i += 1 }
109109
if (i < n || !underlying.nn.hasNext) {
110110
proxied = acc.stepper
111-
proxied.nn.trySplit()
111+
proxied.trySplit()
112112
}
113113
else {
114114
val ans = semiclone()
@@ -126,6 +126,6 @@ private[convert] abstract class IteratorStepperBase[A, SP <: Stepper[A], Semi <:
126126
final protected var proxied: SP | Null = null
127127
protected def semiclone(): Semi // Must initialize with null iterator!
128128
def characteristics: Int = if (proxied ne null) Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED else Spliterator.ORDERED
129-
def estimateSize: Long = if (proxied ne null) proxied.nn.estimateSize else Long.MaxValue
130-
def hasStep: Boolean = if (proxied ne null) proxied.nn.hasStep else underlying.nn.hasNext
129+
def estimateSize: Long = if (proxied ne null) proxied.estimateSize else Long.MaxValue
130+
def hasStep: Boolean = if (proxied ne null) proxied.hasStep else underlying.nn.hasNext
131131
}

library/src/scala/collection/immutable/HashMap.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ final class HashMap[K, +V] private[immutable] (private[immutable] val rootNode:
161161

162162
def removed(key: K): HashMap[K, V] = {
163163
val keyUnimprovedHash = key.##
164-
newHashMapOrThis(rootNode.removed(key, keyUnimprovedHash, improve(keyUnimprovedHash), 0).nn)
164+
newHashMapOrThis(rootNode.removed(key, keyUnimprovedHash, improve(keyUnimprovedHash), 0))
165165
}
166166

167167
override def concat[V1 >: V](that: scala.IterableOnce[(K, V1)]^): HashMap[K, V1] = that match {
@@ -352,7 +352,7 @@ final class HashMap[K, +V] private[immutable] (private[immutable] val rootNode:
352352
val (mergedK, mergedV) = mergef(payload, thatPayload)
353353
val mergedOriginalHash = mergedK.##
354354
val mergedImprovedHash = improve(mergedOriginalHash)
355-
new HashMap(that.rootNode.removed(thatPayload._1, originalHash, improved, 0).nn.updated(mergedK, mergedV, mergedOriginalHash, mergedImprovedHash, 0, replaceValue = true))
355+
new HashMap(that.rootNode.removed(thatPayload._1, originalHash, improved, 0).updated(mergedK, mergedV, mergedOriginalHash, mergedImprovedHash, 0, replaceValue = true))
356356
} else {
357357
new HashMap(that.rootNode.updated(k, v, originalHash, improved, 0, replaceValue = true))
358358
}
@@ -414,7 +414,7 @@ final class HashMap[K, +V] private[immutable] (private[immutable] val rootNode:
414414
val next = iter.next()
415415
val originalHash = hashSet.unimproveHash(next.hash)
416416
val improved = improve(originalHash)
417-
curr = curr.removed(next.key, originalHash, improved, 0).nn
417+
curr = curr.removed(next.key, originalHash, improved, 0)
418418
if (curr.size == 0) {
419419
return HashMap.empty
420420
}
@@ -432,7 +432,7 @@ final class HashMap[K, +V] private[immutable] (private[immutable] val rootNode:
432432
val next = iter.next()
433433
val originalHash = lhashSet.unimproveHash(next.hash)
434434
val improved = improve(originalHash)
435-
curr = curr.removed(next.key, originalHash, improved, 0).nn
435+
curr = curr.removed(next.key, originalHash, improved, 0)
436436
if (curr.size == 0) {
437437
return HashMap.empty
438438
}
@@ -446,7 +446,7 @@ final class HashMap[K, +V] private[immutable] (private[immutable] val rootNode:
446446
val next = iter.next()
447447
val originalHash = next.##
448448
val improved = improve(originalHash)
449-
curr = curr.removed(next, originalHash, improved, 0).nn
449+
curr = curr.removed(next, originalHash, improved, 0)
450450
if (curr.size == 0) {
451451
return HashMap.empty
452452
}
@@ -1771,15 +1771,15 @@ private final class BitmapIndexedMapNode[K, +V](
17711771
if (newNodes == null) {
17721772
newNodes = mutable.Queue.empty
17731773
}
1774-
newNodes.nn += newSubNode
1774+
newNodes += newSubNode
17751775
}
17761776
} else if (newSubNode.size == 1) {
17771777
newDataMap |= bitpos
17781778
nodeMigrateToDataTargetMap |= bitpos
17791779
if (nodesToMigrateToData == null) {
17801780
nodesToMigrateToData = mutable.Queue()
17811781
}
1782-
nodesToMigrateToData.nn += newSubNode
1782+
nodesToMigrateToData += newSubNode
17831783
}
17841784

17851785
nodeIndex += 1
@@ -2015,9 +2015,9 @@ private final class HashCollisionMapNode[K, +V ](
20152015
if (hc.indexOf(nextPayload._1) < 0) {
20162016
if (newContent == null) {
20172017
newContent = new VectorBuilder[(K, V1)]()
2018-
newContent.nn.addAll(hc.content)
2018+
newContent.addAll(hc.content)
20192019
}
2020-
newContent.nn.addOne(nextPayload)
2020+
newContent.addOne(nextPayload)
20212021
}
20222022
}
20232023
if (newContent eq null) hc else new HashCollisionMapNode(originalHash, hash, newContent.result())
@@ -2178,7 +2178,7 @@ private final class MapNodeRemoveAllSetNodeIterator[K](rootSetNode: SetNode[K])
21782178
keyHash = improve(originalHash),
21792179
originalHash = originalHash,
21802180
shift = 0
2181-
).nn
2181+
)
21822182
currentValueCursor += 1
21832183
}
21842184
curr
@@ -2335,11 +2335,11 @@ private[immutable] final class HashMapBuilder[K, V] extends ReusableBuilder[(K,
23352335
if (rootNode.size == 0) {
23362336
HashMap.empty
23372337
} else if (aliased != null) {
2338-
aliased.nn
2338+
aliased
23392339
} else {
23402340
aliased = new HashMap(rootNode)
23412341
releaseFence()
2342-
aliased.nn
2342+
aliased
23432343
}
23442344

23452345
override def addOne(elem: (K, V)): this.type = {

library/src/scala/collection/immutable/HashSet.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,15 +1150,15 @@ private final class BitmapIndexedSetNode[A](
11501150
if (newNodes eq null) {
11511151
newNodes = mutable.Queue.empty
11521152
}
1153-
newNodes.nn += newSubNode
1153+
newNodes += newSubNode
11541154
}
11551155
} else if (newSubNode.size == 1) {
11561156
newDataMap |= bitpos
11571157
nodeMigrateToDataTargetMap |= bitpos
11581158
if (nodesToMigrateToData eq null) {
11591159
nodesToMigrateToData = mutable.Queue.empty
11601160
}
1161-
nodesToMigrateToData.nn += newSubNode
1161+
nodesToMigrateToData += newSubNode
11621162
}
11631163

11641164
nodeIndex += 1
@@ -1265,15 +1265,15 @@ private final class BitmapIndexedSetNode[A](
12651265
if (newNodes eq null) {
12661266
newNodes = mutable.Queue.empty
12671267
}
1268-
newNodes.nn += newSubNode
1268+
newNodes += newSubNode
12691269
}
12701270
} else if (newSubNode.size == 1) {
12711271
newDataMap |= bitpos
12721272
nodeMigrateToDataTargetMap |= bitpos
12731273
if (nodesToMigrateToData eq null) {
12741274
nodesToMigrateToData = mutable.Queue.empty
12751275
}
1276-
nodesToMigrateToData.nn += newSubNode
1276+
nodesToMigrateToData += newSubNode
12771277
}
12781278

12791279
nodeIndex += 1

library/src/scala/collection/immutable/LazyList.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ object LazyList extends SeqFactory[LazyList] {
11171117
var rest = restRef // var rest = restRef.elem
11181118
while (!itHasNext && !rest.isEmpty) {
11191119
it = f(rest.head).iterator
1120-
itHasNext = it.nn.hasNext
1120+
itHasNext = it.hasNext
11211121
if (!itHasNext) { // wait to advance `rest` because `it.next()` can throw
11221122
rest = rest.tail
11231123
restRef = rest // restRef.elem = rest
@@ -1449,3 +1449,4 @@ object LazyList extends SeqFactory[LazyList] {
14491449
private[this] def readResolve(): Any = coll
14501450
}
14511451
}
1452+

library/src/scala/collection/immutable/LazyListIterable.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ object LazyListIterable extends IterableFactory[LazyListIterable] {
11391139
var rest: LazyListIterable[A]^{ll} = restRef // var rest = restRef.elem
11401140
while (!itHasNext && !rest.isEmpty) {
11411141
it = f(rest.head).iterator
1142-
itHasNext = it.nn.hasNext
1142+
itHasNext = it.hasNext
11431143
if (!itHasNext) { // wait to advance `rest` because `it.next()` can throw
11441144
rest = rest.tail
11451145
restRef = rest // restRef.elem = rest

0 commit comments

Comments
 (0)