diff options
author | Martin Odersky <odersky@gmail.com> | 2009-05-05 16:12:53 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2009-05-05 16:12:53 +0000 |
commit | 330ad12bbf800572dd8f493b87b7e501a975b0ca (patch) | |
tree | f1cebba6809d83de56305b9f132b6a1cf4c47022 /src/compiler | |
parent | f5508bac2c012b9a43468c863c2d7186e78ef079 (diff) | |
download | scala-330ad12bbf800572dd8f493b87b7e501a975b0ca.tar.gz scala-330ad12bbf800572dd8f493b87b7e501a975b0ca.tar.bz2 scala-330ad12bbf800572dd8f493b87b7e501a975b0ca.zip |
new collections snapshot
Diffstat (limited to 'src/compiler')
6 files changed, 40 insertions, 38 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/DefaultDocDriver.scala b/src/compiler/scala/tools/nsc/doc/DefaultDocDriver.scala index eec98f5c20..a7d38d8245 100644 --- a/src/compiler/scala/tools/nsc/doc/DefaultDocDriver.scala +++ b/src/compiler/scala/tools/nsc/doc/DefaultDocDriver.scala @@ -6,9 +6,9 @@ package scala.tools.nsc.doc +import scala.collection.mutable import java.util.zip.ZipFile -import scala.collection.jcl import symtab.Flags._ import scala.xml._ @@ -19,7 +19,7 @@ abstract class DefaultDocDriver extends DocDriver with ModelFrames with ModelToX import global._ import definitions.{AnyClass, AnyRefClass} - lazy val additions = new jcl.LinkedHashSet[Symbol] + lazy val additions = new mutable.LinkedHashSet[Symbol] lazy val additions0 = new ModelAdditions(global) { override def addition(sym: global.Symbol) = { super.addition(sym) @@ -115,7 +115,7 @@ abstract class DefaultDocDriver extends DocDriver with ModelFrames with ModelToX new NavigationFrame with Frame { } new ListClassFrame with Frame { def classes = for (p <- allClasses; d <- p._2) yield d - object organized extends jcl.LinkedHashMap[(List[String],Boolean),List[ClassOrObject]] { + object organized extends mutable.LinkedHashMap[(List[String],Boolean),List[ClassOrObject]] { override def default(key : (List[String],Boolean)) = Nil; classes.foreach(cls => { val path = cls.path.map(_.name); @@ -131,14 +131,15 @@ abstract class DefaultDocDriver extends DocDriver with ModelFrames with ModelToX val path = cls.path.map(_.name) val key = (cls.path.map(_.name), cls.isInstanceOf[Clazz]) assert(!organized(key).isEmpty); - (if (!organized(key).tail.isEmpty) Text(" (" +{ + + ((if (!organized(key).tail.isEmpty) Text(" (" +{ //Console.println("CONFLICT: " + path + " " + organized(key)); val str = cls.path(0).sym.owner.fullNameString('.'); val idx = str.lastIndexOf('.'); if (idx == -1) str; else str.substring(idx + 1); - }+ ")"); - else NodeSeq.Empty) ++ super.optional(cls); + }+ ")"); + else NodeSeq.Empty) ++ super.optional(cls))(NodeSeq.builderFactory) } } @@ -176,7 +177,7 @@ abstract class DefaultDocDriver extends DocDriver with ModelFrames with ModelToX import DocUtil._ override def classBody(entity: ClassOrObject)(implicit from: Frame): NodeSeq = - (subClasses.get(entity.sym) match { + (((subClasses.get(entity.sym) match { case Some(symbols) => (<dl> <dt style="margin:10px 0 0 20px;"><b>Direct Known Subclasses:</b></dt> @@ -186,7 +187,7 @@ abstract class DefaultDocDriver extends DocDriver with ModelFrames with ModelToX </dl><hr/>); case None => NodeSeq.Empty - })++super.classBody(entity); + }): NodeSeq)++super.classBody(entity))//(NodeSeq.builderFactory) protected def urlFor(sym: Symbol)(implicit frame: Frame) = frame.urlFor(sym) @@ -213,7 +214,7 @@ abstract class DefaultDocDriver extends DocDriver with ModelFrames with ModelToX super.decodeOption(tag,option) } - object roots extends jcl.LinkedHashMap[String,String]; + object roots extends mutable.LinkedHashMap[String,String]; roots("classes") = "http://java.sun.com/j2se/1.5.0/docs/api"; roots("rt") = roots("classes"); private val SCALA_API_ROOT = "http://www.scala-lang.org/docu/files/api/"; @@ -260,19 +261,19 @@ abstract class DefaultDocDriver extends DocDriver with ModelFrames with ModelToX protected def anchor(entity: Symbol)(implicit frame: Frame): NodeSeq = (<a name={Text(frame.docName(entity))}></a>) - object symbols extends jcl.LinkedHashSet[Symbol] + object symbols extends mutable.LinkedHashSet[Symbol] - object allClasses extends jcl.LinkedHashMap[Package, jcl.LinkedHashSet[ClassOrObject]] { - override def default(pkg: Package): jcl.LinkedHashSet[ClassOrObject] = { - object ret extends jcl.LinkedHashSet[ClassOrObject] + object allClasses extends mutable.LinkedHashMap[Package, mutable.LinkedHashSet[ClassOrObject]] { + override def default(pkg: Package): mutable.LinkedHashSet[ClassOrObject] = { + object ret extends mutable.LinkedHashSet[ClassOrObject] this(pkg) = ret ret } } - object subClasses extends jcl.LinkedHashMap[Symbol, jcl.LinkedHashSet[ClassOrObject]] { + object subClasses extends mutable.LinkedHashMap[Symbol, mutable.LinkedHashSet[ClassOrObject]] { override def default(key: Symbol) = { - val ret = new jcl.LinkedHashSet[ClassOrObject] + val ret = new mutable.LinkedHashSet[ClassOrObject] this(key) = ret ret } diff --git a/src/compiler/scala/tools/nsc/doc/DocUtil.scala b/src/compiler/scala/tools/nsc/doc/DocUtil.scala index 3a6f2812dd..c719ad1cc6 100644 --- a/src/compiler/scala/tools/nsc/doc/DocUtil.scala +++ b/src/compiler/scala/tools/nsc/doc/DocUtil.scala @@ -92,8 +92,8 @@ object DocUtil { var ts = ts0 for (t <- ts1.elements) { if (!ts.contains(t._1)) - ts = ts.update(t._1, new TreeSet[S]); - ts = ts.update(t._1, merge(ts(t._1), t._2)) + ts = ts.add(t._1, new TreeSet[S]); + ts = ts.add(t._1, merge(ts(t._1), t._2)) } ts } diff --git a/src/compiler/scala/tools/nsc/doc/ModelAdditions.scala b/src/compiler/scala/tools/nsc/doc/ModelAdditions.scala index 5ea74bd59f..2a95b80b5e 100644 --- a/src/compiler/scala/tools/nsc/doc/ModelAdditions.scala +++ b/src/compiler/scala/tools/nsc/doc/ModelAdditions.scala @@ -398,7 +398,8 @@ class ModelAdditions(val global: Global) { }; //("Float" :: "Long" :: "Number" :: "Integer" :: Nil).foreach(boxedValDescr); */ - object exceptions extends collection.jcl.TreeMap[String,(Symbol,String)] { + object exceptions extends collection.JavaConversions.JMapWrapper[String,(Symbol,String)]( + new java.util.TreeMap()) { def f(name: String) { this("Predef." + name) = (definitions.PredefModule, name) } diff --git a/src/compiler/scala/tools/nsc/doc/ModelExtractor.scala b/src/compiler/scala/tools/nsc/doc/ModelExtractor.scala index c0acacb616..0e94ab90f7 100644 --- a/src/compiler/scala/tools/nsc/doc/ModelExtractor.scala +++ b/src/compiler/scala/tools/nsc/doc/ModelExtractor.scala @@ -6,7 +6,7 @@ package scala.tools.nsc.doc -import scala.collection.jcl +import scala.collection.mutable import compat.Platform.{EOL => LINE_SEPARATOR} @@ -32,7 +32,7 @@ trait ModelExtractor { case class Comment(body: String, attributes: List[Tag]) { def decodeAttributes = { - val map = new jcl.LinkedHashMap[String, List[(String, String)]] { + val map = new mutable.LinkedHashMap[String, List[(String, String)]] { override def default(key: String) = Nil } attributes.foreach(a => { @@ -221,11 +221,11 @@ trait ModelExtractor { def path: List[ClassOrObject] = this :: Nil override def listName = path map (_.name) mkString "." - object freshParents extends jcl.LinkedHashSet[Type] { - this addAll sym.tpe.parents - this.toList foreach (this removeAll _.parents) + object freshParents extends mutable.LinkedHashSet[Type] { + this ++= sym.tpe.parents + this.toList foreach (this --= _.parents) } - object constructorArgs extends jcl.LinkedHashMap[Symbol, ValueParam] { + object constructorArgs extends mutable.LinkedHashMap[Symbol, ValueParam] { import symtab.Flags._ sym.constrParamAccessors.filter(arg => ! (arg hasFlag SYNTHETIC)).foreach(arg => { val str = flagsToString(arg.flags) @@ -242,7 +242,7 @@ trait ModelExtractor { this(param) = new ConstructorParam(param) }); } - object decls extends jcl.LinkedHashMap[Symbol, Member] { + object decls extends mutable.LinkedHashMap[Symbol, Member] { sym.tpe.decls.elements.foreach(e => { if (!constructorArgs.contains(e)) { val m = Member(e) @@ -250,9 +250,9 @@ trait ModelExtractor { } }); } - def members0(f: Symbol => Boolean) = decls.projection.filterKeys(f).valueSet + def members0(f: Symbol => Boolean) = decls.filterKeys(f).values.toList def members(c: Category): Iterable[Member] = members0(c.f) - object inherited extends jcl.LinkedHashMap[Symbol, List[Member]]() { + object inherited extends mutable.LinkedHashMap[Symbol, List[Member]]() { override def default(tpe: Symbol) = Nil for (m <- sym.tpe.members if !sym.tpe.decls.elements.contains(m) && (Values.f(m) || Methods.f(m))) { @@ -281,15 +281,15 @@ trait ModelExtractor { override def resultType = Some(resultType0) protected def resultType0: Type override def overridden: Iterable[Symbol] = { - var ret: jcl.LinkedHashSet[Symbol] = null + var ret: mutable.LinkedHashSet[Symbol] = null for (parent <- ClassOrObject.this.parents) { val sym0 = sym.overriddenSymbol(parent.typeSymbol) if (sym0 != NoSymbol) { - if (ret == null) ret = new jcl.LinkedHashSet[Symbol]; + if (ret == null) ret = new mutable.LinkedHashSet[Symbol]; ret += sym0 } } - if (ret == null) Nil else ret.readOnly + if (ret == null) Nil else ret } } case class Def(override val sym : TermSymbol) extends ValDef(sym) { @@ -417,7 +417,7 @@ trait ModelExtractor { "[ \t]*@(exception|param|throws)[ \t]+(\\p{Graph}*)[ \t]*(.*)") def sort[E <: Entity](entities: Iterable[E]): Iterable[E] = { - val set = new jcl.TreeSet[E]()({eA: E => new Ordered[E] { + val set = new collection.immutable.TreeSet[E]()({eA: E => new Ordered[E] { def compare(eB: E): Int = { if (eA eq eB) return 0; (eA, eB) match { @@ -443,7 +443,6 @@ trait ModelExtractor { eA.equals(other) || (other match { case that: AnyRef => this.eq(that) case _ => false }) }}) - set addAll entities; - set + set ++ entities } } diff --git a/src/compiler/scala/tools/nsc/doc/ModelFrames.scala b/src/compiler/scala/tools/nsc/doc/ModelFrames.scala index 0c1e51c9cc..8475502737 100644 --- a/src/compiler/scala/tools/nsc/doc/ModelFrames.scala +++ b/src/compiler/scala/tools/nsc/doc/ModelFrames.scala @@ -8,7 +8,7 @@ package scala.tools.nsc.doc import java.io.{File, FileWriter} import util.NameTransformer -import scala.collection.jcl +import scala.collection.mutable import scala.compat.Platform.{EOL => LINE_SEPARATOR} import scala.xml.{NodeSeq, Text, Unparsed, Utility} @@ -228,7 +228,7 @@ trait ModelFrames extends ModelExtractor { {aref(navPath, contentFrame, navLabel)} </td></tr> </table>); - val ids = new jcl.LinkedHashSet[String] + val ids = new mutable.LinkedHashSet[String] def idFor(kind: Category, t: Entity)(seq : NodeSeq): NodeSeq = { val ch = t.listName.charAt(0); val id = kind.plural + "_" + ch; diff --git a/src/compiler/scala/tools/nsc/doc/ModelToXML.scala b/src/compiler/scala/tools/nsc/doc/ModelToXML.scala index 5f7137d7a3..cd90946db3 100644 --- a/src/compiler/scala/tools/nsc/doc/ModelToXML.scala +++ b/src/compiler/scala/tools/nsc/doc/ModelToXML.scala @@ -257,7 +257,7 @@ trait ModelToXML extends ModelExtractor { var seq: NodeSeq = NodeSeq.Empty if (xs.elements.hasNext) { // alphabetic - val set = new scala.collection.jcl.TreeSet[entity.Member]()(mA => new Ordered[entity.Member] { + val set = new scala.collection.immutable.TreeSet[entity.Member]()(mA => new Ordered[entity.Member] { def compare(mB: entity.Member): Int = if (mA eq mB) 0 else { @@ -273,8 +273,7 @@ trait ModelToXML extends ModelExtractor { other match { case that: entity.Member => compare(that) == 0 case that: AnyRef => this.eq(that) case _ => false } - }); - set addAll xs; + })++xs seq = seq ++ <table cellpadding="3" class="member" summary=""> <tr><td colspan="2" class="title">{Text(category.label + " Summary")}</td></tr> {set.mkXML("","\n","")(mmbr => shortHeader(mmbr))} @@ -369,8 +368,10 @@ trait ModelToXML extends ModelExtractor { if (entity.sym.hasFlag(symtab.Flags.CASE)) NodeSeq.Empty; else { val sep = Text("@") + val seq = for (attr <- entity.attributes) yield Group({(sep ++ attrFor(attr) ++ <br/>)}) + seq } } } |