diff options
author | michelou <michelou@epfl.ch> | 2007-03-07 17:42:17 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2007-03-07 17:42:17 +0000 |
commit | 687e65fb3c45ba90a6ce00d59b84c54918ea89cd (patch) | |
tree | 008dbde95c38c40933a268c8f1147c63b4d52f0e /src | |
parent | 198906fb11ee6a5848381ffea95d17003992799f (diff) | |
download | scala-687e65fb3c45ba90a6ce00d59b84c54918ea89cd.tar.gz scala-687e65fb3c45ba90a6ce00d59b84c54918ea89cd.tar.bz2 scala-687e65fb3c45ba90a6ce00d59b84c54918ea89cd.zip |
fixed 2 bugs in classs BitSet and added scalado...
fixed 2 bugs in classs BitSet and added scaladoc comment methods
isInstanceOf and synchronized
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/DocGenerator.scala | 43 | ||||
-rw-r--r-- | src/library/scala/Iterable.scala | 9 | ||||
-rw-r--r-- | src/library/scala/collection/BitSet.scala | 2 | ||||
-rw-r--r-- | src/library/scala/collection/immutable/BitSet.scala | 10 |
4 files changed, 57 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/DocGenerator.scala b/src/compiler/scala/tools/nsc/doc/DocGenerator.scala index b492574cd6..f32ba45529 100644 --- a/src/compiler/scala/tools/nsc/doc/DocGenerator.scala +++ b/src/compiler/scala/tools/nsc/doc/DocGenerator.scala @@ -780,6 +780,9 @@ abstract class DocGenerator extends Models { Text(tp + ": ") ++ forType(resultType) case _ => Text(": ") ++ forType(m.tpe) + }) ++ (comments.get(m) match { + case Some(text) => comment(text, false, DEF) + case None => NodeSeq.Empty }) } </td> @@ -988,6 +991,46 @@ abstract class DocGenerator extends Models { * </p> */""" } + comments(definitions.Object_isInstanceOf) = """ + /** <p> + * The method <code>isInstanceOf</code> is the pendant of the Java + * operator <code>instanceof</code>. + * </p> + * <p> + * See also: + * </p> + * <ul> + * <li> + * Java Language Specification (2<sup>nd</sup> Ed.): + * <a href="http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#80289" + * target="_top">Operator <code>instanceof</code></a>. + * </li> + * </ul> + */""" + comments(definitions.Object_synchronized) = """ + /** <p> + * To make your programs thread-safe, you must first identify what + * data will be shared across threads. If you are writing data that + * may be read later by another thread, or reading data that may + * have been written by another thread, then that data is shared, + * and you must synchronize when accessing it. + * </p> + * <p> + * See also: + * <p> + * <ul> + * <li> + * The Java Tutorials: + * <a href="http://java.sun.com/docs/books/tutorial/essential/concurrency/sync.html" + * target="_top">Synchronization</a>. + * </li> + * <li> + * IBM developerWorks: + * <a href="http://www-128.ibm.com/developerworks/java/library/j-threads1.html" + * target="_top">Synchronization is not the enemy</a>. + * </li> + * </ul> + */""" new PrimitiveContentFrame { def sym = definitions.AnyRefClass def descr = """ diff --git a/src/library/scala/Iterable.scala b/src/library/scala/Iterable.scala index e4c2e99810..7626c469e7 100644 --- a/src/library/scala/Iterable.scala +++ b/src/library/scala/Iterable.scala @@ -363,10 +363,15 @@ trait Iterable[+A] { * are separated by the string <code>sep</code>. * * @param sep separator string. - * @return a string representation of this iterable object. */ + * @return a string representation of this iterable object. + */ def mkString(sep: String): String = this.mkString("", sep, "") - /** Write all elements of this string into given string builder */ + /** Write all elements of this string into given string builder. + * + * @param buf ... + * @return ... + */ def addString(buf: StringBuilder, start: String, sep: String, end: String): StringBuilder = { buf.append(start) val elems = elements diff --git a/src/library/scala/collection/BitSet.scala b/src/library/scala/collection/BitSet.scala index a1343d6697..62d970c4b7 100644 --- a/src/library/scala/collection/BitSet.scala +++ b/src/library/scala/collection/BitSet.scala @@ -61,7 +61,7 @@ abstract class BitSet extends Set[Int] { def toArray: Array[Int] = { val length = memsize(capacity) val newarr = new Array[Int](length) - arraycopy(newarr, 0, this.arr, 0, length) + arraycopy(this.arr, 0, newarr, 0, length) newarr } diff --git a/src/library/scala/collection/immutable/BitSet.scala b/src/library/scala/collection/immutable/BitSet.scala index 6e33e43899..9dad0ba39e 100644 --- a/src/library/scala/collection/immutable/BitSet.scala +++ b/src/library/scala/collection/immutable/BitSet.scala @@ -39,13 +39,15 @@ class BitSet(val size: Int, val capacity: Int, ba: Array[Int], copy: Boolean) { import compat.Platform.arraycopy - protected val arr: Array[Int] = + protected val arr: Array[Int] = { + val ba1 = if (ba != null && ba.length > 0) ba else Array(0) if (copy) { - val arr = new Array[Int](ba.length) - arraycopy(ba, 0, arr, 0, ba.length) + val arr = new Array[Int](ba1.length) + arraycopy(ba1, 0, arr, 0, ba1.length) arr } else - ba + ba1 + } } |