From 55b609458fd14de248c21132a3e4a4672de4ce4b Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 14 Sep 2012 07:18:12 -0700 Subject: 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. --- src/library/scala/collection/immutable/List.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/library/scala/collection/immutable/List.scala') diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala index 87b58005cf..b77e8b4c7c 100644 --- a/src/library/scala/collection/immutable/List.scala +++ b/src/library/scala/collection/immutable/List.scala @@ -13,7 +13,7 @@ package immutable import generic._ import mutable.{Builder, ListBuffer} -import annotation.tailrec +import scala.annotation.tailrec import java.io._ /** A class for immutable linked lists representing ordered collections @@ -330,7 +330,7 @@ case object Nil extends List[Nothing] { throw new UnsupportedOperationException("tail of empty list") // Removal of equals method here might lead to an infinite recursion similar to IntMap.equals. override def equals(that: Any) = that match { - case that1: collection.GenSeq[_] => that1.isEmpty + case that1: scala.collection.GenSeq[_] => that1.isEmpty case _ => false } } -- cgit v1.2.3