Skip to content

remove deprecated stuff #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
resolvers in ThisBuild += "scala-pr" at "https://scala-ci.typesafe.com/artifactory/scala-integration/"

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

scalaVersion in ThisBuild := crossScalaVersions.value.head

version in ThisBuild := "0.1.1-SNAPSHOT"
version in ThisBuild := "0.1.2-SNAPSHOT"

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

cancelable in Global := true

Expand Down
2 changes: 2 additions & 0 deletions core/src/main/scala/scala/collection/generic/ParFactory.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import scala.language.higherKinds
* thereof. This class extends `TraversableFactory` and provides a set of
* operations to create `$Coll` objects.
*
* @define factoryInfo
* This object provides a set of operations needed to create `$Coll` values.
* @define coll parallel collection
* @define Coll `ParIterable`
* @since 2.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import scala.language.higherKinds
*
* @define coll parallel map
* @define Coll `ParMap`
* @define factoryInfo
* This object provides a set of operations needed to create `$Coll` values.
* @author Aleksandar Prokopec
* @since 2.8
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import scala.collection.parallel.ParSetLike
import scala.language.higherKinds

/**
* @define factoryInfo
* This object provides a set of operations needed to create `$Coll` values.
* @author Aleksandar Prokopec
* @since 2.8
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ import scala.collection.parallel.ParallelCollectionImplicits._
* @tparam T the element type of the collection
* @tparam Repr the type of the actual collection containing the elements
*
* @define undefinedorder
* The order in which operations are performed on elements is unspecified
* and may be nondeterministic.
*
* @define paralleliterableinfo
* This is a base trait for Scala parallel collections. It defines behaviour
* common to all parallel collections. Concrete parallel collections should
Expand Down Expand Up @@ -521,7 +525,7 @@ self: ParIterableLike[T, Repr, Sequential] =>
* @param p a predicate used to test elements
* @return true if `p` holds for all elements, false otherwise
*/
def forall(@deprecatedName('pred) p: T => Boolean): Boolean = {
def forall(p: T => Boolean): Boolean = {
tasksupport.executeAndWaitResult(new Forall(p, splitter assign new DefaultSignalling with VolatileAbort))
}

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

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

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

@deprecated("use .seq.view instead", "2.11.0")
def view = seq.view

override def toArray[U >: T: ClassTag]: Array[U] = {
val arr = new Array[U](size)
copyToArray(arr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ import scala.collection.parallel.ParallelCollectionImplicits._
* nondeterministic. If the higher-order functions given to them produce no sideeffects,
* then this won't be noticeable.
*
* @define mayNotTerminateInf
* Note: may not terminate for infinite-sized collections.
* @define willNotTerminateInf
* Note: will not terminate for infinite-sized collections.
*
* This trait defines a new, more general `split` operation and reimplements the `split`
* operation of `ParallelIterable` trait using the new `split` operation.
*
Expand Down Expand Up @@ -323,9 +328,6 @@ self =>

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

@deprecated("use .seq.view", "2.11.0")
override def view = seq.view

/* tasks */

protected[this] def down(p: IterableSplitter[_]) = p.asInstanceOf[SeqSplitter[T]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ trait TaskSupport extends Tasks
class ForkJoinTaskSupport(val environment: ForkJoinPool = ForkJoinTasks.defaultForkJoinPool)
extends TaskSupport with AdaptiveWorkStealingForkJoinTasks

/** A task support that uses a thread pool executor to schedule tasks.
*
* @see [[scala.collection.parallel.TaskSupport]] for more information.
*/
@deprecated("use `ForkJoinTaskSupport` instead", "2.11.0")
class ThreadPoolTaskSupport(val environment: ThreadPoolExecutor = ThreadPoolTasks.defaultThreadPool)
extends TaskSupport with AdaptiveWorkStealingThreadPoolTasks

/** A task support that uses an execution context to schedule tasks.
*
* It can be used with the default execution context implementation in the
Expand Down
147 changes: 0 additions & 147 deletions core/src/main/scala/scala/collection/parallel/Tasks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -206,142 +206,6 @@ trait AdaptiveWorkStealingTasks extends Tasks {

}


/** An implementation of tasks objects based on the Java thread pooling API. */
@deprecated("use `ForkJoinTasks` instead", "2.11.0")
trait ThreadPoolTasks extends Tasks {
import java.util.concurrent._

trait WrappedTask[R, +Tp] extends Runnable with super.WrappedTask[R, Tp] {
// initially, this is null
// once the task is started, this future is set and used for `sync`
// utb: var future: Future[_] = null
@volatile var owned = false
@volatile var completed = false

def start() = synchronized {
// debuglog("Starting " + body)
// utb: future = executor.submit(this)
executor.synchronized {
incrTasks()
executor.submit(this)
}
}
def sync() = synchronized {
// debuglog("Syncing on " + body)
// utb: future.get()
executor.synchronized {
val coresize = executor.getCorePoolSize
if (coresize < totaltasks) {
executor.setCorePoolSize(coresize + 1)
//assert(executor.getCorePoolSize == (coresize + 1))
}
}
while (!completed) this.wait
}
def tryCancel() = synchronized {
// utb: future.cancel(false)
if (!owned) {
// debuglog("Cancelling " + body)
owned = true
true
} else false
}
def run() = {
// utb: compute
var isOkToRun = false
synchronized {
if (!owned) {
owned = true
isOkToRun = true
}
}
if (isOkToRun) {
// debuglog("Running body of " + body)
compute()
} else {
// just skip
// debuglog("skipping body of " + body)
}
}
override def release() = synchronized {
//println("releasing: " + this + ", body: " + this.body)
completed = true
executor.synchronized {
decrTasks()
}
this.notifyAll
}
}

protected def newWrappedTask[R, Tp](b: Task[R, Tp]): WrappedTask[R, Tp]

val environment: ThreadPoolExecutor
def executor = environment.asInstanceOf[ThreadPoolExecutor]
def queue = executor.getQueue.asInstanceOf[LinkedBlockingQueue[Runnable]]
@volatile var totaltasks = 0

private def incrTasks() = synchronized {
totaltasks += 1
}

private def decrTasks() = synchronized {
totaltasks -= 1
}

def execute[R, Tp](task: Task[R, Tp]): () => R = {
val t = newWrappedTask(task)

// debuglog("-----------> Executing without wait: " + task)
t.start()

() => {
t.sync()
t.body.forwardThrowable()
t.body.result
}
}

def executeAndWaitResult[R, Tp](task: Task[R, Tp]): R = {
val t = newWrappedTask(task)

// debuglog("-----------> Executing with wait: " + task)
t.start()

t.sync()
t.body.forwardThrowable()
t.body.result
}

def parallelismLevel = ThreadPoolTasks.numCores

}

@deprecated("use `ForkJoinTasks` instead", "2.11.0")
object ThreadPoolTasks {
import java.util.concurrent._

val numCores = Runtime.getRuntime.availableProcessors

val tcount = new atomic.AtomicLong(0L)

val defaultThreadPool = new ThreadPoolExecutor(
numCores,
Int.MaxValue,
60L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue[Runnable],
new ThreadFactory {
def newThread(r: Runnable) = {
val t = new Thread(r)
t.setName("pc-thread-" + tcount.incrementAndGet)
t.setDaemon(true)
t
}
},
new ThreadPoolExecutor.CallerRunsPolicy
)
}

object FutureThreadPoolTasks {
import java.util.concurrent._

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

@deprecated("use `AdaptiveWorkStealingForkJoinTasks` instead", "2.11.0")
trait AdaptiveWorkStealingThreadPoolTasks extends ThreadPoolTasks with AdaptiveWorkStealingTasks {

class WrappedTask[R, Tp](val body: Task[R, Tp])
extends super[ThreadPoolTasks].WrappedTask[R, Tp] with super[AdaptiveWorkStealingTasks].WrappedTask[R, Tp] {
def split = body.split.map(b => newWrappedTask(b))
}

def newWrappedTask[R, Tp](b: Task[R, Tp]) = new WrappedTask[R, Tp](b)
}

/** An implementation of the `Tasks` that uses Scala `Future`s to compute
* the work encapsulated in each task.
*/
Expand Down
22 changes: 0 additions & 22 deletions core/src/main/scala/scala/collection/parallel/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,6 @@ package parallel {
def otherwise(notbody: => R) = if (isParallel) isbody(asParSeq) else notbody
}
}
implicit def throwable2ops(self: Throwable) = new ThrowableOps {
def alongWith(that: Throwable) = (self, that) match {
case (self: CompositeThrowable, that: CompositeThrowable) => new CompositeThrowable(self.throwables ++ that.throwables)
case (self: CompositeThrowable, _) => new CompositeThrowable(self.throwables + that)
case (_, that: CompositeThrowable) => new CompositeThrowable(that.throwables + self)
case _ => new CompositeThrowable(Set(self, that))
}
}
}

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

@deprecated("this trait will be removed", "2.11.0")
trait ThrowableOps {
@deprecated("this method will be removed", "2.11.0")
def alongWith(that: Throwable): Throwable
}

/* classes */

trait CombinerFactory[U, Repr] {
Expand All @@ -134,14 +120,6 @@ package parallel {
def doesShareCombiners: Boolean
}

/** Composite throwable - thrown when multiple exceptions are thrown at the same time. */
@deprecated("this class will be removed.", "2.11.0")
final case class CompositeThrowable(throwables: Set[Throwable]) extends Exception(
"Multiple exceptions thrown during a parallel computation: " +
throwables.map(t => t + "\n" + t.getStackTrace.take(10).++("...").mkString("\n")).mkString("\n\n")
)


/** A helper iterator for iterating very small array buffers.
* Automatically forwards the signal delegate when splitting.
*/
Expand Down
9 changes: 0 additions & 9 deletions junit/src/test/scala/scala/collection/NewBuilderTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import scala.reflect.ClassTag
import org.junit.Assert._

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

Expand Down Expand Up @@ -46,14 +45,8 @@ class NewBuilderTest {
test[scm.MutableList[_] ]((scm.MutableList(1): sc.Seq[Int] ).map(x => x))
test[scm.Queue[_] ]((scm.Queue(1): sc.GenTraversable[Int]).map(x => x))
test[scm.Queue[_] ]((scm.Queue(1): sc.Seq[Int] ).map(x => x))
test[scm.DoubleLinkedList[_]]((scm.DoubleLinkedList(1): sc.GenTraversable[Int]).map(x => x))
test[scm.DoubleLinkedList[_]]((scm.DoubleLinkedList(1): sc.Seq[Int] ).map(x => x))
test[scm.LinkedList[_] ]((scm.LinkedList(1): sc.GenTraversable[Int]).map(x => x))
test[scm.LinkedList[_] ]((scm.LinkedList(1): sc.Seq[Int] ).map(x => x))
test[scm.ArrayStack[_] ]((scm.ArrayStack(1): sc.GenTraversable[Int]).map(x => x))
test[scm.ArrayStack[_] ]((scm.ArrayStack(1): sc.Seq[Int] ).map(x => x))
test[scm.Stack[_] ]((scm.Stack(1): sc.GenTraversable[Int]).map(x => x))
test[scm.Stack[_] ]((scm.Stack(1): sc.Seq[Int] ).map(x => x))
test[scm.ArraySeq[_] ]((scm.ArraySeq(1): sc.GenTraversable[Int]).map(x => x))
test[scm.ArraySeq[_] ]((scm.ArraySeq(1): sc.Seq[Int] ).map(x => x))

Expand Down Expand Up @@ -84,8 +77,6 @@ class NewBuilderTest {
test[sci.List[_] ]((sci.List(1): sc.Seq[Int] ).map(x => x))
test[sci.Stream[_] ]((sci.Stream(1): sc.GenTraversable[Int]).map(x => x))
test[sci.Stream[_] ]((sci.Stream(1): sc.Seq[Int] ).map(x => x))
test[sci.Stack[_] ]((sci.Stack(1): sc.GenTraversable[Int]).map(x => x))
test[sci.Stack[_] ]((sci.Stack(1): sc.Seq[Int] ).map(x => x))
test[sci.Queue[_] ]((sci.Queue(1): sc.GenTraversable[Int]).map(x => x))
test[sci.Queue[_] ]((sci.Queue(1): sc.Seq[Int] ).map(x => x))
test[sci.IndexedSeq[_] ]((sci.IndexedSeq(1): sc.GenTraversable[Int]).map(x => x))
Expand Down