summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/io
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-09-14 07:18:12 -0700
committerPaul Phillips <paulp@improving.org>2012-09-14 10:12:06 -0700
commit55b609458fd14de248c21132a3e4a4672de4ce4b (patch)
tree6db61304dacb4f59fb53859e7ef0afc6e937e9ff /src/compiler/scala/tools/nsc/io
parentf68201c469725c255ae2786f0ac1e37bc5f30a7a (diff)
downloadscala-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/compiler/scala/tools/nsc/io')
-rw-r--r--src/compiler/scala/tools/nsc/io/Jar.scala4
-rw-r--r--src/compiler/scala/tools/nsc/io/Pickler.scala6
-rw-r--r--src/compiler/scala/tools/nsc/io/package.scala2
3 files changed, 6 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/io/Jar.scala b/src/compiler/scala/tools/nsc/io/Jar.scala
index 12ba3e4bd7..f66f3daa32 100644
--- a/src/compiler/scala/tools/nsc/io/Jar.scala
+++ b/src/compiler/scala/tools/nsc/io/Jar.scala
@@ -8,10 +8,10 @@ package io
import java.io.{ InputStream, OutputStream, IOException, FileNotFoundException, FileInputStream, DataOutputStream }
import java.util.jar._
-import collection.JavaConverters._
+import scala.collection.JavaConverters._
import Attributes.Name
import util.ClassPath
-import language.implicitConversions
+import scala.language.implicitConversions
// Attributes.Name instances:
//
diff --git a/src/compiler/scala/tools/nsc/io/Pickler.scala b/src/compiler/scala/tools/nsc/io/Pickler.scala
index 48361cd157..b03a921e87 100644
--- a/src/compiler/scala/tools/nsc/io/Pickler.scala
+++ b/src/compiler/scala/tools/nsc/io/Pickler.scala
@@ -1,10 +1,10 @@
package scala.tools.nsc.io
-import annotation.unchecked
+import scala.annotation.unchecked
import Lexer._
import java.io.Writer
-import language.implicitConversions
-import reflect.ClassTag
+import scala.language.implicitConversions
+import scala.reflect.ClassTag
/** An abstract class for writing and reading Scala objects to and
* from a legible representation. The presesentation follows the following grammar:
diff --git a/src/compiler/scala/tools/nsc/io/package.scala b/src/compiler/scala/tools/nsc/io/package.scala
index 3c4f004198..6385706830 100644
--- a/src/compiler/scala/tools/nsc/io/package.scala
+++ b/src/compiler/scala/tools/nsc/io/package.scala
@@ -8,7 +8,7 @@ package scala.tools.nsc
import java.util.concurrent.{ Future, Callable }
import java.util.{ Timer, TimerTask }
import java.util.jar.{ Attributes }
-import language.implicitConversions
+import scala.language.implicitConversions
package object io {
implicit def postfixOps = language.postfixOps // make all postfix ops in this package compile without warning