diff options
author | Paul Phillips <paulp@improving.org> | 2012-09-14 07:18:12 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-09-14 10:12:06 -0700 |
commit | 55b609458fd14de248c21132a3e4a4672de4ce4b (patch) | |
tree | 6db61304dacb4f59fb53859e7ef0afc6e937e9ff /src/library/scala/collection/parallel/package.scala | |
parent | f68201c469725c255ae2786f0ac1e37bc5f30a7a (diff) | |
download | scala-55b609458fd14de248c21132a3e4a4672de4ce4b.tar.gz scala-55b609458fd14de248c21132a3e4a4672de4ce4b.tar.bz2 scala-55b609458fd14de248c21132a3e4a4672de4ce4b.zip |
Eliminate breaking relative names in source.
These things are killing me. Constructions like
package scala.foo.bar.baz
import foo.Other
DO NOT WORK in general. Such files are not really in the
"scala" package, because it is not declared
package scala
package foo.bar.baz
And there is a second problem: using a relative path name means
compilation will fail in the presence of a directory of the same
name, e.g.
% mkdir reflect
% scalac src/reflect/scala/reflect/internal/util/Position.scala
src/reflect/scala/reflect/internal/util/Position.scala:9: error:
object ClassTag is not a member of package reflect
import reflect.ClassTag
^
src/reflect/scala/reflect/internal/util/Position.scala:10: error:
object base is not a member of package reflect
import reflect.base.Attachments
^
As a rule, do not use relative package paths unless you have
explicitly imported the path to which you think you are relative.
Better yet, don't use them at all. Unfortunately they mostly work
because scala variously thinks everything scala.* is in the scala
package and/or because you usually aren't bootstrapping and it
falls through to an existing version of the class already on the
classpath.
Making the paths explicit is not a complete solution -
in particular, we remain enormously vulnerable to any directory
or package called "scala" which isn't ours - but it greatly
limts the severity of the problem.
Diffstat (limited to 'src/library/scala/collection/parallel/package.scala')
-rw-r--r-- | src/library/scala/collection/parallel/package.scala | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/library/scala/collection/parallel/package.scala b/src/library/scala/collection/parallel/package.scala index e3124af12e..30b4c0c914 100644 --- a/src/library/scala/collection/parallel/package.scala +++ b/src/library/scala/collection/parallel/package.scala @@ -12,8 +12,8 @@ import scala.collection.generic.CanBuildFrom import scala.collection.generic.CanCombineFrom import scala.collection.parallel.mutable.ParArray import scala.collection.mutable.UnrolledBuffer -import annotation.unchecked.uncheckedVariance -import language.implicitConversions +import scala.annotation.unchecked.uncheckedVariance +import scala.language.implicitConversions /** Package object for parallel collections. */ @@ -48,7 +48,7 @@ package object parallel { } else new ThreadPoolTaskSupport val defaultTaskSupport: TaskSupport = getTaskSupport - + def setTaskSupport[Coll](c: Coll, t: TaskSupport): Coll = { c match { case pc: ParIterableLike[_, _, _] => pc.tasksupport = t @@ -56,7 +56,7 @@ package object parallel { } c } - + /* implicit conversions */ implicit def factory2ops[From, Elem, To](bf: CanBuildFrom[From, Elem, To]) = new FactoryOps[From, Elem, To] { @@ -66,7 +66,7 @@ package object parallel { def otherwise(notbody: => R) = if (isParallel) isbody(asParallel) else notbody } } - implicit def traversable2ops[T](t: collection.GenTraversableOnce[T]) = new TraversableOps[T] { + implicit def traversable2ops[T](t: scala.collection.GenTraversableOnce[T]) = new TraversableOps[T] { def isParallel = t.isInstanceOf[Parallel] def isParIterable = t.isInstanceOf[ParIterable[_]] def asParIterable = t.asInstanceOf[ParIterable[T]] @@ -149,7 +149,7 @@ package parallel { * Automatically forwards the signal delegate when splitting. */ private[parallel] class BufferSplitter[T] - (private val buffer: collection.mutable.ArrayBuffer[T], private var index: Int, private val until: Int, _sigdel: collection.generic.Signalling) + (private val buffer: scala.collection.mutable.ArrayBuffer[T], private var index: Int, private val until: Int, _sigdel: scala.collection.generic.Signalling) extends IterableSplitter[T] { signalDelegate = _sigdel def hasNext = index < until |