Skip to content

Commit 54d0317

Browse files
committed
remove deprecated stuff (and enable -Xfatal-warnings)
fixes #11
1 parent c60ef6c commit 54d0317

File tree

7 files changed

+4
-188
lines changed

7 files changed

+4
-188
lines changed

build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ scalaVersion in ThisBuild := crossScalaVersions.value.head
66

77
version in ThisBuild := "0.1.1-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/parallel/ParIterableLike.scala

+3-6
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ self: ParIterableLike[T, Repr, Sequential] =>
521521
* @param p a predicate used to test elements
522522
* @return true if `p` holds for all elements, false otherwise
523523
*/
524-
def forall(@deprecatedName('pred) p: T => Boolean): Boolean = {
524+
def forall(p: T => Boolean): Boolean = {
525525
tasksupport.executeAndWaitResult(new Forall(p, splitter assign new DefaultSignalling with VolatileAbort))
526526
}
527527

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

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

@@ -842,9 +842,6 @@ self: ParIterableLike[T, Repr, Sequential] =>
842842
tasksupport.executeAndWaitResult(new ToParMap(combinerFactory(cbf), splitter)(ev) mapResult { _.resultWithTaskSupport })
843843
}
844844

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

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

-3
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,6 @@ self =>
323323

324324
override def toSeq = this.asInstanceOf[ParSeq[T]]
325325

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

331328
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

-1
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

0 commit comments

Comments
 (0)