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/partest | |
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/partest')
5 files changed, 6 insertions, 6 deletions
diff --git a/src/partest/scala/tools/partest/PartestDefaults.scala b/src/partest/scala/tools/partest/PartestDefaults.scala index 73a7b92778..b27ce6ff75 100644 --- a/src/partest/scala/tools/partest/PartestDefaults.scala +++ b/src/partest/scala/tools/partest/PartestDefaults.scala @@ -2,7 +2,7 @@ package scala.tools package partest import nsc.io.{ File, Path, Directory } -import util.{ PathResolver } +import scala.tools.util.PathResolver import nsc.Properties.{ propOrElse, propOrNone, propOrEmpty } import java.lang.Runtime.getRuntime diff --git a/src/partest/scala/tools/partest/TestUtil.scala b/src/partest/scala/tools/partest/TestUtil.scala index 146e6fc69f..9bfd444180 100644 --- a/src/partest/scala/tools/partest/TestUtil.scala +++ b/src/partest/scala/tools/partest/TestUtil.scala @@ -1,6 +1,6 @@ package scala.tools.partest -import reflect.{ classTag, ClassTag } +import scala.reflect.{ classTag, ClassTag } trait TestUtil { /** Given function and block of code, evaluates code block, diff --git a/src/partest/scala/tools/partest/nest/FileManager.scala b/src/partest/scala/tools/partest/nest/FileManager.scala index 064b82da85..512c718040 100644 --- a/src/partest/scala/tools/partest/nest/FileManager.scala +++ b/src/partest/scala/tools/partest/nest/FileManager.scala @@ -13,7 +13,7 @@ import java.io.{File, FilenameFilter, IOException, StringWriter, FileReader, PrintWriter, FileWriter} import java.net.URI import scala.tools.nsc.io.{ Path, Directory, File => SFile } -import sys.process._ +import scala.sys.process._ import scala.collection.mutable trait FileUtil { diff --git a/src/partest/scala/tools/partest/nest/SBTRunner.scala b/src/partest/scala/tools/partest/nest/SBTRunner.scala index 6fa31492f3..206ee19c76 100644 --- a/src/partest/scala/tools/partest/nest/SBTRunner.scala +++ b/src/partest/scala/tools/partest/nest/SBTRunner.scala @@ -4,7 +4,7 @@ package nest import java.io.File import scala.tools.nsc.io.{ Directory } import scala.util.Properties.setProp -import collection.JavaConverters._ +import scala.collection.JavaConverters._ object SBTRunner extends DirectRunner { diff --git a/src/partest/scala/tools/partest/package.scala b/src/partest/scala/tools/partest/package.scala index 16a95c8966..ec1778940f 100644 --- a/src/partest/scala/tools/partest/package.scala +++ b/src/partest/scala/tools/partest/package.scala @@ -6,7 +6,7 @@ package scala.tools import java.io.{ FileNotFoundException, File => JFile } import nsc.io.{ Path, Directory, File => SFile } -import util.{ PathResolver } +import scala.tools.util.PathResolver import nsc.Properties.{ propOrElse, propOrNone, propOrEmpty } import scala.sys.process.javaVmArguments import java.util.concurrent.Callable @@ -62,7 +62,7 @@ package object partest { ) def allPropertiesString = { - import collection.JavaConversions._ + import scala.collection.JavaConversions._ System.getProperties.toList.sorted map { case (k, v) => "%s -> %s\n".format(k, v) } mkString "" } |