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/actors-migration | |
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/actors-migration')
-rw-r--r-- | src/actors-migration/scala/actors/Pattern.scala | 4 | ||||
-rw-r--r-- | src/actors-migration/scala/actors/StashingActor.scala | 2 | ||||
-rw-r--r-- | src/actors-migration/scala/actors/Timeout.scala | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/actors-migration/scala/actors/Pattern.scala b/src/actors-migration/scala/actors/Pattern.scala index 26e9d1bb64..fa2db79152 100644 --- a/src/actors-migration/scala/actors/Pattern.scala +++ b/src/actors-migration/scala/actors/Pattern.scala @@ -1,7 +1,7 @@ package scala.actors import scala.concurrent.util.Duration -import language.implicitConversions +import scala.language.implicitConversions object pattern { @@ -23,4 +23,4 @@ class AskableActorRef(val ar: ActorRef) extends ActorRef { def forward(message: Any) = ar.forward(message) private[actors] def localActor: AbstractActor = ar.localActor -}
\ No newline at end of file +} diff --git a/src/actors-migration/scala/actors/StashingActor.scala b/src/actors-migration/scala/actors/StashingActor.scala index 8f96e1b002..29f370a3e2 100644 --- a/src/actors-migration/scala/actors/StashingActor.scala +++ b/src/actors-migration/scala/actors/StashingActor.scala @@ -3,7 +3,7 @@ package scala.actors import scala.collection._ import scala.concurrent.util.Duration import java.util.concurrent.TimeUnit -import language.implicitConversions +import scala.language.implicitConversions object StashingActor extends Combinators { implicit def mkBody[A](body: => A) = new InternalActor.Body[A] { diff --git a/src/actors-migration/scala/actors/Timeout.scala b/src/actors-migration/scala/actors/Timeout.scala index 7e400ab140..5540d2880e 100644 --- a/src/actors-migration/scala/actors/Timeout.scala +++ b/src/actors-migration/scala/actors/Timeout.scala @@ -10,7 +10,7 @@ package scala.actors import scala.concurrent.util.Duration import java.util.concurrent.TimeUnit -import language.implicitConversions +import scala.language.implicitConversions case class Timeout(duration: Duration) { def this(timeout: Long) = this(Duration(timeout, TimeUnit.MILLISECONDS)) |