summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
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/doc/html/HtmlPage.scala
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/doc/html/HtmlPage.scala')
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala b/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
index 7a74c569f3..f7c5611b8a 100644
--- a/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
+++ b/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
@@ -10,8 +10,8 @@ package html
import model._
import comment._
-import xml.{XML, NodeSeq}
-import xml.dtd.{DocType, PublicID}
+import scala.xml.{XML, NodeSeq}
+import scala.xml.dtd.{DocType, PublicID}
import scala.collection._
import java.io.Writer
@@ -87,7 +87,7 @@ abstract class HtmlPage extends Page { thisPage =>
case Title(in, _) => <h6>{ inlineToHtml(in) }</h6>
case Paragraph(in) => <p>{ inlineToHtml(in) }</p>
case Code(data) =>
- <pre>{ SyntaxHigh(data) }</pre> //<pre>{ xml.Text(data) }</pre>
+ <pre>{ SyntaxHigh(data) }</pre> //<pre>{ scala.xml.Text(data) }</pre>
case UnorderedList(items) =>
<ul>{ listItemsToHtml(items) }</ul>
case OrderedList(items, listStyle) =>
@@ -119,9 +119,9 @@ abstract class HtmlPage extends Page { thisPage =>
case Subscript(in) => <sub>{ inlineToHtml(in) }</sub>
case Link(raw, title) => <a href={ raw }>{ inlineToHtml(title) }</a>
case Monospace(in) => <code>{ inlineToHtml(in) }</code>
- case Text(text) => xml.Text(text)
+ case Text(text) => scala.xml.Text(text)
case Summary(in) => inlineToHtml(in)
- case HtmlTag(tag) => xml.Unparsed(tag)
+ case HtmlTag(tag) => scala.xml.Unparsed(tag)
case EntityLink(target, link) => linkToHtml(target, link, true)
}
@@ -158,11 +158,11 @@ abstract class HtmlPage extends Page { thisPage =>
if (starts.isEmpty && (inPos == string.length))
NodeSeq.Empty
else if (starts.isEmpty)
- xml.Text(string.slice(inPos, string.length))
+ scala.xml.Text(string.slice(inPos, string.length))
else if (inPos == starts.head)
toLinksIn(inPos, starts)
else {
- xml.Text(string.slice(inPos, starts.head)) ++ toLinksIn(starts.head, starts)
+ scala.xml.Text(string.slice(inPos, starts.head)) ++ toLinksIn(starts.head, starts)
}
}
def toLinksIn(inPos: Int, starts: List[Int]): NodeSeq = {
@@ -173,7 +173,7 @@ abstract class HtmlPage extends Page { thisPage =>
if (hasLinks)
toLinksOut(0, tpe.refEntity.keySet.toList)
else
- xml.Text(string)
+ scala.xml.Text(string)
}
def typesToHtml(tpess: List[model.TypeEntity], hasLinks: Boolean, sep: NodeSeq): NodeSeq = tpess match {
@@ -192,10 +192,10 @@ abstract class HtmlPage extends Page { thisPage =>
if (hasPage(dTpl)) {
<a href={ relativeLinkTo(dTpl) } class="extype" name={ dTpl.qualifiedName }>{ if (name eq null) dTpl.name else name }</a>
} else {
- xml.Text(if (name eq null) dTpl.name else name)
+ scala.xml.Text(if (name eq null) dTpl.name else name)
}
case ndTpl: NoDocTemplate =>
- xml.Text(if (name eq null) ndTpl.name else name)
+ scala.xml.Text(if (name eq null) ndTpl.name else name)
}
/** Returns the HTML code that represents the templates in `tpls` as a list of hyperlinked names. */