diff options
author | michelou <michelou@epfl.ch> | 2009-07-07 13:22:17 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2009-07-07 13:22:17 +0000 |
commit | 99ede604a0a16dc0a63383cd90f8b7d38c4f8fd3 (patch) | |
tree | 2ba4101d02338f9b987c20dce5bd4a26a3e901d5 | |
parent | 1eda989ae9d36de1056711eaea93d6470ca400b6 (diff) | |
download | scala-99ede604a0a16dc0a63383cd90f8b7d38c4f8fd3.tar.gz scala-99ede604a0a16dc0a63383cd90f8b7d38c4f8fd3.tar.bz2 scala-99ede604a0a16dc0a63383cd90f8b7d38c4f8fd3.zip |
minor change (Scala comments)
-rw-r--r-- | src/library/scala/annotation/switch.scala | 7 | ||||
-rw-r--r-- | src/library/scala/collection/generic/ImmutableMapTemplate.scala | 10 | ||||
-rw-r--r-- | src/library/scala/collection/generic/MutableMapTemplate.scala | 57 | ||||
-rw-r--r-- | src/library/scala/reflect/Invocation.scala | 58 | ||||
-rw-r--r-- | src/library/scala/remote.scala | 3 | ||||
-rw-r--r-- | src/library/scala/testing/Show.scala | 36 |
6 files changed, 106 insertions, 65 deletions
diff --git a/src/library/scala/annotation/switch.scala b/src/library/scala/annotation/switch.scala index 1dfd0af88d..7a888ce904 100644 --- a/src/library/scala/annotation/switch.scala +++ b/src/library/scala/annotation/switch.scala @@ -10,8 +10,11 @@ package scala.annotation /** <p> * An annotation to be applied to a match expression. If present, * the compiler will verify that the match has been compiled to a - * tableswitch or lookupswitch, and issue an error if it instead - * compiles into a series of conditional expressions.<br/> + * <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc14.html" + * target="_top"><code>tableswitch</code></a> or + * <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc8.html#lookupswitch" + * target="_top"><code>lookupswitch</code></a>, and issue an error if it + * instead compiles into a series of conditional expressions.<br/> * Example: * </p> * <pre> diff --git a/src/library/scala/collection/generic/ImmutableMapTemplate.scala b/src/library/scala/collection/generic/ImmutableMapTemplate.scala index bf21c26a25..5fbf3fda21 100644 --- a/src/library/scala/collection/generic/ImmutableMapTemplate.scala +++ b/src/library/scala/collection/generic/ImmutableMapTemplate.scala @@ -28,7 +28,7 @@ package scala.collection.generic * <code>filter</code> return the same kind of map, you should also override: * </p> * <pre> - * <b>def</b> empty: This + * <b>def</b> empty: This</pre> * <p> * It is also good idea to override methods <code>foreach</code> and * <code>size</code> for efficiency. @@ -96,9 +96,11 @@ self => * <code>p</code> returns <code>true</code>. * * @param p A predicate over key-value pairs - * @note This method works by successively removing elements fro which the predicate is false from this set. - * If removal is slow, or you expect that most elements of the set will be removed, - * you might consider using `filter` with a negated predicate instead. + * @note This method works by successively removing elements fro which the + * predicate is false from this set. + * If removal is slow, or you expect that most elements of the set$ + * will be removed, you might consider using <code>filter</code> + * with a negated predicate instead. */ override def filterNot(p: ((A, B)) => Boolean): This = { var res: This = thisCollection diff --git a/src/library/scala/collection/generic/MutableMapTemplate.scala b/src/library/scala/collection/generic/MutableMapTemplate.scala index c5a4566e69..62ae9671c7 100644 --- a/src/library/scala/collection/generic/MutableMapTemplate.scala +++ b/src/library/scala/collection/generic/MutableMapTemplate.scala @@ -11,23 +11,33 @@ package scala.collection.generic -/** A generic template for mutable maps from keys of type A to values of type B. - * To implement a concrete mutable map, you need to provide implementations of the following methods: - * - * def get(key: A): Option[B] - * def iterator: Iterator[(A, B)] - * def += (kv: (A, B)): this.type - * def -= (key: A): this.type - * - * If you wish that methods like, take, drop, filter return the same kind of map, you should also - * override: - * - * def empty: This - * - * If you to avoid the unncessary construction of an Option object, - * you could also override apply, update, and delete. - * It is also good idea to override methods `foreach` and `size` for efficiency. - * +/** <p> + * A generic template for mutable maps from keys of type <code>A</code> to + * values of type <code>B</code>. + * </p> + * <p> + * To implement a concrete mutable map, you need to provide implementations + * of the following methods: + * </p><pre> + * <b>def</b> get(key: A): Option[B] + * <b>def</b> iterator: Iterator[(A, B)] + * <b>def</b> += (kv: (A, B)): <b>this.type</b> + * <b>def</b> -= (key: A): <b>this.type</b></pre> + * <p> + * If you wish that methods <code>like</code>, <code>take</code>, + * <code>drop</code>, <code>filter</code> return the same kind of map, you + * should also override: + * </p><pre> + * <b>def</b> empty: This</pre> + * <p> + * If you to avoid the unncessary construction of an <code>Option</code> + * object, you could also override <code>apply</code>, <code>update</code>, + * and <code>delete</code>. + * </p> + * <p> + * It is also good idea to override methods <code>foreach</code> and + * <code>size</code> for efficiency. + * </p> */ trait MutableMapTemplate[A, B, +This <: MutableMapTemplate[A, B, This] with mutable.Map[A, B]] extends MutableMapTemplateBase[A, B, This] @@ -37,8 +47,13 @@ trait MutableMapTemplate[A, B, +This <: MutableMapTemplate[A, B, This] with muta with Cloneable[This] { self => - /** A common implementation of `newBuilder` for all mutable maps in terms of `empty`. - * Overrides `MapTemplate` implementation for better efficiency. + /** <p> + * A common implementation of <code>newBuilder</code> for all mutable maps + * in terms of <code>empty</code>. + * </p> + * <p> + * Overrides <code>MapTemplate</code> implementation for better efficiency. + * </p> */ override protected[this] def newBuilder: Builder[(A, B), This] = empty @@ -58,6 +73,7 @@ trait MutableMapTemplate[A, B, +This <: MutableMapTemplate[A, B, This] with muta /** Adds a new mapping from <code>key</code> * to <code>value</code> to the map. If the map already contains a * mapping for <code>key</code>, it will be overridden. + * * @param key The key to update * @param value The new value * @return An option consisting of value associated previously associated with `key` in the map, @@ -72,7 +88,8 @@ trait MutableMapTemplate[A, B, +This <: MutableMapTemplate[A, B, This] with muta def += (kv: (A, B)): this.type /** Create a new map consisting of all elements of the current map - * plus the given mapping from `key` to `value`. + * plus the given mapping from <code>key</code> to <code>value</code>. + * * @param key The key to ad * @param value The new value * @return A fresh immutable map diff --git a/src/library/scala/reflect/Invocation.scala b/src/library/scala/reflect/Invocation.scala index d0ef9676d4..b2d3396cd9 100644 --- a/src/library/scala/reflect/Invocation.scala +++ b/src/library/scala/reflect/Invocation.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -// $Id$ +// $Id: $ package scala.reflect @@ -17,36 +17,42 @@ import java.lang.{ Class => JClass } import java.lang.reflect.{ Method => JMethod } import scala.{ Symbol => ScalaSymbol } -/** A more convenient syntax for reflective invocation. Example usage: - * - * class Obj { private def foo(x: Int, y: String): Long = x + y.length } - * - * You can call it reflectively one of two ways: - * - * import scala.reflect.Invocation._ - * (new Obj) o 'foo(5, "abc") // the 'o' method returns Any - * val x: Long = (new Obj) oo 'foo(5, "abc") // the 'oo' method casts to expected type. - * - * If you call the 'oo' method and do not give the type inferencer enough help, - * it will most likely infer Nothing, which will result in a ClassCastException. +/** <p> + * A more convenient syntax for reflective invocation.<br/> + * Example usage: + * </p><pre> + * <b>class</b> Obj { <b>private def</b> foo(x: Int, y: String): Long = x + y.length }</pre> + * <p> + * You can call it reflectively one of two ways: + * </p><pre> + * <b>import</b> scala.reflect.Invocation._ + * (<b>new</b> Obj) o 'foo(5, "abc") // the 'o' method returns Any + * <b>val</b> x: Long = (<b>new</b> Obj) oo 'foo(5, "abc") // the 'oo' method casts to expected type.</pre> + * <p> + * If you call the <code>oo</code> method and do not give the type inferencer + * enough help, it will most likely infer <code>Nothing</code>, which will + * result in a <code>ClassCastException</code>. + * </p> * * @author Paul Phillips - * */ @experimental object Invocation { - /** In order to encapsulate anything to do with reflection, we must - * overcome an issue with the boxing of primitives. If we declare a - * method which takes arguments of type Any, by the time the method - * parameters can be examined, the primitives have already been boxed. - * The reflective call will then fail because classOf[java.lang.Integer] - * is not the same thing as classOf[scala.Int]. - * - * Any useful workaround will require examining the arguments before - * the method is called. The approach here is to define two implicits, - * one for AnyRefs and one for AnyVals, and box them in a container - * which preserves their original class identity. + /** <p> + * In order to encapsulate anything to do with reflection, we must + * overcome an issue with the boxing of primitives. If we declare a + * method which takes arguments of type <code>Any</code>, by the time the + * method parameters can be examined, the primitives have already been boxed. + * The reflective call will then fail because <code>classOf[java.lang.Integer]</code> + * is not the same thing as <code>classOf[scala.Int].</code> + * </p> + * <p> + * Any useful workaround will require examining the arguments before + * the method is called. The approach here is to define two implicits, + * one for <code>AnyRef</code>'s and one for <code>AnyVal</code>'s, and + * box them in a container which preserves their original class identity. + * </p> */ trait PrimitivePreserver[T] { val value: T @@ -112,7 +118,7 @@ object Invocation implicit def makeReflectionOperators[T <: AnyRef](x: T): ReflectionOperators[T] = new ReflectionOperators(x) - /** Obtain the class object for an AnyVal. + /** Obtain the class object for an <code>AnyVal</code>. */ def getAnyValClass(x: AnyVal): JClass[_] = x match { case _: Byte => classOf[Byte] diff --git a/src/library/scala/remote.scala b/src/library/scala/remote.scala index 5208417807..612b6661e5 100644 --- a/src/library/scala/remote.scala +++ b/src/library/scala/remote.scala @@ -13,8 +13,5 @@ package scala /** * An annotation that designates the class to which it is applied as remotable. - * - * @see Method <a href="ScalaObject.html#$tag()">$tag</a> in trait - * <a href="ScalaObject.html">scala.ScalaObject</a>. */ class remote extends StaticAnnotation {} diff --git a/src/library/scala/testing/Show.scala b/src/library/scala/testing/Show.scala index 32d32d4a0c..ed1684d99b 100644 --- a/src/library/scala/testing/Show.scala +++ b/src/library/scala/testing/Show.scala @@ -1,18 +1,34 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + + package scala.testing -/** Classes inheriting trait `Show` can test their member methods using the notattion - * 'meth(arg_1, ..., arg_n), where `meth' is the name of the method and `arg_1,...,arg_n' are - * the arguments. The only difference to a normal method call is the leading quote character ('). - * A quoted method call like the one above will produces a legible diagnostic to be printed on Console. - * It is of the form - * - * meth(arg_1, ..., arg_n) gives <result> - * - * where <result> is the result of evaluating the call. +/** <p> + * Classes inheriting trait <code>Show</code> can test their member methods + * using the notattion <code>meth(arg<sub>1</sub>, ..., arg<sub>n</sub>)</code>, + * where <code>meth</code> is the name of the method and + * <code>arg<sub>1</sub>,...,arg<sub>n</sub></code> are the arguments. + * The only difference to a normal method call is the leading quote + * character ('). A quoted method call like the one above will produces a + * legible diagnostic to be printed on <a href="../Console.html" + * target="ContentFrame"><code>Console</code></a>. It is of the form + * </p><pre> + * meth(arg<sub>1</sub>, ..., arg<sub>n</sub>) gives <result></pre> + * <p> + * where <code><result></code> is the result of evaluating the call. + * </p> */ trait Show { - /** The result class of wrapper `symApply`. + /** The result class of wrapper <code>symApply</code>. * Prints out diagnostics of method applications. */ class SymApply(f: Symbol) { |