Skip to content

Commit f05a43b

Browse files
committed
Consistently use empty param list for effectful methods
1 parent d6d99f8 commit f05a43b

26 files changed

+148
-148
lines changed

benchmark/src/main/scala/bench/CollectionSource.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ package object generate {
233233
implicit val arrayIntToIterator: (Array[Int] => Iterator[Int]) = (a: Array[Int]) => new Iterator[Int] {
234234
private[this] var i = 0
235235
def hasNext = i < a.length
236-
def next = if (hasNext) { var ans = a(i); i += 1; ans } else throw new NoSuchElementException(i.toString)
236+
def next() = if (hasNext) { var ans = a(i); i += 1; ans } else throw new NoSuchElementException(i.toString)
237237
}
238238
implicit val arrayStringToIterator: (Array[String] => Iterator[String]) = _.iterator
239239
}

fnGen/WrapFnGen.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ object WrapFnGen {
247247
numberedA ++= scalaTargs.map(_.toString).collect{ case An(digits) if (digits.length < 10) => digits.toInt }
248248
val scalafnTnames = (jfn.pTypes :+ jfn.rType).zipWithIndex.map{
249249
case (pt, i) if (i < jfn.pTypes.length && pt.isFinalType) || (!pt.isFinalType && jfn.pTypes.take(i).exists(_ == pt)) =>
250-
val j = Iterator.from(i).dropWhile(numberedA).next
250+
val j = Iterator.from(i).dropWhile(numberedA).next()
251251
val genericName = TypeName(s"A$j")
252252
numberedA += j
253253
evidences += ((genericName, pt.typeSymbol.name.toTypeName))
@@ -312,6 +312,6 @@ object WrapFnGen {
312312

313313
def main(args: Array[String]): Unit = {
314314
val names = args.iterator.map(x => new java.io.File(x))
315-
write(names.next, converterContents)
315+
write(names.next(), converterContents)
316316
}
317317
}

src/main/scala/scala/compat/java8/PrimitiveIteratorConversions.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ object PrimitiveIteratorConverters {
5353
def nextDouble() = it.next()
5454
override def remove(): Unit = { throw new UnsupportedOperationException("remove on scala.collection.Iterator") }
5555
override def forEachRemaining(c: java.util.function.Consumer[_ >: java.lang.Double]): Unit = {
56-
while (it.hasNext) c.accept(it.next)
56+
while (it.hasNext) c.accept(it.next())
5757
}
5858
override def forEachRemaining(c: java.util.function.DoubleConsumer): Unit = {
59-
while (it.hasNext) c.accept(it.next)
59+
while (it.hasNext) c.accept(it.next())
6060
}
6161
}
6262
}
@@ -74,10 +74,10 @@ object PrimitiveIteratorConverters {
7474
def nextInt() = it.next()
7575
override def remove(): Unit = { throw new UnsupportedOperationException("remove on scala.collection.Iterator") }
7676
override def forEachRemaining(c: java.util.function.Consumer[_ >: java.lang.Integer]): Unit = {
77-
while (it.hasNext) c.accept(it.next)
77+
while (it.hasNext) c.accept(it.next())
7878
}
7979
override def forEachRemaining(c: java.util.function.IntConsumer): Unit = {
80-
while (it.hasNext) c.accept(it.next)
80+
while (it.hasNext) c.accept(it.next())
8181
}
8282
}
8383
}
@@ -95,10 +95,10 @@ object PrimitiveIteratorConverters {
9595
def nextLong() = it.next()
9696
override def remove(): Unit = { throw new UnsupportedOperationException("remove on scala.collection.Iterator") }
9797
override def forEachRemaining(c: java.util.function.Consumer[_ >: java.lang.Long]): Unit = {
98-
while (it.hasNext) c.accept(it.next)
98+
while (it.hasNext) c.accept(it.next())
9999
}
100100
override def forEachRemaining(c: java.util.function.LongConsumer): Unit = {
101-
while (it.hasNext) c.accept(it.next)
101+
while (it.hasNext) c.accept(it.next())
102102
}
103103
}
104104
}

src/main/scala/scala/compat/java8/StreamConverters.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ trait StreamShapeLowPriority {
5151
final def fromStepper (mk: MakesStepper[T, _], par: Boolean): S = stream(mk.stepper, par)
5252
final def fromKeyStepper (mk: MakesKeyValueStepper[T, _, _], par: Boolean): S = stream(mk.keyStepper, par)
5353
final def fromValueStepper(mk: MakesKeyValueStepper[_, T, _], par: Boolean): S = stream(mk.valueStepper, par)
54-
@inline private[this] def stream(st: St, par: Boolean): S = mkStream(if(par) st.anticipateParallelism else st, par)
54+
@inline private[this] def stream(st: St, par: Boolean): S = mkStream(if(par) st.anticipateParallelism() else st, par)
5555
protected[this] def mkStream(st: St, par: Boolean): S
5656
}
5757
protected[this] def intStreamShape[T](implicit ss: StepperShape[T, IntStepper]): StreamShape[T, IntStream] = new BaseStreamShape[T, IntStream, IntStepper] {
@@ -330,7 +330,7 @@ with converterImpl.Priority1AccumulatorConverters
330330
new AccumulatesFromStepper[Double, DoubleAccumulator] {
331331
def apply(stepper: Stepper[Double]) = {
332332
val a = new DoubleAccumulator
333-
while (stepper.hasStep) a += stepper.nextStep
333+
while (stepper.hasStep) a += stepper.nextStep()
334334
a
335335
}
336336
}
@@ -339,7 +339,7 @@ with converterImpl.Priority1AccumulatorConverters
339339
new AccumulatesFromStepper[Int, IntAccumulator] {
340340
def apply(stepper: Stepper[Int]) = {
341341
val a = new IntAccumulator
342-
while (stepper.hasStep) a += stepper.nextStep
342+
while (stepper.hasStep) a += stepper.nextStep()
343343
a
344344
}
345345
}
@@ -348,7 +348,7 @@ with converterImpl.Priority1AccumulatorConverters
348348
new AccumulatesFromStepper[Long, LongAccumulator] {
349349
def apply(stepper: Stepper[Long]) = {
350350
val a = new LongAccumulator
351-
while (stepper.hasStep) a += stepper.nextStep
351+
while (stepper.hasStep) a += stepper.nextStep()
352352
a
353353
}
354354
}

src/main/scala/scala/compat/java8/collectionImpl/Accumulator.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ final class Accumulator[A] extends AccumulatorLike[A, Accumulator[A]] { self =>
121121
history((w >>> 32).toInt)((w & 0xFFFFFFFFL).toInt).asInstanceOf[A]
122122
}
123123
}
124-
124+
125125
/** Retrieves the `ix`th element, using an `Int` index. */
126126
final def apply(i: Int): A = apply(i.toLong)
127127

@@ -266,13 +266,13 @@ private[java8] class AccumulatorStepper[A](private val acc: Accumulator[A]) exte
266266
i = 0
267267
}
268268

269-
def characteristics() = ORDERED | SIZED | SUBSIZED
269+
def characteristics = ORDERED | SIZED | SUBSIZED
270270

271271
def estimateSize = N
272272

273273
def hasNext = N > 0
274274

275-
def next: A =
275+
def next(): A =
276276
if (N <= 0) throw new NoSuchElementException("Next in empty Stepper")
277277
else {
278278
if (i >= n) loadMore()

src/main/scala/scala/compat/java8/collectionImpl/DoubleAccumulator.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,13 @@ private[java8] class DoubleAccumulatorStepper(private val acc: DoubleAccumulator
260260
i = 0
261261
}
262262

263-
def characteristics() = ORDERED | SIZED | SUBSIZED | NONNULL
263+
def characteristics = ORDERED | SIZED | SUBSIZED | NONNULL
264264

265265
def estimateSize = N
266266

267267
def hasNext = N > 0
268268

269-
def nextDouble: Double =
269+
def nextDouble(): Double =
270270
if (n <= 0) throw new NoSuchElementException("next on empty Stepper")
271271
else {
272272
if (i >= n) loadMore()

src/main/scala/scala/compat/java8/collectionImpl/IntAccumulator.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,13 @@ private[java8] class IntAccumulatorStepper(private val acc: IntAccumulator) exte
267267
i = 0
268268
}
269269

270-
def characteristics() = ORDERED | SIZED | SUBSIZED | NONNULL
270+
def characteristics = ORDERED | SIZED | SUBSIZED | NONNULL
271271

272272
def estimateSize = N
273273

274274
def hasNext = N > 0
275275

276-
def nextInt: Int =
276+
def nextInt(): Int =
277277
if (N <= 0) throw new NoSuchElementException("next on empty Stepper")
278278
else {
279279
if (i >= n) loadMore()

src/main/scala/scala/compat/java8/collectionImpl/LongAccumulator.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,13 @@ private[java8] class LongAccumulatorStepper(private val acc: LongAccumulator) ex
261261
i = 0
262262
}
263263

264-
def characteristics() = ORDERED | SIZED | SUBSIZED | NONNULL
264+
def characteristics = ORDERED | SIZED | SUBSIZED | NONNULL
265265

266266
def estimateSize = N
267267

268268
def hasNext = N > 0
269269

270-
def nextLong: Long =
270+
def nextLong(): Long =
271271
if (n <= 0) throw new NoSuchElementException("next on empty Stepper")
272272
else {
273273
if (i >= n) loadMore()

0 commit comments

Comments
 (0)