Skip to content

Commit 13fb0ed

Browse files
authored
Merge pull request #16 from SethTisue/deprecation-cleanup
remove deprecated stuff
2 parents 31c7877 + b977b01 commit 13fb0ed

File tree

10 files changed

+22
-199
lines changed

10 files changed

+22
-199
lines changed

build.sbt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
resolvers in ThisBuild += "scala-pr" at "https://scala-ci.typesafe.com/artifactory/scala-integration/"
22

3-
crossScalaVersions in ThisBuild := Seq("2.13.0-pre-e2a2cba") // March 16, 2017
3+
crossScalaVersions in ThisBuild := Seq("2.13.0-pre-f9a019c") // April 2, 2017
44

55
scalaVersion in ThisBuild := crossScalaVersions.value.head
66

7-
version in ThisBuild := "0.1.1-SNAPSHOT"
7+
version in ThisBuild := "0.1.2-SNAPSHOT"
88

9-
scalacOptions in ThisBuild ++= Seq("-deprecation", "-feature")
9+
scalacOptions in ThisBuild ++= Seq("-deprecation", "-feature", "-Xfatal-warnings")
1010

1111
cancelable in Global := true
1212

core/src/main/scala/scala/collection/generic/ParFactory.scala

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import scala.language.higherKinds
1717
* thereof. This class extends `TraversableFactory` and provides a set of
1818
* operations to create `$Coll` objects.
1919
*
20+
* @define factoryInfo
21+
* This object provides a set of operations needed to create `$Coll` values.
2022
* @define coll parallel collection
2123
* @define Coll `ParIterable`
2224
* @since 2.8

core/src/main/scala/scala/collection/generic/ParMapFactory.scala

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import scala.language.higherKinds
2222
*
2323
* @define coll parallel map
2424
* @define Coll `ParMap`
25+
* @define factoryInfo
26+
* This object provides a set of operations needed to create `$Coll` values.
2527
* @author Aleksandar Prokopec
2628
* @since 2.8
2729
*/

core/src/main/scala/scala/collection/generic/ParSetFactory.scala

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import scala.collection.parallel.ParSetLike
1616
import scala.language.higherKinds
1717

1818
/**
19+
* @define factoryInfo
20+
* This object provides a set of operations needed to create `$Coll` values.
1921
* @author Aleksandar Prokopec
2022
* @since 2.8
2123
*/

core/src/main/scala/scala/collection/parallel/ParIterableLike.scala

+8-7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ import scala.collection.parallel.ParallelCollectionImplicits._
3939
* @tparam T the element type of the collection
4040
* @tparam Repr the type of the actual collection containing the elements
4141
*
42+
* @define undefinedorder
43+
* The order in which operations are performed on elements is unspecified
44+
* and may be nondeterministic.
45+
*
4246
* @define paralleliterableinfo
4347
* This is a base trait for Scala parallel collections. It defines behaviour
4448
* common to all parallel collections. Concrete parallel collections should
@@ -521,7 +525,7 @@ self: ParIterableLike[T, Repr, Sequential] =>
521525
* @param p a predicate used to test elements
522526
* @return true if `p` holds for all elements, false otherwise
523527
*/
524-
def forall(@deprecatedName('pred) p: T => Boolean): Boolean = {
528+
def forall(p: T => Boolean): Boolean = {
525529
tasksupport.executeAndWaitResult(new Forall(p, splitter assign new DefaultSignalling with VolatileAbort))
526530
}
527531

@@ -532,7 +536,7 @@ self: ParIterableLike[T, Repr, Sequential] =>
532536
* @param p a predicate used to test elements
533537
* @return true if `p` holds for some element, false otherwise
534538
*/
535-
def exists(@deprecatedName('pred) p: T => Boolean): Boolean = {
539+
def exists(p: T => Boolean): Boolean = {
536540
tasksupport.executeAndWaitResult(new Exists(p, splitter assign new DefaultSignalling with VolatileAbort))
537541
}
538542

@@ -547,7 +551,7 @@ self: ParIterableLike[T, Repr, Sequential] =>
547551
* @param p predicate used to test the elements
548552
* @return an option value with the element if such an element exists, or `None` otherwise
549553
*/
550-
def find(@deprecatedName('pred) p: T => Boolean): Option[T] = {
554+
def find(p: T => Boolean): Option[T] = {
551555
tasksupport.executeAndWaitResult(new Find(p, splitter assign new DefaultSignalling with VolatileAbort))
552556
}
553557

@@ -714,7 +718,7 @@ self: ParIterableLike[T, Repr, Sequential] =>
714718
* @tparam That type of the resulting collection
715719
* @param z neutral element for the operator `op`
716720
* @param op the associative operator for the scan
717-
* @param bf $bfinfo
721+
* @param bf $pbfinfo
718722
* @return a collection containing the prefix scan of the elements in the original collection
719723
*
720724
* @usecase def scan(z: T)(op: (T, T) => T): $Coll[T]
@@ -842,9 +846,6 @@ self: ParIterableLike[T, Repr, Sequential] =>
842846
tasksupport.executeAndWaitResult(new ToParMap(combinerFactory(cbf), splitter)(ev) mapResult { _.resultWithTaskSupport })
843847
}
844848

845-
@deprecated("use .seq.view instead", "2.11.0")
846-
def view = seq.view
847-
848849
override def toArray[U >: T: ClassTag]: Array[U] = {
849850
val arr = new Array[U](size)
850851
copyToArray(arr)

core/src/main/scala/scala/collection/parallel/ParSeqLike.scala

+5-3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ import scala.collection.parallel.ParallelCollectionImplicits._
3535
* nondeterministic. If the higher-order functions given to them produce no sideeffects,
3636
* then this won't be noticeable.
3737
*
38+
* @define mayNotTerminateInf
39+
* Note: may not terminate for infinite-sized collections.
40+
* @define willNotTerminateInf
41+
* Note: will not terminate for infinite-sized collections.
42+
*
3843
* This trait defines a new, more general `split` operation and reimplements the `split`
3944
* operation of `ParallelIterable` trait using the new `split` operation.
4045
*
@@ -323,9 +328,6 @@ self =>
323328

324329
override def toSeq = this.asInstanceOf[ParSeq[T]]
325330

326-
@deprecated("use .seq.view", "2.11.0")
327-
override def view = seq.view
328-
329331
/* tasks */
330332

331333
protected[this] def down(p: IterableSplitter[_]) = p.asInstanceOf[SeqSplitter[T]]

core/src/main/scala/scala/collection/parallel/TaskSupport.scala

-8
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,6 @@ trait TaskSupport extends Tasks
5656
class ForkJoinTaskSupport(val environment: ForkJoinPool = ForkJoinTasks.defaultForkJoinPool)
5757
extends TaskSupport with AdaptiveWorkStealingForkJoinTasks
5858

59-
/** A task support that uses a thread pool executor to schedule tasks.
60-
*
61-
* @see [[scala.collection.parallel.TaskSupport]] for more information.
62-
*/
63-
@deprecated("use `ForkJoinTaskSupport` instead", "2.11.0")
64-
class ThreadPoolTaskSupport(val environment: ThreadPoolExecutor = ThreadPoolTasks.defaultThreadPool)
65-
extends TaskSupport with AdaptiveWorkStealingThreadPoolTasks
66-
6759
/** A task support that uses an execution context to schedule tasks.
6860
*
6961
* It can be used with the default execution context implementation in the

core/src/main/scala/scala/collection/parallel/Tasks.scala

-147
Original file line numberDiff line numberDiff line change
@@ -206,142 +206,6 @@ trait AdaptiveWorkStealingTasks extends Tasks {
206206

207207
}
208208

209-
210-
/** An implementation of tasks objects based on the Java thread pooling API. */
211-
@deprecated("use `ForkJoinTasks` instead", "2.11.0")
212-
trait ThreadPoolTasks extends Tasks {
213-
import java.util.concurrent._
214-
215-
trait WrappedTask[R, +Tp] extends Runnable with super.WrappedTask[R, Tp] {
216-
// initially, this is null
217-
// once the task is started, this future is set and used for `sync`
218-
// utb: var future: Future[_] = null
219-
@volatile var owned = false
220-
@volatile var completed = false
221-
222-
def start() = synchronized {
223-
// debuglog("Starting " + body)
224-
// utb: future = executor.submit(this)
225-
executor.synchronized {
226-
incrTasks()
227-
executor.submit(this)
228-
}
229-
}
230-
def sync() = synchronized {
231-
// debuglog("Syncing on " + body)
232-
// utb: future.get()
233-
executor.synchronized {
234-
val coresize = executor.getCorePoolSize
235-
if (coresize < totaltasks) {
236-
executor.setCorePoolSize(coresize + 1)
237-
//assert(executor.getCorePoolSize == (coresize + 1))
238-
}
239-
}
240-
while (!completed) this.wait
241-
}
242-
def tryCancel() = synchronized {
243-
// utb: future.cancel(false)
244-
if (!owned) {
245-
// debuglog("Cancelling " + body)
246-
owned = true
247-
true
248-
} else false
249-
}
250-
def run() = {
251-
// utb: compute
252-
var isOkToRun = false
253-
synchronized {
254-
if (!owned) {
255-
owned = true
256-
isOkToRun = true
257-
}
258-
}
259-
if (isOkToRun) {
260-
// debuglog("Running body of " + body)
261-
compute()
262-
} else {
263-
// just skip
264-
// debuglog("skipping body of " + body)
265-
}
266-
}
267-
override def release() = synchronized {
268-
//println("releasing: " + this + ", body: " + this.body)
269-
completed = true
270-
executor.synchronized {
271-
decrTasks()
272-
}
273-
this.notifyAll
274-
}
275-
}
276-
277-
protected def newWrappedTask[R, Tp](b: Task[R, Tp]): WrappedTask[R, Tp]
278-
279-
val environment: ThreadPoolExecutor
280-
def executor = environment.asInstanceOf[ThreadPoolExecutor]
281-
def queue = executor.getQueue.asInstanceOf[LinkedBlockingQueue[Runnable]]
282-
@volatile var totaltasks = 0
283-
284-
private def incrTasks() = synchronized {
285-
totaltasks += 1
286-
}
287-
288-
private def decrTasks() = synchronized {
289-
totaltasks -= 1
290-
}
291-
292-
def execute[R, Tp](task: Task[R, Tp]): () => R = {
293-
val t = newWrappedTask(task)
294-
295-
// debuglog("-----------> Executing without wait: " + task)
296-
t.start()
297-
298-
() => {
299-
t.sync()
300-
t.body.forwardThrowable()
301-
t.body.result
302-
}
303-
}
304-
305-
def executeAndWaitResult[R, Tp](task: Task[R, Tp]): R = {
306-
val t = newWrappedTask(task)
307-
308-
// debuglog("-----------> Executing with wait: " + task)
309-
t.start()
310-
311-
t.sync()
312-
t.body.forwardThrowable()
313-
t.body.result
314-
}
315-
316-
def parallelismLevel = ThreadPoolTasks.numCores
317-
318-
}
319-
320-
@deprecated("use `ForkJoinTasks` instead", "2.11.0")
321-
object ThreadPoolTasks {
322-
import java.util.concurrent._
323-
324-
val numCores = Runtime.getRuntime.availableProcessors
325-
326-
val tcount = new atomic.AtomicLong(0L)
327-
328-
val defaultThreadPool = new ThreadPoolExecutor(
329-
numCores,
330-
Int.MaxValue,
331-
60L, TimeUnit.MILLISECONDS,
332-
new LinkedBlockingQueue[Runnable],
333-
new ThreadFactory {
334-
def newThread(r: Runnable) = {
335-
val t = new Thread(r)
336-
t.setName("pc-thread-" + tcount.incrementAndGet)
337-
t.setDaemon(true)
338-
t
339-
}
340-
},
341-
new ThreadPoolExecutor.CallerRunsPolicy
342-
)
343-
}
344-
345209
object FutureThreadPoolTasks {
346210
import java.util.concurrent._
347211

@@ -445,17 +309,6 @@ trait AdaptiveWorkStealingForkJoinTasks extends ForkJoinTasks with AdaptiveWorkS
445309
def newWrappedTask[R, Tp](b: Task[R, Tp]) = new WrappedTask[R, Tp](b)
446310
}
447311

448-
@deprecated("use `AdaptiveWorkStealingForkJoinTasks` instead", "2.11.0")
449-
trait AdaptiveWorkStealingThreadPoolTasks extends ThreadPoolTasks with AdaptiveWorkStealingTasks {
450-
451-
class WrappedTask[R, Tp](val body: Task[R, Tp])
452-
extends super[ThreadPoolTasks].WrappedTask[R, Tp] with super[AdaptiveWorkStealingTasks].WrappedTask[R, Tp] {
453-
def split = body.split.map(b => newWrappedTask(b))
454-
}
455-
456-
def newWrappedTask[R, Tp](b: Task[R, Tp]) = new WrappedTask[R, Tp](b)
457-
}
458-
459312
/** An implementation of the `Tasks` that uses Scala `Future`s to compute
460313
* the work encapsulated in each task.
461314
*/

core/src/main/scala/scala/collection/parallel/package.scala

-22
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,6 @@ package parallel {
8181
def otherwise(notbody: => R) = if (isParallel) isbody(asParSeq) else notbody
8282
}
8383
}
84-
implicit def throwable2ops(self: Throwable) = new ThrowableOps {
85-
def alongWith(that: Throwable) = (self, that) match {
86-
case (self: CompositeThrowable, that: CompositeThrowable) => new CompositeThrowable(self.throwables ++ that.throwables)
87-
case (self: CompositeThrowable, _) => new CompositeThrowable(self.throwables + that)
88-
case (_, that: CompositeThrowable) => new CompositeThrowable(that.throwables + self)
89-
case _ => new CompositeThrowable(Set(self, that))
90-
}
91-
}
9284
}
9385

9486
trait FactoryOps[From, Elem, To] {
@@ -114,12 +106,6 @@ package parallel {
114106
def ifParSeq[R](isbody: ParSeq[T] => R): Otherwise[R]
115107
}
116108

117-
@deprecated("this trait will be removed", "2.11.0")
118-
trait ThrowableOps {
119-
@deprecated("this method will be removed", "2.11.0")
120-
def alongWith(that: Throwable): Throwable
121-
}
122-
123109
/* classes */
124110

125111
trait CombinerFactory[U, Repr] {
@@ -134,14 +120,6 @@ package parallel {
134120
def doesShareCombiners: Boolean
135121
}
136122

137-
/** Composite throwable - thrown when multiple exceptions are thrown at the same time. */
138-
@deprecated("this class will be removed.", "2.11.0")
139-
final case class CompositeThrowable(throwables: Set[Throwable]) extends Exception(
140-
"Multiple exceptions thrown during a parallel computation: " +
141-
throwables.map(t => t + "\n" + t.getStackTrace.take(10).++("...").mkString("\n")).mkString("\n\n")
142-
)
143-
144-
145123
/** A helper iterator for iterating very small array buffers.
146124
* Automatically forwards the signal delegate when splitting.
147125
*/

junit/src/test/scala/scala/collection/NewBuilderTest.scala

-9
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import scala.reflect.ClassTag
1111
import org.junit.Assert._
1212

1313
/* Tests various maps by making sure they all agree on the same answers. */
14-
@deprecated("Suppress warnings", since="2.11")
1514
@RunWith(classOf[JUnit4])
1615
class NewBuilderTest {
1716

@@ -46,14 +45,8 @@ class NewBuilderTest {
4645
test[scm.MutableList[_] ]((scm.MutableList(1): sc.Seq[Int] ).map(x => x))
4746
test[scm.Queue[_] ]((scm.Queue(1): sc.GenTraversable[Int]).map(x => x))
4847
test[scm.Queue[_] ]((scm.Queue(1): sc.Seq[Int] ).map(x => x))
49-
test[scm.DoubleLinkedList[_]]((scm.DoubleLinkedList(1): sc.GenTraversable[Int]).map(x => x))
50-
test[scm.DoubleLinkedList[_]]((scm.DoubleLinkedList(1): sc.Seq[Int] ).map(x => x))
51-
test[scm.LinkedList[_] ]((scm.LinkedList(1): sc.GenTraversable[Int]).map(x => x))
52-
test[scm.LinkedList[_] ]((scm.LinkedList(1): sc.Seq[Int] ).map(x => x))
5348
test[scm.ArrayStack[_] ]((scm.ArrayStack(1): sc.GenTraversable[Int]).map(x => x))
5449
test[scm.ArrayStack[_] ]((scm.ArrayStack(1): sc.Seq[Int] ).map(x => x))
55-
test[scm.Stack[_] ]((scm.Stack(1): sc.GenTraversable[Int]).map(x => x))
56-
test[scm.Stack[_] ]((scm.Stack(1): sc.Seq[Int] ).map(x => x))
5750
test[scm.ArraySeq[_] ]((scm.ArraySeq(1): sc.GenTraversable[Int]).map(x => x))
5851
test[scm.ArraySeq[_] ]((scm.ArraySeq(1): sc.Seq[Int] ).map(x => x))
5952

@@ -84,8 +77,6 @@ class NewBuilderTest {
8477
test[sci.List[_] ]((sci.List(1): sc.Seq[Int] ).map(x => x))
8578
test[sci.Stream[_] ]((sci.Stream(1): sc.GenTraversable[Int]).map(x => x))
8679
test[sci.Stream[_] ]((sci.Stream(1): sc.Seq[Int] ).map(x => x))
87-
test[sci.Stack[_] ]((sci.Stack(1): sc.GenTraversable[Int]).map(x => x))
88-
test[sci.Stack[_] ]((sci.Stack(1): sc.Seq[Int] ).map(x => x))
8980
test[sci.Queue[_] ]((sci.Queue(1): sc.GenTraversable[Int]).map(x => x))
9081
test[sci.Queue[_] ]((sci.Queue(1): sc.Seq[Int] ).map(x => x))
9182
test[sci.IndexedSeq[_] ]((sci.IndexedSeq(1): sc.GenTraversable[Int]).map(x => x))

0 commit comments

Comments
 (0)