scala/scala — pull request #312 by VladUreche (2012-03-22 15:55:36+00:00)
Title: Fixes SI-5593

After hours of debugging and understanding all the root causes why
scaladoc is rummaging through the current directory for classes, I
decided to treat the symptoms rather than the cause. I'll document
the decision here in case anyone is interested:
- in order to find documentable entities, scaladoc exhaustively
looks at all the symbols starting from the root package and going
all the way to the leaves, visiting all classes in the classpath
- if the classpath is empty, scaladoc and scalac add "." as the
default classpath. This leads to scaladoc going on a class hunting
spree in the current directory. If it happens that the current
directory contains package objects and they're not in the expected
path (like scala.tools.nsc in build/quick/classes/.../nsc) errors
start to pop up
- scalac is also affected by this, but to a more limited scope,
since it will lazily expand packages whenever necessary. To show
this, run the repl in the root directory of the scala source code,
after compiling scala:

scala> import build.quick.classes.compiler.scala.tools.nsc._
error: error while loading package, class file './build/quick/classes/
compiler/scala/tools/nsc/package.class' contains wrong package package

The cleanest solution I can see now is to look at the tree resulting
from compilation and use it for guidance -- I will look into this.